Mercurial > fife-parpg
comparison demos/rpg/scripts/gamecontroller.py @ 537:764510a6d2f9
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.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 31 May 2010 21:37:10 +0000 |
parents | 1afe46247ab1 |
children | 2e739ae9a8bc |
comparison
equal
deleted
inserted
replaced
536:1afe46247ab1 | 537:764510a6d2f9 |
---|---|
210 arg = arg.strip() | 210 arg = arg.strip() |
211 if arg != "": | 211 if arg != "": |
212 cmd.append(arg) | 212 cmd.append(arg) |
213 | 213 |
214 if cmd[0] == "spawn": | 214 if cmd[0] == "spawn": |
215 result = "Usage: spawn [item|actor] [id] [posx] [posy]" | 215 result = "Usage: spawn [item|actor] [object id] [posx] [posy]" |
216 if len(cmd) != 5: | 216 if len(cmd) != 5: |
217 return result | 217 return result |
218 else: | 218 else: |
219 try: | 219 try: |
220 if cmd[1] == "item": | 220 if cmd[1] == "item": |
228 obj = None | 228 obj = None |
229 | 229 |
230 if obj: | 230 if obj: |
231 try: | 231 try: |
232 self._scene.addObjectToScene(obj) | 232 self._scene.addObjectToScene(obj) |
233 obj.position = (float(cmd[3]), float(cmd[4])) | |
233 result = "--OK--" | 234 result = "--OK--" |
234 except ObjectAlreadyInSceneError, e: | 235 except ObjectAlreadyInSceneError, e: |
235 result = "Error: [" + cmd[2] + "] is already on the scene." | 236 result = "Error: [" + cmd[2] + "] is already on the scene." |
237 | |
238 elif cmd[0] == "move": | |
239 result = "Usage: move [object id] [posx] [posy]" | |
240 if len(cmd) != 4: | |
241 return result | |
242 else: | |
243 obj = self._scene.getObject(cmd[1]) | |
244 if obj: | |
245 obj.position = (float(cmd[2]), float(cmd[3])) | |
246 result = "--OK--" | |
247 else: | |
248 result = "Error: [" + cmd[1] + "] does not exist on the scene." | |
236 | 249 |
237 return result | 250 return result |
238 | 251 |
239 def newGame(self): | 252 def newGame(self): |
240 self._guicontroller.hideMainMenu() | 253 self._guicontroller.hideMainMenu() |