diff 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
line wrap: on
line diff
--- a/demos/rpg/scripts/gamecontroller.py	Thu May 27 04:36:09 2010 +0000
+++ b/demos/rpg/scripts/gamecontroller.py	Thu May 27 16:29:07 2010 +0000
@@ -34,6 +34,7 @@
 from scripts.scene import Scene
 from scripts.guicontroller import GUIController
 from scripts.actors.baseactor import TalkAction
+from scripts.objects.baseobject import GameObjectTypes
 
 
 class KeyState(object):
@@ -88,11 +89,15 @@
 			self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) )
 			instances = self._gamecontroller.scene.getInstancesAt(clickpoint)
 			if instances:
-				self._gamecontroller.scene.player.nextaction = TalkAction(self, self)
+				obj = self._gamecontroller.scene.objectlist[instances[0].getId()]
+				print obj.type
+				if obj.type == GameObjectTypes["QUESTGIVER"]:
+					action = TalkAction(self._gamecontroller.scene.player, obj)
+					self._gamecontroller.scene.player.nextaction = action
 
 		if (event.getButton() == fife.MouseEvent.RIGHT):
 			instances = self._gamecontroller.scene.getInstancesAt(clickpoint)
-			print "selected instances on actor layer: ", [i.getObject().getId() for i in instances]
+			print "selected instances on actor layer: ", [i.getId() for i in instances]
 			if instances:
 				#do something
 				pass