Mercurial > fife-parpg
annotate demos/rpg/scripts/scene.py @ 697:ecaa4d98f05f tip
Abstracted the GUI code and refactored the GUIChan-specific code into its own module.
* Most of the GUIChan code has been refactored into its own gui/guichan module. However, references to the GuiFont class still persist in the Engine and GuiManager code and these will need further refactoring.
* GuiManager is now an abstract base class which specific implementations (e.g. GUIChan) should subclass.
* The GUIChan GUI code is now a concrete implementation of GuiManager, most of which is in the new GuiChanGuiManager class.
* The GUI code in the Console class has been refactored out of the Console and into the GUIChan module as its own GuiChanConsoleWidget class. The rest of the Console class related to executing commands was left largely unchanged.
* Existing client code may need to downcast the GuiManager pointer received from FIFE::Engine::getGuiManager() to GuiChanGuiManager, since not all functionality is represented in the GuiManager abstract base class. Python client code can use the new GuiChanGuiManager.castTo static method for this purpose.
author | M. George Hansen <technopolitica@gmail.com> |
---|---|
date | Sat, 18 Jun 2011 00:28:40 -1000 |
parents | e3140f01749d |
children |
rev | line source |
---|---|
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 #!/usr/bin/env python |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # -*- coding: utf-8 -*- |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # #################################################################### |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # Copyright (C) 2005-2010 by the FIFE team |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # http://www.fifengine.net |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # This file is part of FIFE. |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # FIFE is free software; you can redistribute it and/or |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # modify it under the terms of the GNU Lesser General Public |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # License as published by the Free Software Foundation; either |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # version 2.1 of the License, or (at your option) any later version. |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # This library is distributed in the hope that it will be useful, |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # Lesser General Public License for more details. |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # You should have received a copy of the GNU Lesser General Public |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # License along with this library; if not, write to the |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # Free Software Foundation, Inc., |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 # #################################################################### |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
26 import sys, os, re, math, random, shutil, uuid |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 from fife import fife |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 from fife.extensions.loaders import loadMapFile |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
30 from fife.extensions.serializers.xml_loader_tools import loadImportFile |
567
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
31 from fife.extensions.serializers.simplexml import SimpleXMLSerializer |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
32 from fife.extensions.serializers.xmlobject import XMLObjectLoader |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 |
518
e4cd18a179af
Added the PlayerActionListener.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
34 from scripts.actors.baseactor import Actor |
534
65a92a2449d5
Doing some re-factoring.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
531
diff
changeset
|
35 from scripts.actors.questgiver import QuestGiver |
542
67f6f3538e88
Refactored the Quest class a bit. Made it a base class for other possible quest types. Added the RETURN_ITEM quest type.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
540
diff
changeset
|
36 from scripts.quests.basequest import Quest, ReturnItemQuest, QuestTypes |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
37 from scripts.actors.player import Player |
563
f85762e634c5
- Added the AttackAction along with a test enemy on level 1.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
560
diff
changeset
|
38 from scripts.objects.baseobject import GameObjectTypes |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
39 from scripts.objects.items import BaseItem, GoldStack, Portal |
536
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
40 from scripts.misc.exceptions import ObjectNotFoundError, ObjectAlreadyInSceneError |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
41 from scripts.misc.serializer import Serializer |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
42 |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
43 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
44 class Scene(Serializer): |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 def __init__(self, gamecontroller): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 self._gamecontroller = gamecontroller |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 self._map = None |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
49 self._mapname = None |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
50 self._maincameraname = self._gamecontroller.settings.get("RPG", "DefaultCameraName", "camera1") |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 self._cameras = {} |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
53 self._actorlayer = None |
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
54 |
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
55 self._player = None |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
56 self._objectlist = {} |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
57 |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
58 self._objectsettings = None |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
59 self._modelsettings = None |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
60 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
61 self.obj_loader = XMLObjectLoader( |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
62 gamecontroller.engine.getImagePool(), |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
63 gamecontroller.engine.getAnimationPool(), |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
64 gamecontroller.engine.getModel(), |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
65 gamecontroller.engine.getVFS() |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
66 ) |
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
67 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
68 def loadObject(self, objectname, objectid=None, valuedict=None): |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
69 if objectid: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
70 identifier = objectid |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
71 else: |
547
e59ece21ab3e
Item serialization will now assume some default values if they are not found in the save files.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
546
diff
changeset
|
72 identifier = str(uuid.uuid1()) |
e59ece21ab3e
Item serialization will now assume some default values if they are not found in the save files.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
546
diff
changeset
|
73 |
531
801746c5bb9a
Added the spawn console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
530
diff
changeset
|
74 try: |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
75 objdict = self._modelsettings.get("objects", objectname, {}) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
76 modeldict = self._modelsettings.get("models", objdict["modelname"], {}) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
77 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
78 loadImportFile(self.obj_loader, modeldict["file"], self._gamecontroller.engine) |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
79 |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
80 if objdict["type"] == "GOLD": |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
81 newobject = GoldStack(self._gamecontroller, self.itemlayer, objdict["type"], objectname, modeldict["model"], identifier) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
82 elif objdict["type"] == "PORTAL": |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
83 newobject = Portal(self._gamecontroller, self.itemlayer, objdict["type"], objectname, modeldict["model"], identifier) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
84 elif objdict["type"] == "QUESTGIVER": |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
85 newobject = QuestGiver(self._gamecontroller, self.actorlayer, objdict["type"], objectname, modeldict["model"], identifier, True) |
563
f85762e634c5
- Added the AttackAction along with a test enemy on level 1.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
560
diff
changeset
|
86 elif objdict["type"] == "ENEMY": |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
87 newobject = Actor(self._gamecontroller, self.actorlayer, objdict["type"], objectname, modeldict["model"], identifier, True) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
88 else: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
89 return None |
551
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
90 |
3b933753cba8
QuestManager now loads all quests.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
550
diff
changeset
|
91 #if the valuedict is supplied it overrides the loaded default values |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
92 if valuedict: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
93 newobject.deserialize(valuedict) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
94 else: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
95 newobject.deserialize(objdict) |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
96 |
535
9fbe3dce925a
Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
534
diff
changeset
|
97 except KeyError, e: |
536
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
98 raise ObjectNotFoundError |
531
801746c5bb9a
Added the spawn console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
530
diff
changeset
|
99 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
100 return newobject |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
101 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
102 def loadObjects(self, mapfilename): |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
103 for obj in self._objectsettings.get("objects", "objectlist", []): |
535
9fbe3dce925a
Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
534
diff
changeset
|
104 try: |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
105 objdict = self._objectsettings.get("objects", obj, {}) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
106 newobj = self.loadObject(objdict["objectname"], obj, objdict) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
107 self._gamecontroller.logger.log_debug("Loaded object: " + obj) |
535
9fbe3dce925a
Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
534
diff
changeset
|
108 except ObjectNotFoundError, e: |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
109 self._gamecontroller.logger.log_error("Error while loading object: " + obj) |
535
9fbe3dce925a
Added custom exceptions.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
534
diff
changeset
|
110 continue |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
111 |
536
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
112 try: |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
113 if newobj: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
114 self.addObjectToScene(newobj) |
536
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
115 except ObjectAlreadyInSceneError, e: |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
116 self._gamecontroller.logger.log_error("Object already part of scene:" + obj) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
117 continue |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
118 |
542
67f6f3538e88
Refactored the Quest class a bit. Made it a base class for other possible quest types. Added the RETURN_ITEM quest type.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
540
diff
changeset
|
119 def createPlayerObject(self): |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
120 """ |
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
121 @todo: once we have all art assets this should be able to load one of 3 player models |
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
122 """ |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
123 modeldict = self._modelsettings.get("models", "Player", {}) |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
124 |
661
e3140f01749d
* Merged the light branch back into trunk.
helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
567
diff
changeset
|
125 loadImportFile(self.obj_loader, modeldict["file"], self._gamecontroller.engine) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
126 self._player = Player(self._gamecontroller, self.actorlayer, "warrior") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
127 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
128 playerfilename = os.path.join("saves", "player_save.xml") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
129 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
130 if os.path.isfile(playerfilename): |
567
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
131 player_settings = SimpleXMLSerializer(playerfilename) |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
132 pvals = player_settings.get("player", "player", {}) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
133 self._player.deserialize(pvals) |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
134 |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
135 def createScene(self, mapname): |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
136 mapfilename = os.path.join("maps", mapname + ".xml") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
137 |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
138 if self._map: |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
139 self.destroyScene() |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
140 |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
141 self._map = loadMapFile(mapfilename, self._gamecontroller.engine) |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
142 |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
143 self._mapname = mapname |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
144 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
145 if os.path.isfile(os.path.join("saves", mapname + "_save.xml")): |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
146 objectfile = os.path.join("saves", mapname + "_save.xml") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
147 else: |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
148 objectfile = os.path.join("maps", mapname + "_objects.xml") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
149 |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
150 modelfile = self._gamecontroller.settings.get("RPG", "AllObjectFile", "maps/allobjects.xml") |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
151 questfile = self._gamecontroller.settings.get("RPG", "QuestFile", "maps/quests.xml") |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
152 |
567
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
153 self._objectsettings = SimpleXMLSerializer(objectfile) |
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
154 self._modelsettings = SimpleXMLSerializer(modelfile) |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 for cam in self._map.getCameras(): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
157 self._cameras[cam.getId()] = cam |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
158 |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
159 self._cameras[self._maincameraname].setZoom(self._gamecontroller.settings.get("RPG", "DefaultZoom", 1.0)) |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
160 |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
161 self._actorlayer = self._map.getLayer(self._gamecontroller.settings.get("RPG", "ActorLayer", "actor_layer")) |
524
6037f79b0dcf
Multiple quests now work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
523
diff
changeset
|
162 self._itemlayer = self._map.getLayer(self._gamecontroller.settings.get("RPG", "ItemLayer", "item_layer")) |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
163 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
164 self.loadObjects(mapfilename) |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
165 |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
166 #finally load the player |
542
67f6f3538e88
Refactored the Quest class a bit. Made it a base class for other possible quest types. Added the RETURN_ITEM quest type.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
540
diff
changeset
|
167 self.createPlayerObject() |
518
e4cd18a179af
Added the PlayerActionListener.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
168 |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
169 def destroyScene(self): |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
170 for obj in self._objectlist.values(): |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
171 obj.destroy() |
518
e4cd18a179af
Added the PlayerActionListener.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
172 |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
173 self._objectlist.clear() |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
174 self._objectlist = {} |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
175 self._cameras.clear() |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
176 self._cameras = {} |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
177 |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
178 self._player.destroy() |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
179 self._player = None |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
180 |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
181 for cam in self._map.getCameras(): |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
182 cam.resetRenderers() |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
183 |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
184 if self._map: |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
185 self._gamecontroller.engine.getModel().deleteMap(self._map) |
540
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
186 |
2e739ae9a8bc
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
537
diff
changeset
|
187 retval = self._gamecontroller.engine.getModel().deleteObjects() |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
188 |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
189 self._map = None |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
190 self._mapname = None |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
191 |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
192 self._actorlayer = None |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
193 self._itemlayer = None |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
194 |
530
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
195 self._objectsettings = None |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
196 self._modelsettings = None |
ea26e7b6f56c
Added the loadActor and loadItem functions so you can load single items at any time.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
529
diff
changeset
|
197 |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
198 def getInstancesAt(self, clickpoint, layer): |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
199 """ |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
200 Query the main camera for instances on the specified layer. |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
201 """ |
528
796d49ab9380
Cleaned up the createScene function.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
525
diff
changeset
|
202 return self.cameras[self._maincameraname].getMatchingInstances(clickpoint, layer) |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
203 |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
204 def getLocationAt(self, clickpoint): |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
205 """ |
519
14f777be6b94
Added a rudimentary Action class.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
518
diff
changeset
|
206 Query the main camera for the Map location (on the actor layer) |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
207 that a screen point refers to. |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
208 """ |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
209 target_mapcoord = self._cameras[self._maincameraname].toMapCoordinates(clickpoint, False) |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
210 target_mapcoord.z = 0 |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
211 location = fife.Location(self._actorlayer) |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
212 location.setMapCoordinates(target_mapcoord) |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
213 return location |
529
d0bce896a526
Changed the quest format in the object xml file.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
528
diff
changeset
|
214 |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
215 def getObject(self, objid): |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
216 """ |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
217 Throws ObjectNotFoundError when an object cannot be found on the scene |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
218 """ |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
219 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
220 try: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
221 return self._objectlist[objid] |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
222 except KeyError: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
223 raise ObjectNotFoundError(objid + " was not found on the scene.") |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
224 |
529
d0bce896a526
Changed the quest format in the object xml file.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
528
diff
changeset
|
225 def addObjectToScene(self, obj): |
531
801746c5bb9a
Added the spawn console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
530
diff
changeset
|
226 if not self._objectlist.has_key(obj.id): |
801746c5bb9a
Added the spawn console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
530
diff
changeset
|
227 self._objectlist[obj.id] = obj |
536
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
228 else: |
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
229 obj.destroy() |
1afe46247ab1
Some misc code cleanup.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
535
diff
changeset
|
230 raise ObjectAlreadyInSceneError |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
231 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
232 def removeObjectFromScene(self, obj): |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
233 """ |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
234 Throws ObjectNotFoundError when an object cannot be found on the scene |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
235 """ |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
236 |
529
d0bce896a526
Changed the quest format in the object xml file.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
528
diff
changeset
|
237 obj.destroy() |
560
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
238 |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
239 try: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
240 del self._objectlist[obj.id] |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
241 except KeyError: |
69d50e751c9a
Lots of changes.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
551
diff
changeset
|
242 raise ObjectNotFoundError(obj.id + " could not be removed from the scene as it was not found in the scene.") |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
243 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
244 def serialize(self): |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
245 filename = os.path.join("saves", self._mapname + "_save.xml") |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
246 playerfilename = os.path.join("saves", "player_save.xml") |
567
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
247 map_settings = SimpleXMLSerializer(filename) |
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
248 player_settings = SimpleXMLSerializer(playerfilename) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
249 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
250 objectlist = [] |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
251 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
252 for obj in self._objectlist.values(): |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
253 ovals = obj.serialize() |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
254 map_settings.set("objects", obj.id, ovals) |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
255 objectlist.append(obj.id) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
256 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
257 map_settings.set("objects", "objectlist", objectlist) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
258 |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
259 pvals = self._player.serialize() |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
260 player_settings.set("player", "player", pvals) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
261 |
567
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
262 map_settings.save() |
9152ed2b5bb8
Created SimpleXMLSerializer which makes loading and saving variables to an XML file simple. In the process I removed the the XML code from the Settings class. It now uses SimpleXMLSerializer to load and save settings.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
563
diff
changeset
|
263 player_settings.save() |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
264 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
265 def deserialize(self): |
546
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
266 if self._mapname: |
8fee2d2286e9
Rewrote the object serializing routines to use a "template" idea for loading an object from disk. This allows for multiple objects to load the same base object template but be unique on the scene AND have different values. Useful for say more than one gold stack on the ground with different gold values. TODO: fix the "spawn" console command.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
543
diff
changeset
|
267 createScene(self._mapname) |
529
d0bce896a526
Changed the quest format in the object xml file.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
528
diff
changeset
|
268 |
512
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
269 def updateScene(self): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
270 pass |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
271 |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
272 def _getActorLayer(self): |
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
273 return self._actorlayer |
524
6037f79b0dcf
Multiple quests now work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
523
diff
changeset
|
274 |
6037f79b0dcf
Multiple quests now work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
523
diff
changeset
|
275 def _getItemLayer(self): |
6037f79b0dcf
Multiple quests now work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
523
diff
changeset
|
276 return self._itemlayer |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
277 |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
278 def _getCameras(self): |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
279 return self._cameras |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
280 |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
281 def _getPlayer(self): |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
282 return self._player |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
283 |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
284 def _getObjectList(self): |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
285 return self._objectlist |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
286 |
523
d01eb65b2726
Enabling the FloatingTextRenderer for the RPG demo. The NPC now complains at you if he doesn't have a quest to give you.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
521
diff
changeset
|
287 def _getMap(self): |
d01eb65b2726
Enabling the FloatingTextRenderer for the RPG demo. The NPC now complains at you if he doesn't have a quest to give you.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
521
diff
changeset
|
288 return self._map |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
289 |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
290 def _getMapName(self): |
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
291 return self._mapname |
523
d01eb65b2726
Enabling the FloatingTextRenderer for the RPG demo. The NPC now complains at you if he doesn't have a quest to give you.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
521
diff
changeset
|
292 |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
293 actorlayer = property(_getActorLayer) |
524
6037f79b0dcf
Multiple quests now work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
523
diff
changeset
|
294 itemlayer = property(_getItemLayer) |
516
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
295 cameras = property(_getCameras) |
d70fc46c8aa5
Added some placeholder graphics for the warrior. The player can now walk around the map.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
513
diff
changeset
|
296 player = property(_getPlayer) |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
297 objectlist = property(_getObjectList) |
523
d01eb65b2726
Enabling the FloatingTextRenderer for the RPG demo. The NPC now complains at you if he doesn't have a quest to give you.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
521
diff
changeset
|
298 map = property(_getMap) |
543
cb7ec12214a9
Items can now be serialized/deserialized to/from disk. I haven't finished actors yet. This allows for persistent states when you enter/leave maps.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
542
diff
changeset
|
299 mapname = property(_getMapName) |
513
edf5c0cf52f3
Added the Actor and Player classes. Actor is the base class that the player and all enemies + NPCs will inherit.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
512
diff
changeset
|
300 |