Mercurial > fife-parpg
annotate demos/rpg/scripts/gamecontroller.py @ 520:b6bd314df28a
Added a quest dialog.
Added QuestGiver class.
Moved level specific settings to another file.
Added BaseItem class.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 27 May 2010 16:29:07 +0000 |
parents | 14f777be6b94 |
children | 494c60cf61cf |
rev | line source |
---|---|
509
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 #!/usr/bin/env python |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
2 |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
3 # -*- coding: utf-8 -*- |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
4 |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
5 # #################################################################### |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
6 # Copyright (C) 2005-2010 by the FIFE team |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
7 # http://www.fifengine.net |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
8 # This file is part of FIFE. |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
9 # |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
10 # FIFE is free software; you can redistribute it and/or |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
11 # modify it under the terms of the GNU Lesser General Public |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
12 # License as published by the Free Software Foundation; either |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
13 # version 2.1 of the License, or (at your option) any later version. |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
14 # |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
15 # This library is distributed in the hope that it will be useful, |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
18 # Lesser General Public License for more details. |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
19 # |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
20 # You should have received a copy of the GNU Lesser General Public |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
21 # License along with this library; if not, write to the |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
22 # Free Software Foundation, Inc., |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
24 # #################################################################### |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 # This is the rio de hola client for FIFE. |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 import sys, os, re, math, random, shutil |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 from fife import fife |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
31 from fife.extensions.soundmanager import SoundManager |
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
32 from fife.extensions.loaders import loadImportFile |
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
33 |
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:
510
diff
changeset
|
34 from scripts.scene import Scene |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
35 from scripts.guicontroller import GUIController |
519
14f777be6b94
Added a rudimentary Action class.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
517
diff
changeset
|
36 from scripts.actors.baseactor import TalkAction |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
37 from scripts.objects.baseobject import GameObjectTypes |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
38 |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
39 |
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
|
40 class KeyState(object): |
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
|
41 def __init__(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
|
42 self._keystate = { } |
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
|
43 |
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
|
44 def updateKey(self, key, state): |
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
|
45 self._keystate[key] = state |
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
|
46 |
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
|
47 def checkKey(self, key): |
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
|
48 if key in self._keystate: |
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
|
49 return self._keystate[key] |
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
|
50 else: |
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
|
51 return False |
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
|
52 |
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 def reset(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
|
54 self._keystate.clear() |
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 |
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:
510
diff
changeset
|
56 class GameListener(fife.IKeyListener, fife.IMouseListener): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
57 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:
510
diff
changeset
|
58 self._engine = gamecontroller.engine |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
59 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:
510
diff
changeset
|
60 self._settings = gamecontroller.settings |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
61 self._eventmanager = self._engine.getEventManager() |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
62 self._soundmanager = SoundManager(self._engine) |
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:
510
diff
changeset
|
63 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
64 fife.IMouseListener.__init__(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:
510
diff
changeset
|
65 fife.IKeyListener.__init__(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:
510
diff
changeset
|
66 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
67 self._attached = False |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
68 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
69 def attach(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:
510
diff
changeset
|
70 if not self._attached: |
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
|
71 self._gamecontroller.keystate.reset() |
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:
510
diff
changeset
|
72 self._eventmanager.addMouseListenerFront(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:
510
diff
changeset
|
73 self._eventmanager.addKeyListenerFront(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:
510
diff
changeset
|
74 self._attached = True |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
75 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
76 def detach(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:
510
diff
changeset
|
77 if self._attached: |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
78 self._eventmanager.removeMouseListener(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:
510
diff
changeset
|
79 self._eventmanager.removeKeyListener(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:
510
diff
changeset
|
80 self._attached = False |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
81 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
82 def mousePressed(self, event): |
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
|
83 #mouse press was consumed by some pychan widget |
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
|
84 if event.isConsumedByWidgets(): |
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
|
85 return |
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
|
86 |
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
|
87 clickpoint = fife.ScreenPoint(event.getX(), event.getY()) |
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
|
88 if (event.getButton() == fife.MouseEvent.LEFT): |
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
|
89 self._gamecontroller.scene.player.walk( self._gamecontroller.scene.getLocationAt(clickpoint) ) |
519
14f777be6b94
Added a rudimentary Action class.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
517
diff
changeset
|
90 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) |
14f777be6b94
Added a rudimentary Action class.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
517
diff
changeset
|
91 if instances: |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
92 obj = self._gamecontroller.scene.objectlist[instances[0].getId()] |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
93 print obj.type |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
94 if obj.type == GameObjectTypes["QUESTGIVER"]: |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
95 action = TalkAction(self._gamecontroller.scene.player, obj) |
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
96 self._gamecontroller.scene.player.nextaction = action |
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
|
97 |
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
|
98 if (event.getButton() == fife.MouseEvent.RIGHT): |
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
|
99 instances = self._gamecontroller.scene.getInstancesAt(clickpoint) |
520
b6bd314df28a
Added a quest dialog.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
519
diff
changeset
|
100 print "selected instances on actor layer: ", [i.getId() for i in instances] |
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
|
101 if instances: |
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
|
102 #do something |
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
|
103 pass |
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
|
104 |
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:
510
diff
changeset
|
105 def mouseReleased(self, event): |
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
|
106 pass |
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
|
107 |
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
|
108 def mouseMoved(self, event): |
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
|
109 renderer = self._gamecontroller.instancerenderer |
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
|
110 if renderer: |
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
|
111 renderer.removeAllOutlines() |
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
|
112 else: |
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
|
113 return |
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
|
114 |
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
|
115 pt = fife.ScreenPoint(event.getX(), event.getY()) |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
116 instances = self._gamecontroller.scene.getInstancesAt(pt); |
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
117 |
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
|
118 for i in instances: |
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
|
119 renderer.addOutlined(i, 173, 255, 47, 2) |
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
|
120 |
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:
510
diff
changeset
|
121 def mouseEntered(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
122 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
123 |
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:
510
diff
changeset
|
124 def mouseExited(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
125 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
126 |
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:
510
diff
changeset
|
127 def mouseClicked(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
128 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
129 |
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:
510
diff
changeset
|
130 def mouseWheelMovedUp(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
131 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
132 |
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:
510
diff
changeset
|
133 def mouseWheelMovedDown(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
134 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
135 |
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:
510
diff
changeset
|
136 def mouseDragged(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
137 pass |
517
c3a026cdd91b
Added the BaseGameObject class and put it in it's own file. All game object will inherit it. Added instance action listeners.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
516
diff
changeset
|
138 |
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:
510
diff
changeset
|
139 def keyPressed(self, event): |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
140 keyval = event.getKey().getValue() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
141 keystr = event.getKey().getAsString().lower() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
142 if keyval == fife.Key.ESCAPE: |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
143 self.detach() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
144 self._gamecontroller.guicontroller.showMainMenu() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
145 event.consume() |
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
|
146 |
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
|
147 self._gamecontroller.keystate.updateKey(keyval, True) |
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:
510
diff
changeset
|
148 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
149 def keyReleased(self, event): |
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
|
150 keyval = event.getKey().getValue() |
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
|
151 keystr = event.getKey().getAsString().lower() |
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
|
152 |
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
|
153 self._gamecontroller.keystate.updateKey(keyval, False) |
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
|
154 |
509
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
155 class GameController(object): |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
156 def __init__(self, application, engine, settings): |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
157 self._application = application |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
158 self._engine = engine |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
159 self._settings = settings |
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
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._keystate = KeyState() |
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
|
162 |
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:
510
diff
changeset
|
163 self._guicontroller = GUIController(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:
510
diff
changeset
|
164 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
165 self._listener = GameListener(self) |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
166 |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
167 self._guicontroller.showMainMenu() |
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:
510
diff
changeset
|
168 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
169 self._scene = 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
|
170 self._instancerenderer = None |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
171 |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
172 def onConsoleCommand(self, command): |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
173 """ |
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:
510
diff
changeset
|
174 Might be useful if you want to have the game parse a command. |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
175 Not sure if I am going to keep this or not. |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
176 """ |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
177 result = "" |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
178 return result |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
179 |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
180 def newGame(self): |
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:
510
diff
changeset
|
181 self._guicontroller.hideMainMenu() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
182 |
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
|
183 self._keystate.reset() |
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
|
184 |
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:
510
diff
changeset
|
185 if self._scene: |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
186 self._scene.destroyScene() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
187 self._scene = 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
|
188 |
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
|
189 loadImportFile("objects/actors/player/warrior/object.xml", self._engine) |
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:
510
diff
changeset
|
190 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
191 self._scene = Scene(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:
510
diff
changeset
|
192 self._scene.createScene(self._settings.get("RPG", "TownMapFile", "maps/town.xml")) |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
193 |
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 self._instancerenderer = fife.InstanceRenderer.getInstance(self._scene.cameras[self._settings.get("RPG", "DefaultCameraName", "camera1")]) |
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
|
195 |
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:
510
diff
changeset
|
196 #start listening to events |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
197 self._listener.attach() |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
198 |
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
|
199 def endGame(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
|
200 if self._scene: |
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
|
201 self._scene.destroyScene() |
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
|
202 self._scene = None |
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 self._instancerenderer = None |
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
|
204 |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
205 def quit(self): |
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
|
206 self.endGame() |
510
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
207 self._application.requestQuit() |
cd959b05a262
There is now a main menu. You can also view the credits. Taking a screenshot and opening the console should also work.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
509
diff
changeset
|
208 |
509
3951042a701e
Adding the RPG demo. This is basically empty at the moment. Currently it will start with a black screen.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
209 def pump(self): |
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:
510
diff
changeset
|
210 if self._scene: |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
211 self._scene.updateScene() |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
212 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
213 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
214 def _getGUIController(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:
510
diff
changeset
|
215 return self._guicontroller |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
216 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
217 def _getEngine(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:
510
diff
changeset
|
218 return self._engine |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
219 |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
220 def _getSettings(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:
510
diff
changeset
|
221 return self._settings |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
222 |
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
|
223 def _getScene(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
|
224 return self._scene |
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
|
225 |
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
|
226 def _getKeyState(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
|
227 return self._keystate |
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
|
228 |
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
|
229 def _getInstanceRenderer(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
|
230 return self._instancerenderer |
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
|
231 |
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:
510
diff
changeset
|
232 guicontroller = property(_getGUIController) |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
233 engine = property(_getEngine) |
6ddb1eb9dfa6
Added the Scene which loads the town map. It is no longer a black screen demo.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
510
diff
changeset
|
234 settings = property(_getSettings) |
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
|
235 scene = property(_getScene) |
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
|
236 keystate = property(_getKeyState) |
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
|
237 instancerenderer = property(_getInstanceRenderer) |