Mercurial > fife-parpg
annotate tests/swig_tests/action_tests.py @ 461:f87f686b5b59
Projectiles from enemy ships no longer destroy other enemies.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 12 Apr 2010 12:21:27 +0000 |
parents | 81641655bc38 |
children |
rev | line source |
---|---|
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
1 #!/usr/bin/env python |
396
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
2 # -*- coding: utf-8 -*- |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
3 |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
4 # #################################################################### |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
5 # Copyright (C) 2005-2009 by the FIFE team |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
6 # http://www.fifengine.de |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
7 # This file is part of FIFE. |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
8 # |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
9 # FIFE is free software; you can redistribute it and/or |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
10 # modify it under the terms of the GNU Lesser General Public |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
11 # License as published by the Free Software Foundation; either |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
12 # version 2.1 of the License, or (at your option) any later version. |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
13 # |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
14 # This library is distributed in the hope that it will be useful, |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
17 # Lesser General Public License for more details. |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
18 # |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
19 # You should have received a copy of the GNU Lesser General Public |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
20 # License along with this library; if not, write to the |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
21 # Free Software Foundation, Inc., |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
23 # #################################################################### |
81641655bc38
Adding the correct header in a lot of files. Also made a small change to the CHANGES file by adding the 0.3.1 section.
prock@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
311
diff
changeset
|
24 |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
25 from swig_test_utils import * |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
26 import pythonize |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
27 from serializers.xmlanimation import XMLAnimationLoader |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
28 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
29 class ActionTests(unittest.TestCase): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
30 def setUp(self): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
31 template = 'tests/data/wolf_walk/wolf_walk_%s.xml' |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
32 dirnames = ['e', 'ne', 'n', 'nw', 'w', 'sw', 's', 'se'] |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
33 files = map(lambda dirname: template % dirname, dirnames) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
34 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
35 self.engine = getEngine() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
36 pool = self.engine.getAnimationPool() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
37 self.animationloader = XMLAnimationLoader(self.engine.getImagePool(), self.engine.getVFS()) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
38 pool.addResourceLoader(self.animationloader) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
39 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
40 _map = self.engine.getModel().createMap("map001") |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
41 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
42 self.grid = fife.SquareGrid(True) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
43 self.layer = _map.createLayer("Layer001", self.grid) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
44 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
45 self.target = fife.Location(self.layer) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
46 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
47 self.obj = fife.Object("object001", 'plaa') |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
48 fife.ObjectVisual.create(self.obj) |
311
a0e00b4b0fac
fixed the test due to removing linearpather
wenlin_fife@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
300
diff
changeset
|
49 # self.pather = fife.LinearPather() |
a0e00b4b0fac
fixed the test due to removing linearpather
wenlin_fife@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
300
diff
changeset
|
50 self.pather = fife.RoutePather() |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
51 self.obj.setPather(self.pather) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
52 self.action = self.obj.createAction('walk') |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
53 fife.ActionVisual.create(self.action) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
54 addResource = self.engine.animationPool.addResourceFromFile |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
55 for index, direction in enumerate(dirnames): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
56 degree = 45 * index |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
57 self.action.get2dGfxVisual().addAnimation(degree, addResource(files[index])) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
58 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
59 self.ground = fife.Object("ground", 'plaa') |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
60 imgid = self.engine.imagePool.addResourceFromFile('tests/data/earth_1.png') |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
61 fife.ObjectVisual.create(self.ground) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
62 self.ground.get2dGfxVisual().addStaticImage(0, imgid) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
63 self.ground.img = self.engine.getImagePool().getImage(imgid) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
64 for y in xrange(-2,3): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
65 for x in xrange(-2,3): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
66 inst = self.layer.createInstance(self.ground, fife.ModelCoordinate(x,y)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
67 fife.InstanceVisual.create(inst) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
68 self.inst = self.layer.createInstance(self.obj, fife.ModelCoordinate(-2,-2)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
69 fife.InstanceVisual.create(self.inst) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
70 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
71 def tearDown(self): |
144
d2f1e81fbe2c
* Fixed a scons issue, where libraries checked for C instead of C++
phoku@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
0
diff
changeset
|
72 self.engine.destroy() |
0
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
73 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
74 def _testWalkingAction(self): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
75 print 'test1' |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
76 getAnimation = self.engine.animationPool.getAnimation |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
77 print 'test2' |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
78 self.inst.move('walk', self.target, 0.05) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
79 self.engine.initializePumping() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
80 backend = self.engine.renderBackend |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
81 for i in xrange(360): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
82 self.inst.getLocation().getLayerCoordinates() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
83 self.target.getLayerCoordinates() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
84 if self.inst.getLocation().getLayerCoordinates() == self.target.getLayerCoordinates(): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
85 break |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
86 self.inst.update() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
87 action = self.inst.currentAction |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
88 angle = 0 #self.inst.orientation |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
89 animation = getAnimation( action.getAnimationIndexByAngle(angle) ) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
90 timestamp = self.inst.actionRuntime % animation.duration |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
91 image = animation.getFrameByTimestamp( timestamp ) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
92 if image: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
93 image.render(fife.Rect(0,0,image.width,image.height),255) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
94 self.engine.pump() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
95 self.engine.finalizePumping() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
96 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
97 def testWalkAround(self): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
98 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
99 rb = self.engine.getRenderBackend() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
100 viewport = fife.Rect(0, 0, rb.getWidth(), rb.getHeight()) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
101 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
102 cam = self.engine.getView().addCamera("foo", self.layer, viewport, fife.ExactModelCoordinate(0,0) ) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
103 cam.setCellImageDimensions(self.ground.img.getWidth(), self.ground.img.getHeight()) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
104 cam.setRotation(45) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
105 cam.setTilt(40) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
106 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
107 self.engine.getView().resetRenderers() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
108 self.engine.initializePumping() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
109 self.target.setLayerCoordinates(fife.ModelCoordinate(2,-2)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
110 self.inst.move('walk', self.target, 0.9) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
111 targets = ( |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
112 (2,0), (2,-1), (2,-2), (1,-2), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
113 (0,-2), (-1,-2), (-2,-2), (-2,-1), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
114 (-2,0), (-2,1), (-2,2), (-1,2), |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
115 (0,2), (1,2), (2,2), (2,1)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
116 for target in targets: |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
117 l = self.inst.getLocation() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
118 l.setLayerCoordinates(fife.ModelCoordinate(0,0)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
119 self.inst.setLocation(l) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
120 self.target.setLayerCoordinates(fife.ModelCoordinate(*target)) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
121 self.inst.move('walk', self.target, 0.9) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
122 for i in xrange(10): |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
123 self.engine.pump() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
124 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
125 self.engine.finalizePumping() |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
126 self.engine.getView().removeCamera(cam) |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
127 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
128 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
129 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
130 TEST_CLASSES = [ActionTests] |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
131 |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
132 if __name__ == '__main__': |
4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222
parents:
diff
changeset
|
133 unittest.main() |