Exemplo n.º 1
0
	def initEvents(self):
		#print 'GameControl.initEvents'
		playerMoveRightOn = createNamedEvent(
			self.player.name, EventType.PLAYER_MOVE_RIGHT_ON
		)
		playerMoveRightOff = createNamedEvent(
			self.player.name, EventType.PLAYER_MOVE_RIGHT_OFF
		)
		playerMoveLeftOn = createNamedEvent(
			self.player.name, EventType.PLAYER_MOVE_LEFT_ON
		)
		playerMoveLeftOff = createNamedEvent(
			self.player.name, EventType.PLAYER_MOVE_LEFT_OFF
		)
		playerJumpOn = createNamedEvent(
			self.player.name, EventType.PLAYER_JUMP_ON
		)
		playerJumpOff = createNamedEvent(
			self.player.name, EventType.PLAYER_JUMP_OFF
		)

		self.accept(playerMoveRightOn, self.ball.startMoveRight)
		self.accept(playerMoveRightOff, self.ball.stopMoveRight)
		self.accept(playerMoveLeftOn, self.ball.startMoveLeft)
		self.accept(playerMoveLeftOff, self.ball.stopMoveLeft)
		self.accept(playerJumpOn, self.ball.jumpOn)
		self.accept(playerJumpOff, self.ball.jumpOff)

		self.accept(GameControl.PLAYER_RIGHT_KEY, self.ball.arrowRightDown)
		self.accept(GameControl.PLAYER_RIGHT_KEY + "-up", self.ball.arrowRightUp)
		self.accept(GameControl.PLAYER_LEFT_KEY, self.ball.arrowLeftDown)
		self.accept(GameControl.PLAYER_LEFT_KEY + "-up", self.ball.arrowLeftUp)
		
		self.accept(EventType.CONTROL_CHANGE, self.controlLocation)
		
		self.accept(GameControl.PLAYER_UP_KEY, self.ball.arrowUpDown)
		self.accept(GameControl.PLAYER_UP_KEY + "-up", self.ball.arrowUpUp)
		self.accept(GameControl.PLAYER_DOWN_KEY, self.ball.arrowDownDown)
		self.accept(GameControl.PLAYER_DOWN_KEY + "-up", self.ball.arrowDownUp)
		
		self.accept(GameControl.PLAYER_JUMP, self.player.jumpOn)
		self.accept(GameControl.PLAYER_JUMP + "-up", self.player.jumpOff)
		
		self.accept(GameControl.TURN_GRAVITY, self.model.turnGravityTask )
		self.accept(GameControl.TURN_GRAVITY2, self.model.turnGravityTask2 )
		
		if self.TOGGLE_VERB:
			print self.ball
			print self
Exemplo n.º 2
0
 def moveLeftOff(self):
     self.left = False
     moveEvent = createNamedEvent(self.name, EventType.PLAYER_MOVE_LEFT_OFF)
     messenger.send(moveEvent)
Exemplo n.º 3
0
 def moveLeftOn(self):
     self.left = True
     moveEvent = createNamedEvent(self.name, EventType.PLAYER_MOVE_LEFT_ON)
     messenger.send(moveEvent)
Exemplo n.º 4
0
 def moveRightOff(self):
     self.right = False
     moveEvent = createNamedEvent(self.name,
                                  EventType.PLAYER_MOVE_RIGHT_OFF)
     messenger.send(moveEvent)
Exemplo n.º 5
0
 def moveRightOn(self):
     self.right = True
     moveEvent = createNamedEvent(self.name, EventType.PLAYER_MOVE_RIGHT_ON)
     messenger.send(moveEvent)
Exemplo n.º 6
0
 def jumpOff(self):
     jumpEvent = createNamedEvent(self.name, EventType.PLAYER_JUMP_OFF)
     messenger.send(jumpEvent)