Mercurial > fife-parpg
comparison demos/rpg/scripts/gamecontroller.py @ 534:65a92a2449d5
Doing some re-factoring.
Minor change to the way the console commands are parsed.
Added the spawn command to the help file.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 31 May 2010 17:45:04 +0000 |
parents | 801746c5bb9a |
children | 9fbe3dce925a |
comparison
equal
deleted
inserted
replaced
533:082e919cc348 | 534:65a92a2449d5 |
---|---|
205 for arg in args: | 205 for arg in args: |
206 arg = arg.strip() | 206 arg = arg.strip() |
207 if arg != "": | 207 if arg != "": |
208 cmd.append(arg) | 208 cmd.append(arg) |
209 | 209 |
210 | |
211 if cmd[0] == "spawn": | 210 if cmd[0] == "spawn": |
212 result = "Usage: spawn [item|actor] [id] [posx] [posy]" | 211 result = "Usage: spawn [item|actor] [id] [posx] [posy]" |
213 if len(cmd) != 5: | 212 if len(cmd) != 5: |
214 print len(cmd) | 213 print len(cmd) |
215 return result | 214 return result |
220 obj = self._scene.loadActor(cmd[2]) | 219 obj = self._scene.loadActor(cmd[2]) |
221 else: | 220 else: |
222 return result | 221 return result |
223 if obj: | 222 if obj: |
224 self._scene.addObjectToScene(obj) | 223 self._scene.addObjectToScene(obj) |
225 result = "Success!" | 224 result = "--OK--" |
226 else: | 225 else: |
227 result = "Error: Not Found!" | 226 result = "Error: Not Found!" |
228 | 227 |
229 return result | 228 return result |
230 | 229 |