Mercurial > fife-parpg
comparison demos/shooter/scripts/scene.py @ 451:f463ab431cc0
Movement shouldn't be dependent on framerate anymore.
Some minor tweaks.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 01 Apr 2010 21:14:23 +0000 |
parents | ba6817013343 |
children | f07d779362da |
comparison
equal
deleted
inserted
replaced
450:ba6817013343 | 451:f463ab431cc0 |
---|---|
48 self._model = engine.getModel() | 48 self._model = engine.getModel() |
49 self._layer = objectLayer | 49 self._layer = objectLayer |
50 self._nodes = list() | 50 self._nodes = list() |
51 | 51 |
52 self._player = Player(self._model, 'player', self._layer) | 52 self._player = Player(self._model, 'player', self._layer) |
53 self._player.width = 0.075 | |
54 self._player.height = 0.075 | |
53 self._player.start() | 55 self._player.start() |
54 | 56 |
55 self._projectiles = list() | 57 self._projectiles = list() |
56 self._lasttime = 0 | 58 self._lasttime = 0 |
57 | 59 |
66 #initialize our scene array to some arbitrary size | 68 #initialize our scene array to some arbitrary size |
67 for i in range(0,self._maxnodes): | 69 for i in range(0,self._maxnodes): |
68 self._nodes.append(SceneNode()) | 70 self._nodes.append(SceneNode()) |
69 | 71 |
70 for instance in enemies: | 72 for instance in enemies: |
71 loc = instance.getLocation().getExactLayerCoordinates() | |
72 | |
73 objectName = instance.getObject().getId() | 73 objectName = instance.getObject().getId() |
74 print objectName | 74 print objectName |
75 | 75 |
76 enemy = Ship(self._model, 'enemy', self._layer, False) | 76 enemy = Ship(self._model, 'enemy', self._layer, False) |
77 enemy.instance = instance | 77 enemy.instance = instance |
78 enemy.width = 0.5 | 78 enemy.width = 0.075 |
79 enemy.height = 0.5 | 79 enemy.height = 0.075 |
80 enemy.velocity.x = -0.013 | 80 enemy.velocity.x = -0.13 |
81 enemy.start() | 81 enemy.start() |
82 | 82 |
83 loc = instance.getLocation().getExactLayerCoordinates() | |
83 nodeindex = int(loc.x * xscale) | 84 nodeindex = int(loc.x * xscale) |
84 self._nodes[nodeindex].spaceobjects.append(enemy) | 85 self._nodes[nodeindex].spaceobjects.append(enemy) |
85 | 86 |
86 def getObjectsInNode(self, node): | 87 def getObjectsInNode(self, nodeindex): |
87 return self._nodes[node].instances | 88 return self._nodes[nodeindex].instances |
88 | 89 |
89 def getObjectsInRange(self, rangeL, rangeR): | 90 def getObjectsInRange(self, rangeL, rangeR): |
90 objects = list() | 91 objects = list() |
91 | 92 |
92 for i in range(rangeL, rangeR): | 93 for i in range(rangeL, rangeR): |