def iViewXEvent(self, inResponse): sl = Sprite(self.pnt_img, color=(255, 255, 0), scale=0.25, opacity=128) sl.set_position(int(float(inResponse[1])), int(float(inResponse[2]))) self.batch1.add(sl) sr = Sprite(self.pnt_img, color=(0, 255, 0), scale=0.25, opacity=128) sr.set_position(int(float(inResponse[3])), int(float(inResponse[4]))) self.batch2.add(sr)
class Snake(CocosNode): def __init__(self): super(Snake, self).__init__() self.score = 30 self.head = Sprite('img/circle.png', color=random.choice(rand_color)) self.head.scale = 1.5 self.head.set_position(director.get_window_size()[0] / 2, director.get_window_size()[1] / 2) eyeball = Sprite('img/circle.png', color=(253, 55, 80)) eyeball.scale = 0.5 eye_left = Sprite('img/circle.png') eye_left.y = 5 eye_left.scale = 0.5 eye_left.add(eyeball) eye_right = Sprite('img/circle.png') eye_right.y = -5 eye_right.scale = 0.5 eye_right.add(eyeball) mouth = Sprite('img/circle.png', color=(0, 0, 0)) mouth.x = +5 mouth.scale = 0.3 self.head.add(mouth) self.head.add(eye_left) self.head.add(eye_right) self.add(self.head) self.schedule_interval(self.update, random.random() * 0.2 + 0.1) def update(self, dt): self.parent.parent.update_score() def add_score(self, s=1): self.score += s
def iViewXEvent(self, inResponse): if self.state == self.STATE_CALIBRATE: print "ET_PNT", inResponse, self.calibrationPoints i = int(inResponse[0]) - 1 self.calibrationPoints[i] = (int(inResponse[1]), int(inResponse[2])) s = Sprite(self.pnt_img, color=(255, 0, 0), scale=0.75) s.set_position(self.calibrationPoints[i][0], self.calibrationPoints[i][1]) self.add(s, z=1) elif self.state == self.STATE_VALIDATE: pass
class FixationLayer(Layer): d = Dispatcher() def __init__(self, client): super(FixationLayer, self).__init__() self.client = client self.screen = director.get_window_size() self.font = font.load("Cut Outs for 3D FX", 64) fix_img = self.font.get_glyphs("G")[0].get_texture(True) fix_img.anchor_x = "center" fix_img.anchor_y = "center" self.fix = Sprite( fix_img, position=(self.screen[0] / 2, self.screen[1] / 2), color=(255, 255, 0), opacity=0, scale=0.75 ) self.add(self.fix) def on_enter(self): super(FixationLayer, self).on_enter() if isinstance(director.scene, TransitionScene): return self.client.addDispatcher(self.d) self.client.startFixationProcessing(25, 50) def on_exit(self): super(FixationLayer, self).on_exit() if isinstance(director.scene, TransitionScene): return self.client.removeDispatcher(self.d) self.client.stopFixationProcessing() @d.listen("ET_FIX") def iViewXEvent(self, inResponse): self.fix.set_position(float(inResponse[2]), float(inResponse[3])) self.fix.opacity = 96 @d.listen("ET_EFX") def iViewXEvent(self, inResponse): self.fix.opacity = 0
class Paddle(object): def __init__(self, imagepath): super(Paddle, self).__init__() self.sprite = Sprite(imagepath) self.speed = 10 self.move_left = False self.move_right = False def reset(self): self.sprite.position = (320, 0) def update(self): x, y = self.sprite.position if self.move_left: x -= self.speed if self.move_right: x += self.speed # if x < 0: x = 0 if x + self.sprite.width > 640: x = 640 - self.sprite.width self.sprite.set_position(x, y)
class CalibrationLayer(ColorLayer, event.EventDispatcher): is_event_handler = True d = Dispatcher() STATE_REFUSED = -1 STATE_INIT = 0 STATE_CALIBRATE = 1 STATE_VALIDATE = 2 STATE_DONE = 3 def __init__(self, client): super(CalibrationLayer, self).__init__(0, 0, 255, 255) self.client = client self.on_success = None self.on_failure = None self.window = director.window.get_size() self.screen = director.get_window_size() self.center_x = self.screen[0] / 2 self.center_y = self.screen[1] / 2 self.win_scale = (self.screen[0] / self.window[0], self.screen[1] / self.window[1]) self.font = font.load('Cut Outs for 3D FX', 32) circle_img = self.font.get_glyphs("E")[0].get_texture(True) circle_img.anchor_x = 'center' circle_img.anchor_y = 'center' self.circle = Sprite(circle_img, color=(255, 255, 0), scale=1, opacity=0) self.spinner = Sprite(resource.image('spinner.png'), position=(self.screen[0] / 2, self.screen[1] / 2), color=(255, 255, 255)) def on_enter(self): super(CalibrationLayer, self).on_enter() if isinstance(director.scene, TransitionScene): return director.window.set_mouse_visible(False) self.client.addDispatcher(self.d) self.reset() self.start() def on_exit(self): super(CalibrationLayer, self).on_exit() if isinstance(director.scene, TransitionScene): return self.reset() self.client.removeDispatcher(self.d) def init(self): self.ts = -1 self.eye_position = None self.calibrationPoints = [None] * 9 self.calibrationResults = [] self.add(self.circle, z=1) self.state = self.STATE_INIT def reset(self): self.client.cancelCalibration() for c in self.get_children(): c.stop() self.remove(c) self.init() def start(self): if self.state > self.STATE_REFUSED: self.dispatch_event("show_headposition") self.state = self.STATE_CALIBRATE self.client.setDataFormat('%TS %ET %SX %SY %DX %DY %EX %EY %EZ') self.client.startDataStreaming() self.client.setSizeCalibrationArea(self.window[0], self.window[1]) self.client.setCalibrationParam(1, 1) self.client.setCalibrationParam(2, 0) self.client.setCalibrationParam(3, 1) self.client.setCalibrationCheckLevel(3) self.client.startCalibration(9, 0) def on_key_press(self, symbol, modifiers): if symbol == key.SPACE: if self.state == self.STATE_CALIBRATE and not self.circle.actions: self.client.acceptCalibrationPoint() return True elif self.state == self.STATE_DONE: self.reset() self.on_success() return True elif symbol == key.R: self.reset() self.start() return True elif symbol == key.W and (modifiers & key.MOD_ACCEL): #self.reset() self.on_failure() return True @d.listen('CONNECTION_REFUSED') def iViewXEvent(self, inResponse): self.state = self.STATE_REFUSED self.label = Label("Connection to iViewX server refused!", position=(self.screen[0] / 2, self.screen[1] / 2), align='center', anchor_x='center', anchor_y='center', width=self.screen[0], font_size=32, color=(255, 255, 255, 255), font_name="Monospace", multiline=True) self.add(self.label, z=1) @d.listen('ET_CAL') def iViewXEvent(self, inResponse): pass @d.listen('ET_CSZ') def iViewXEvent(self, inResponse): pass @d.listen('ET_PNT') def iViewXEvent(self, inResponse): self.calibrationPoints[int(inResponse[0]) - 1] = (int(inResponse[1]), int(inResponse[2])) @d.listen('ET_CHG') def iViewXEvent(self, inResponse): currentPoint = int(inResponse[0]) - 1 x = self.calibrationPoints[currentPoint][0] * self.win_scale[0] y = self.calibrationPoints[currentPoint][1] * self.win_scale[1] self.circle.opacity = 255 if currentPoint == 0: self.circle.set_position(x, y) else: self.circle.do(MoveTo((x, y), .5)) @d.listen('ET_VLS') def iViewXEvent(self, inResponse): if self.state == self.STATE_VALIDATE: self.calibrationResults.append(' '.join(inResponse)) if len(self.calibrationResults) == 2: self.remove(self.spinner) self.remove(self.label) text = '\n'.join(self.calibrationResults).decode("cp1252") text += "\n\n\nPress 'R' to recalibrate, spres 'Spacebar' to continue..." self.label = Label(text, position=(self.screen[0] / 2, self.screen[1] / 2), align='center', anchor_x='center', anchor_y='center', width=self.screen[0], font_size=32, color=(255, 255, 255, 255), font_name="Monospace", multiline=True) self.add(self.label) self.state = self.STATE_DONE @d.listen('ET_CSP') def iViewXEvent(self, inResponse): pass @d.listen('ET_FIN') def iViewXEvent(self, inResponse): if self.state != self.STATE_VALIDATE: self.dispatch_event("hide_headposition") self.state = self.STATE_VALIDATE self.remove(self.circle) self.add(self.spinner) self.spinner.do(Repeat(RotateBy(360, 1))) self.label = Label("CALCULATING CALIBRATION ACCURACY", position=(self.screen[0] / 2, self.screen[1] / 4 * 3), font_size=32, color=(255, 255, 255, 255), font_name="Monospace", anchor_x='center', anchor_y='center') self.add(self.label) self.client.requestCalibrationResults() self.client.validateCalibrationAccuracy()
class CalibrationLayer(ColorLayer, event.EventDispatcher): is_event_handler = True d = Dispatcher() STATE_REFUSED = -1 STATE_INIT = 0 STATE_CALIBRATE = 1 STATE_VALIDATE = 2 STATE_DONE = 3 def __init__(self, client, points=9, eye=1, wait=1, randomize=1, auto=0, speed=1, level=3): super(CalibrationLayer, self).__init__(0, 0, 255, 255) self.client = client self.points = points self.eye = eye self.wait = wait self.randomize = randomize self.auto = auto self.speed = speed self.level = level self.on_success = None self.on_failure = None self.window = director.window.get_size() self.screen = director.get_window_size() self.center_x = self.screen[0] / 2 self.center_y = self.screen[1] / 2 self.win_scale = (self.screen[0] / self.window[0], self.screen[1] / self.window[1]) self.font = font.load("Cut Outs for 3D FX", 32) self.circle_img = self.font.get_glyphs("E")[0].get_texture(True) self.circle_img.anchor_x = "center" self.circle_img.anchor_y = "center" self.pnt_img = self.font.get_glyphs("Y")[0].get_texture(True) self.pnt_img.anchor_x = "center" self.pnt_img.anchor_y = "center" self.circle = Sprite(self.circle_img, color=(255, 255, 0), scale=1, opacity=0) self.spinner = Sprite( resource.image("spinner.png"), position=(self.screen[0] / 2, self.screen[1] / 2), color=(255, 255, 255) ) def on_enter(self): super(CalibrationLayer, self).on_enter() if isinstance(director.scene, TransitionScene): return director.window.set_mouse_visible(False) self.client.addDispatcher(self.d) self.reset() self.start() def on_exit(self): super(CalibrationLayer, self).on_exit() if isinstance(director.scene, TransitionScene): return self.reset() self.client.removeDispatcher(self.d) def init(self): self.ts = -1 self.eye_position = None self.calibrationPoints = [None] * 9 self.calibrationResults = [] self.add(self.circle, z=2) self.state = self.STATE_INIT def reset(self): self.client.cancelCalibration() for c in self.get_children(): c.stop() self.remove(c) self.batch1 = BatchNode() self.batch2 = BatchNode() self.init() def start(self): if self.state > self.STATE_REFUSED: print "start" self.dispatch_event("show_headposition") self.state = self.STATE_CALIBRATE self.client.stopDataStreaming() self.client.setSizeCalibrationArea(self.width, self.height) self.client.setCalibrationParam(0, self.wait) self.client.setCalibrationParam(1, self.randomize) self.client.setCalibrationParam(2, self.auto) self.client.setCalibrationParam(3, self.speed) self.client.setCalibrationCheckLevel(self.level) if self.eye == 1 or self.eye == 2: self.client.startCalibration(self.points, self.eye) else: self.client.startCalibration(self.points) def on_key_press(self, symbol, modifiers): if symbol == key.SPACE: if self.state == self.STATE_CALIBRATE and not self.circle.actions: self.client.acceptCalibrationPoint() return True elif self.state == self.STATE_DONE: self.reset() self.on_success() return True elif symbol == key.R: self.reset() self.start() return True elif symbol == key.W and (modifiers & key.MOD_ACCEL): # self.reset() self.on_failure() return True @d.listen("CONNECTION_REFUSED") def iViewXEvent(self, inResponse): self.state = self.STATE_REFUSED self.label = Label( "Connection to iViewX server refused!", position=(self.screen[0] / 2, self.screen[1] / 2), align="center", anchor_x="center", anchor_y="center", width=self.screen[0], font_size=32, color=(255, 255, 255, 255), font_name="Monospace", multiline=True, ) self.add(self.label, z=1) @d.listen("ET_CAL") def iViewXEvent(self, inResponse): print "ET_CAL", inResponse @d.listen("ET_CSZ") def iViewXEvent(self, inResponse): print "ET_CSZ", inResponse @d.listen("ET_PNT") def iViewXEvent(self, inResponse): if self.state == self.STATE_CALIBRATE: print "ET_PNT", inResponse, self.calibrationPoints i = int(inResponse[0]) - 1 self.calibrationPoints[i] = (int(inResponse[1]), int(inResponse[2])) s = Sprite(self.pnt_img, color=(255, 0, 0), scale=0.75) s.set_position(self.calibrationPoints[i][0], self.calibrationPoints[i][1]) self.add(s, z=1) elif self.state == self.STATE_VALIDATE: pass @d.listen("ET_CHG") def iViewXEvent(self, inResponse): print "ET_CHG", inResponse currentPoint = int(inResponse[0]) - 1 x = self.calibrationPoints[currentPoint][0] * self.win_scale[0] y = self.calibrationPoints[currentPoint][1] * self.win_scale[1] self.circle.opacity = 255 if currentPoint == 0: self.circle.set_position(x, y) else: self.circle.do(MoveTo((x, y), 0.75)) @d.listen("ET_VLS") def iViewXEvent(self, inResponse): print "ET_VLS", inResponse if self.state == self.STATE_VALIDATE: self.calibrationResults.append(" ".join(inResponse)) if len(self.calibrationResults) == 2: self.remove(self.spinner) self.remove(self.label) text = "\n".join(self.calibrationResults).decode("cp1252") text += "\n\n\nPress 'R' to recalibrate, spres 'Spacebar' to continue..." self.label = Label( text, position=(self.screen[0] / 2, self.screen[1] / 2), align="center", anchor_x="center", anchor_y="center", width=self.screen[0], font_size=32, color=(255, 255, 255, 255), font_name="Monospace", multiline=True, ) self.add(self.label) self.state = self.STATE_DONE @d.listen("ET_CSP") def iViewXEvent(self, inResponse): sl = Sprite(self.pnt_img, color=(255, 255, 0), scale=0.25, opacity=128) sl.set_position(int(float(inResponse[1])), int(float(inResponse[2]))) self.batch1.add(sl) sr = Sprite(self.pnt_img, color=(0, 255, 0), scale=0.25, opacity=128) sr.set_position(int(float(inResponse[3])), int(float(inResponse[4]))) self.batch2.add(sr) @d.listen("ET_FIN") def iViewXEvent(self, inResponse): print "ET_FIN", inResponse if self.state != self.STATE_VALIDATE: self.add(self.batch1, z=1) self.add(self.batch2, z=1) self.dispatch_event("hide_headposition") self.state = self.STATE_VALIDATE self.remove(self.circle) self.add(self.spinner) self.spinner.do(Repeat(RotateBy(360, 1))) self.label = Label( "CALCULATING CALIBRATION ACCURACY", position=(self.screen[0] / 2, self.screen[1] / 4 * 3), font_size=32, color=(255, 255, 255, 255), font_name="Monospace", anchor_x="center", anchor_y="center", ) self.add(self.label) self.client.requestCalibrationResults() self.client.validateCalibrationAccuracy()
class Ruler(ac.Move): def __init__(self, side, spawnHeight, width, height, speed, layer): self.layer = layer # self.xsize = 16 # self.ysize = 141 self.ruler = Sprite("ruler1p.png") # self.currx = 300 # self.curry = 113 # self.wsprite = Sprite(self.spritefile) # self.wsprite.position = self.currx, self.curry self.rulerBody = pm.Body(100, pm.moment_for_box(1000**5, 800, height)) # mass, moment self.bruler = pm.Poly.create_box(self.rulerBody, size=(width, height), radius=10) #self.ruler.scale_x = width / 800 self.ruler.scale_y = height / 16. self.rulerBody.position = -400 if side == 0 else 1200, spawnHeight # random.randint(20,400), 200 self.ruler.position = self.rulerBody.position # self.rulerBody.angle = 90 self.rulerBody.group = 2 space.add(self.rulerBody, self.bruler) self.rulerBody.velocity = (speed if side ==0 else -speed, 0) # def updatepos(xchange, ychange): # pass #self.rulerBody.apply_force((0.0, 90000000.0), self.rulerBody.position) def addComponents(self, layer): layer.add(self.ruler) def alignPhys(self): self.ruler.set_position(*self.rulerBody.position) self.ruler.rotation = self.rulerBody.angle if self.rulerBody.position[0] > 1200 or self.rulerBody.position[0] < -400: self.replace() def replace(self): #self.rulerBody = pm.Body(100, pm.moment_for_box(100**3, 800, height)) # mass, moment #self.bruler = pm.Poly.create_box(self.rulerBody, size=(800, height), radius=3) space.remove(self.rulerBody) space.remove(self.bruler) height = random.randint(10, 50) width = random.randint(400, 800) vdir = random.randint(0, 1) self.rulerBody = pm.Body(100, pm.moment_for_box(1000**5, 800, height)) # mass, moment side = random.randint(0, 1) # if vdir > 0: # a = width # width = height # height = a # self.layer.remove(self.ruler) # self.ruler = Sprite("ruler.png") # self.layer.add(self.ruler) # spawnWidth = random.randint(50, 400) # speed = random.randint(100, 250) # self.rulerBody.position = spawnWidth, -399 if side == 0 else 1199 #random.randint(20,400), 200 # self.ruler.position = self.rulerBody.position # self.rulerBody.velocity = (0, speed if side == 0 else -speed) # else: #self.layer.remove(self.ruler) #self.ruler = Sprite("ruler1p.png") #self.layer.add(self.ruler) spawnHeight = random.randint(50, 400) speed = random.randint(100, 250) self.rulerBody.position = -399 if side == 0 else 1199, spawnHeight #random.randint(20,400), 200 self.ruler.position = self.rulerBody.position self.rulerBody.velocity = (speed if side == 0 else -speed, 0) self.bruler = pm.Poly.create_box(self.rulerBody, size=(width, height), radius=10) space.add(self.rulerBody, self.bruler) self.ruler.scale_x = width / 800 self.ruler.scale_y = height / 16.
class Me(ac.Move): def __init__(self, cIn, start, angleIn, crowns, layer): self.layer = layer self.crowns = crowns self.crownObj = [] self.c = cIn self.batch = cocos.batch.BatchNode() # The root node's location mass = 100 self.start = start #self.controller = pm.Body() self.body = pm.Body(mass*10, pm.moment_for_box(mass**3, 40, 160)) # mass, moment # Somehow size is the other way around.... height width? self.body.position = self.start # random.randint(20,400), 200 #self.body.angle = 10 # random.random() * math.pi #self.bbody = pm.Poly(self.body, [[0,0],[40,0],[40,160],[0,160]], offset=(0,0), radius=int(cIn)) self.bbody = pm.Poly(self.body, [[0,10],[35,10],[35,90],[0,90]], offset=(0,0), radius=int(cIn)) #self.bbody = pm.Poly(self.controller, [[0,0],[40,0],[40,160],[0,160]], offset=(0,0)) # moment = pm.moment_for_box(mass, 20, 30) # self.body = pm.Body(mass, moment) # self.torso = Sprite('00' + cIn + 'charbody.png') self.torsor = Sprite('00' + cIn + 'charbodyreversed.png') # torso = pm.Poly.create_box(self.body, size=(40, 60), offset=(20,60)) #torso.friction = 10 self.head = Sprite('00' + cIn + 'charhead.png') self.headr = Sprite('00' + cIn + 'charheadreversed.png') # self.head_attach = pm.Body(mass, pm.moment_for_box(mass, 40, 40)) # head = pm.Poly.create_box(self.body, size=(40, 40), offset=(20,120)) # head.friction = 10 # self.head_attach.position = self.body.position + (0,60) self.larm = Sprite('00' + cIn + 'charlarm.png') self.larm.anchor = (15, 30) #self.larm.anchor = (20, 60) # self.larm_attach = pm.Body(mass, pm.moment_for_box(mass, 20, 60)) # larm = pm.Poly.create_box(self.body, size=(20, 60), offset=(0,60)) # larm.friction = 10 # self.larm_attach.position = self.body.position + (-20,0) self.rarm = Sprite('00' + cIn + 'charrarm.png') self.rarm.anchor = (-15, 30) # self.rarm_attach = pm.Body(mass, pm.moment_for_box(mass, 20, 60)) # rarm = pm.Poly.create_box(self.body, size=(20, 60), offset=(60,60)) # rarm.friction = 10 # self.rarm_attach.position = self.body.position + (40,0) self.lleg = Sprite('00' + cIn + 'charlleg.png') self.lleg.anchor = (0, 30) # self.lleg_attach = pm.Body(mass, pm.moment_for_box(mass, 20, 60)) # lleg = pm.Poly.create_box(self.body, size=(20, 60), offset=(20,0)) # lleg.friction = 10 # self.lleg_attach.position = self.body.position + (0,-60) self.rleg = Sprite('00' + cIn + 'charrleg.png') self.rleg.anchor = (0, 30) # self.rleg_attach = pm.Body(mass, pm.moment_for_box(mass, 20, 60)) # rleg = pm.Poly.create_box(self.body, size=(20, 60), offset=(40,0)) # rleg.friction = 10 # self.rleg_attach.position = self.body.position + (20,-60) print("as") self.updateCrowns() # body_rleg.distance = 0 self.torso.rotation = self.body.angle self.head.rotation = self.body.angle self.torsor.rotation = self.body.angle self.headr.rotation = self.body.angle self.larm.rotation = self.body.angle self.rarm.rotation = self.body.angle self.lleg.rotation = self.body.angle self.rleg.rotation = self.body.angle self.torso.scale = 0.4 self.head.scale = 0.7 self.torsor.scale = 0.4 self.headr.scale = 0.7 self.larm.scale = 0.4 self.rarm.scale = 0.4 self.lleg.scale = 0.4 self.rleg.scale = 0.4 self.bbody.elasticity = 1 #self.body.elasticity = 1 #self.body.friction = 0.3 self.body.group = 0 self.larmrot = 0 self.rarmrot = 0 self.llegrot = 0 self.rlegrot = 0 self.living = 1 space.add(self.bbody, self.body) # , #self.head_attach, self.larm_attach, self.rarm_attach, self.lleg_attach, self.rleg_attach, #body_head, body_larm, body_rarm, body_lleg, body_rleg, #head, torso, larm, rarm, lleg, rleg) def updateCrowns(self): i = 0 for item in self.crownObj: self.layer.remove(item) self.crownObj = [] for item in self.crowns: itspr = cocos.sprite.Sprite(item) itspr.scale_y = playerCrownScale itspr.scale_x = playerCrownScale itspr.position = self.body.position + (20,(crownFloatDistance + (playerCrownVisualSeperation*i))) self.layer.add(itspr) self.crownObj.append(itspr) i += 1 self.bbody.unsafe_set_vertices([[0,10],[35,10],[35,90+(i*playerCrownVisualSeperation)],[0,90+(i*playerCrownVisualSeperation)]]) #print(self.crowns) #for item in self.crowns: # self.spritem = Sprite(item) # self.spritem.do( Place( (120, 330) )) # print(item) # print(self.spritem) #self.spritem.anchor(0,100) def alignPhys(self): self.torso.set_position(*self.body.position + (20,50)) self.head.set_position(*self.body.position + (20,80)) self.torsor.set_position(*self.body.position + (20,50)) self.headr.set_position(*self.body.position + (20,80)) self.larm.set_position(*self.body.position + (0,30)) self.rarm.set_position(*self.body.position + (40,30)) self.lleg.set_position(*self.body.position + (10,10)) self.rleg.set_position(*self.body.position + (30,10)) self.torso.rotation = self.body.angle self.head.rotation = self.body.angle self.torsor.rotation = self.body.angle self.headr.rotation = self.body.angle self.larm.rotation = self.body.angle + self.larmrot self.rarm.rotation = self.body.angle + self.rarmrot self.lleg.rotation = self.body.angle + self.llegrot self.rleg.rotation = self.body.angle + self.rlegrot i = 0 for item in self.crownObj: item.position = self.body.position + (20,(crownFloatDistance + (playerCrownVisualSeperation * i))) i += 1 if self.living == 0: self.head.do(ac.Hide()) self.headr.do(ac.Hide()) if self.living == 1: self.head.do(ac.Show()) self.headr.do(ac.Show()) def addComponents(self, layer): self.layer.add(self.lleg) self.layer.add(self.rleg) self.layer.add(self.larm) self.layer.add(self.rarm) self.layer.add(self.head) self.layer.add(self.torso) self.layer.add(self.headr) self.layer.add(self.torsor) self.layer.add(self.batch) pass def reset(self): #self.body.position = self.start #self.body.reset_forces() #self.bbody.reset_forces() self.living = 1 self.updateCrowns() print("d")