def onCollision(self,col,obj): nobounce = ["NoJump","WinStar"] if obj.name not in nobounce: channel = self.bounce.play() # Bounce off the object self.translate(col.minTranslation) if sign(col.minTranslation.y) == -1: self.speed.y = -self.jumpspeed elif sign(col.minTranslation.y) == 1: self.speed.y = self.jumpspeed if obj.name == "Spikes": Game.loadSceneByName("GameOver")
def update(self): """Called every frame. Handles movement and other state updates.""" if Input.down(K_LEFT): self.speed.x -= self.movespeed if Input.up(K_LEFT): self.speed.x += self.movespeed if Input.down(K_RIGHT): self.speed.x += self.movespeed if Input.up(K_RIGHT): self.speed.x -= self.movespeed self.jumpspeed = lerp(self.jumpspeed,self.startJumpspeed,0.02) self.translate(self.speed) self.collider.center = self.position self.speed.y += 0.5 if self.position.y >= 1000: Game.loadSceneByName("GameOver")
def onCollision(self, col, obj): if obj.name == "Player": Game.loadSceneByName(self.nextlevel)
def update(self): if Input.down(K_SPACE): Game.loadSceneByName("StartScene")
def update(self): if Input.down(K_SPACE): Game.loadSceneByName(self.firstScene)
def onCollision(self,col,obj): if obj.name == "Player": Game.loadSceneByName(self.nextlevel)
def update(self): if Input.down(K_SPACE): Game.loadSceneByName(GameOver.currentScene)