예제 #1
0
        def onUpdate(self):
            self.gameObject.aggressive = True

            if self.movingUp:
                if self.active:
                    self.gameObject.getComponent(Physics).velocity = Vector2(
                        0, 50)
                else:
                    self.gameObject.aggressive = False

                if self.gameObject.transform.position.y >= self.startPositionY + 24:
                    self.gameObject.getComponent(Physics).velocity = Vector2(
                        0, 0)

            elif not self.movingUp:
                self.gameObject.getComponent(Physics).velocity = Vector2(
                    0, -50)

                if self.gameObject.transform.position.y <= self.startPositionY:
                    self.gameObject.getComponent(Physics).velocity = Vector2(
                        0, 0)
                    self.gameObject.aggressive = False

                    if not self.active:
                        Timer.remove(self.hideTimer)
예제 #2
0
		def onCollisionEnter(self, other, side):
			if "Player" in other.tags:
				Timer.remove(self.walkTimer)

				if side == Sides.TOP_SIDE:
					self.script.state = KoopaTroopaScript.Stomped(self.script)
				else:
					self.script.state = KoopaTroopaScript.Bowling(self.script, other)
예제 #3
0
    def decrement(self):
        self.time -= 1
        self.text = "TIME\n{:03d}".format(self.time)

        if self.time == 100:
            Resources.bgMusic.pause()
            p = Resources.hurryUp.play()
            p.volume = 0.15

            def f():
                setBgMusic(self.fastMusic).play()
                Resources.bgMusic.pitch = 1.05

            p.set_handler("on_player_eos", f)

        if self.time <= 0:
            Timer.remove(self.countdown)
            players = World.findByTag("Player")
            for player in players:
                # TODO: Just die
                player.state.downgrade()
예제 #4
0
        def active(self, val):
            if val is True and self._active is False:
                Timer.remove(self.showUpTimer)

                def goUp():
                    self.movingUp = True

                self.showUpTimer = Timer.add(goUp, (), 2000, 4000, -1)

                Timer.remove(self.hideTimer)

                def goDown():
                    self.movingUp = False

                self.hideTimer = Timer.add(goDown, (), 0, 4000, -1)

            if val is False and self._active is True:
                Timer.remove(self.showUpTimer)
                Timer.remove(self.hideTimer)

            self._active = val
예제 #5
0
 def restart(self):
     Timer.remove(self.countdown)
     self.countdown = Timer.add(self.decrement, (), 400, 400, -1)
예제 #6
0
 def stop(self):
     Timer.remove(self.countdown)
예제 #7
0
		def onDestroy(self):
			Timer.remove(self.walkTimer)
예제 #8
0
		def onDestroy(self):
			Timer.remove(self.recoverTimer)
예제 #9
0
		def onCollisionEnter(self, other, side):
			if "Player" in other.tags:
				Timer.remove(self.recoverTimer)
				self.script.state = KoopaTroopaScript.Bowling(self.script, other)
예제 #10
0
from gameengine.core.Timer import Timer

from time import sleep


def fun1(text):
    print(text)


t1 = Timer.add(fun1, ("1"), 1000, 500, 3)
t2 = Timer.add(fun1, ("2"), 750, 500, -1)
t3 = Timer.add(fun1, ("3"), 100, 1000, 1)
t4 = Timer.add(fun1, ("2"), 750, 500, -1)

Timer.remove(t4)

while True:
    Timer.tick()

    sleep(0.01)
예제 #11
0
 def onDestroy(self):
     Timer.remove(self.showUpTimer)
     Timer.remove(self.hideTimer)
     from gameengine.core.World import World
     World.findByTag("Score")[0].add(100)