Example #1
0
    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")
Example #2
0
    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")
Example #3
0
 def onCollision(self, col, obj):
     if obj.name == "Player":
         Game.loadSceneByName(self.nextlevel)
Example #4
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName("StartScene")
Example #5
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName(self.firstScene)
Example #6
0
 def onCollision(self,col,obj):
     if obj.name == "Player":
         Game.loadSceneByName(self.nextlevel)
Example #7
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName("StartScene")
Example #8
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName(GameOver.currentScene)
Example #9
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName(self.firstScene)
Example #10
0
 def update(self):
     if Input.down(K_SPACE):
         Game.loadSceneByName(GameOver.currentScene)