diff demos/rpg/scripts/gamecontroller.py @ 563:f85762e634c5

- Added the AttackAction along with a test enemy on level 1. - Removed the getModuleByType() helper function.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 24 Jun 2010 21:27:11 +0000
parents 69d50e751c9a
children 678fd71c0753
line wrap: on
line diff
--- a/demos/rpg/scripts/gamecontroller.py	Thu Jun 24 19:58:59 2010 +0000
+++ b/demos/rpg/scripts/gamecontroller.py	Thu Jun 24 21:27:11 2010 +0000
@@ -32,7 +32,7 @@
 
 from scripts.scene import Scene
 from scripts.guicontroller import GUIController
-from scripts.actors.baseactor import TalkAction, PickUpItemAction, EnterPortalAction
+from scripts.actors.baseactor import TalkAction, AttackAction, PickUpItemAction, EnterPortalAction
 from scripts.objects.baseobject import GameObjectTypes
 from scripts.misc.exceptions import ObjectNotFoundError, ObjectAlreadyInSceneError
 from scripts.quests.questmanager import QuestManager
@@ -133,6 +133,12 @@
 					if obj.type == GameObjectTypes["QUESTGIVER"]:
 						action = TalkAction(self._gamecontroller.scene.player, obj)
 						self._gamecontroller.scene.player.nextaction = action
+					elif obj.type == GameObjectTypes["ENEMY"]:
+						action = AttackAction(self._gamecontroller.scene.player, obj)
+						self._gamecontroller.scene.player.nextaction = action
+					else:
+						action = TalkAction(self._gamecontroller.scene.player, obj)
+						self._gamecontroller.scene.player.nextaction = action
 			
 			if item_instances:
 				obj = self._gamecontroller.scene.objectlist[item_instances[0].getId()]