예제 #1
0
	def __init__(self, key, keyboard):
		print('key init: ',key)
		self.pressed = EventHook()
		self.released = EventHook()
		self._key = key
		keyboard.keyPressed += self._keyPressed
		keyboard.keyReleased += self._keyReleased
예제 #2
0
class Keyboard:
	def __init__(self):
		print('Keyboard init')
		self.keyPressed = EventHook()
		self.keyReleased = EventHook()
        
	def AKeyHasBeenPressed(self,key):
		self.keyPressed.fire(key)
   		
	def AKeyHasBeenReleased(self, key):
		self.keyReleased.fire(key)
예제 #3
0
class KeyEvent:

	def __init__(self, key, keyboard):
		print('key init: ',key)
		self.pressed = EventHook()
		self.released = EventHook()
		self._key = key
		keyboard.keyPressed += self._keyPressed
		keyboard.keyReleased += self._keyReleased
		
	def _keyPressed(self,key):
		if(key == self._key):
			self.pressed.fire()
		
	def _keyReleased(self,key):
		if(key == self._key):
			self.released.fire()
예제 #4
0
class Avatar(Character):
	energy = 0
	boosts = []
	
	# Events
	AVATAR_MOVE = None
	
	def __init__(self):
		super().__init__()
		self.AVATAR_MOVE = EventHook()
		print("Avatar init")
	def moveTo(self, x, y):
		super().moveTo(x,y);
		self.AVATAR_MOVE.fire(self)
	def attack(self, monster):
		if monster == None:
			return
		if self.activeWeapon == None:
			self.setActiveWeapon(None, True)
		damage = self.getActiveWeapon().getDamage()
		print("Attacked for " + str(damage) + " damage!")
	def acquire(self):
		print("Acquiring an item")
예제 #5
0
	def __init__(self):
		print('Keyboard init')
		self.keyPressed = EventHook()
		self.keyReleased = EventHook()
예제 #6
0
	def __init__(self):
		super().__init__()
		self.AVATAR_MOVE = EventHook()
		print("Avatar init")