comparison demos/rpg/scripts/gamecontroller.py @ 519:14f777be6b94

Added a rudimentary Action class.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 27 May 2010 04:36:09 +0000
parents c3a026cdd91b
children b6bd314df28a
comparison
equal deleted inserted replaced
518:e4cd18a179af 519:14f777be6b94
31 from fife.extensions.soundmanager import SoundManager 31 from fife.extensions.soundmanager import SoundManager
32 from fife.extensions.loaders import loadImportFile 32 from fife.extensions.loaders import loadImportFile
33 33
34 from scripts.scene import Scene 34 from scripts.scene import Scene
35 from scripts.guicontroller import GUIController 35 from scripts.guicontroller import GUIController
36 from scripts.actors.baseactor import TalkAction
36 37
37 38
38 class KeyState(object): 39 class KeyState(object):
39 def __init__(self): 40 def __init__(self):
40 self._keystate = { } 41 self._keystate = { }
83 return 84 return
84 85
85 clickpoint = fife.ScreenPoint(event.getX(), event.getY()) 86 clickpoint = fife.ScreenPoint(event.getX(), event.getY())
86 if (event.getButton() == fife.MouseEvent.LEFT): 87 if (event.getButton() == fife.MouseEvent.LEFT):
87 self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) ) 88 self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) )
88 #self.hero.run( self.getLocationAt(clickpoint) ) 89 instances = self._gamecontroller.scene.getInstancesAt(clickpoint)
90 if instances:
91 self._gamecontroller.scene.player.nextaction = TalkAction(self, self)
89 92
90 if (event.getButton() == fife.MouseEvent.RIGHT): 93 if (event.getButton() == fife.MouseEvent.RIGHT):
91 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) 94 instances = self._gamecontroller.scene.getInstancesAt(clickpoint)
92 print "selected instances on actor layer: ", [i.getObject().getId() for i in instances] 95 print "selected instances on actor layer: ", [i.getObject().getId() for i in instances]
93 if instances: 96 if instances: