# HG changeset patch
# User prock@33b003aa-7bff-0310-803a-e67f0ece8222
# Date 1275341830 0
# Node ID 764510a6d2f93b7ebe5018340874c07915fe1d1f
# Parent 1afe46247ab11083b72c5b0e91c0f7591db51de7
Added the move command.
Updated the settings-dist.xml file that changes the camera zoom to 1 and adds the script module to the log.
diff -r 1afe46247ab1 -r 764510a6d2f9 demos/rpg/misc/help.txt
--- a/demos/rpg/misc/help.txt Mon May 31 20:25:46 2010 +0000
+++ b/demos/rpg/misc/help.txt Mon May 31 21:37:10 2010 +0000
@@ -1,4 +1,5 @@
eval - Evaluate a python expression
exit, quit - Quit the game
help - Displays this message
+move - Moves an object
spawn - Spawns an item or actor
diff -r 1afe46247ab1 -r 764510a6d2f9 demos/rpg/scripts/gamecontroller.py
--- a/demos/rpg/scripts/gamecontroller.py Mon May 31 20:25:46 2010 +0000
+++ b/demos/rpg/scripts/gamecontroller.py Mon May 31 21:37:10 2010 +0000
@@ -212,7 +212,7 @@
cmd.append(arg)
if cmd[0] == "spawn":
- result = "Usage: spawn [item|actor] [id] [posx] [posy]"
+ result = "Usage: spawn [item|actor] [object id] [posx] [posy]"
if len(cmd) != 5:
return result
else:
@@ -230,9 +230,22 @@
if obj:
try:
self._scene.addObjectToScene(obj)
+ obj.position = (float(cmd[3]), float(cmd[4]))
result = "--OK--"
except ObjectAlreadyInSceneError, e:
result = "Error: [" + cmd[2] + "] is already on the scene."
+
+ elif cmd[0] == "move":
+ result = "Usage: move [object id] [posx] [posy]"
+ if len(cmd) != 4:
+ return result
+ else:
+ obj = self._scene.getObject(cmd[1])
+ if obj:
+ obj.position = (float(cmd[2]), float(cmd[3]))
+ result = "--OK--"
+ else:
+ result = "Error: [" + cmd[1] + "] does not exist on the scene."
return result
diff -r 1afe46247ab1 -r 764510a6d2f9 demos/rpg/scripts/scene.py
--- a/demos/rpg/scripts/scene.py Mon May 31 20:25:46 2010 +0000
+++ b/demos/rpg/scripts/scene.py Mon May 31 21:37:10 2010 +0000
@@ -220,6 +220,12 @@
else:
obj.destroy()
raise ObjectAlreadyInSceneError
+
+ def getObject(self, objid):
+ if self._objectlist.has_key(objid):
+ return self._objectlist[objid]
+ else:
+ return None
def removeObjectFromScene(self, obj):
obj.destroy()
diff -r 1afe46247ab1 -r 764510a6d2f9 demos/rpg/settings-dist.xml
--- a/demos/rpg/settings-dist.xml Mon May 31 20:25:46 2010 +0000
+++ b/demos/rpg/settings-dist.xml Mon May 31 21:37:10 2010 +0000
@@ -14,7 +14,7 @@
fonts/FreeSans.ttf
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"
16
- controller
+ controller ; script
False
1
False
@@ -27,7 +27,7 @@
maps/allobjects.xml
maps/level1.xml
camera1
- 2.0
+ 1.0
http://www.fifengine.de/xml/rpg
actor_layer
item_layer