Mercurial > fife-parpg
comparison demos/rpg/scripts/gamecontroller.py @ 520:b6bd314df28a
Added a quest dialog.
Added QuestGiver class.
Moved level specific settings to another file.
Added BaseItem class.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 27 May 2010 16:29:07 +0000 |
parents | 14f777be6b94 |
children | 494c60cf61cf |
comparison
equal
deleted
inserted
replaced
519:14f777be6b94 | 520:b6bd314df28a |
---|---|
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 from scripts.actors.baseactor import TalkAction |
37 from scripts.objects.baseobject import GameObjectTypes | |
37 | 38 |
38 | 39 |
39 class KeyState(object): | 40 class KeyState(object): |
40 def __init__(self): | 41 def __init__(self): |
41 self._keystate = { } | 42 self._keystate = { } |
86 clickpoint = fife.ScreenPoint(event.getX(), event.getY()) | 87 clickpoint = fife.ScreenPoint(event.getX(), event.getY()) |
87 if (event.getButton() == fife.MouseEvent.LEFT): | 88 if (event.getButton() == fife.MouseEvent.LEFT): |
88 self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) ) | 89 self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) ) |
89 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) | 90 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) |
90 if instances: | 91 if instances: |
91 self._gamecontroller.scene.player.nextaction = TalkAction(self, self) | 92 obj = self._gamecontroller.scene.objectlist[instances[0].getId()] |
93 print obj.type | |
94 if obj.type == GameObjectTypes["QUESTGIVER"]: | |
95 action = TalkAction(self._gamecontroller.scene.player, obj) | |
96 self._gamecontroller.scene.player.nextaction = action | |
92 | 97 |
93 if (event.getButton() == fife.MouseEvent.RIGHT): | 98 if (event.getButton() == fife.MouseEvent.RIGHT): |
94 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) | 99 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) |
95 print "selected instances on actor layer: ", [i.getObject().getId() for i in instances] | 100 print "selected instances on actor layer: ", [i.getId() for i in instances] |
96 if instances: | 101 if instances: |
97 #do something | 102 #do something |
98 pass | 103 pass |
99 | 104 |
100 def mouseReleased(self, event): | 105 def mouseReleased(self, event): |