Browse Source

animation

Bastien Sevajol 7 years ago
parent
commit
03a21b1dbc

+ 7 - 8
sandbox/tile/gui/actor.py View File

@@ -1,10 +1,9 @@
1 1
 # coding: utf-8
2 2
 import pyglet
3 3
 
4
-from sandbox.tile.gui.animation import ANIMATION_WALK
5
-from sandbox.tile.gui.animation import ANIMATION_CRAWL
6 4
 from synergine2.simulation import Subject
7 5
 from synergine2_cocos2d.actor import Actor
6
+from synergine2_cocos2d.animation import ANIMATION_WALK
8 7
 
9 8
 
10 9
 class Man(Actor):
@@ -22,12 +21,12 @@ class Man(Actor):
22 21
             'actors/man_w9.png',
23 22
             'actors/man_w10.png',
24 23
         ],
25
-        ANIMATION_CRAWL: [
26
-            'actors/man_c1.png',
27
-            'actors/man_c2.png',
28
-            'actors/man_c3.png',
29
-            'actors/man_c4.png',
30
-        ]
24
+        # ANIMATION_CRAWL: [
25
+        #     'actors/man_c1.png',
26
+        #     'actors/man_c2.png',
27
+        #     'actors/man_c3.png',
28
+        #     'actors/man_c4.png',
29
+        # ]
31 30
     }
32 31
 
33 32
     def __init__(self, subject: Subject) -> None:

+ 0 - 5
sandbox/tile/gui/animation.py View File

@@ -1,5 +0,0 @@
1
-# coding: utf-8
2
-
3
-
4
-ANIMATION_WALK = 'WALK'
5
-ANIMATION_CRAWL = 'CRAWL'

+ 0 - 5
sandbox/tile/gui/base.py View File

@@ -1,9 +1,4 @@
1 1
 # coding: utf-8
2
-import random
3
-
4
-from sandbox.tile.gui.animation import ANIMATION_WALK
5
-from sandbox.tile.gui.animation import ANIMATION_CRAWL
6
-from synergine2_cocos2d.animation import Animate
7 2
 from synergine2_cocos2d.gui import TMXGui
8 3
 from synergine2_cocos2d.interaction import MoveActorInteraction
9 4
 

+ 3 - 0
synergine2_cocos2d/animation.py View File

@@ -4,6 +4,9 @@ import typing
4 4
 import pyglet
5 5
 import cocos
6 6
 
7
+ANIMATION_WALK = 'WALK'
8
+ANIMATION_CRAWL = 'CRAWL'
9
+
7 10
 
8 11
 class AnimatedInterface(object):
9 12
     def get_images_for_animation(self, animation_name: str) -> typing.List[pyglet.image.TextureRegion]:

+ 4 - 0
synergine2_cocos2d/gui.py View File

@@ -17,6 +17,8 @@ from synergine2.terminals import Terminal
17 17
 from synergine2.terminals import TerminalPackage
18 18
 from synergine2_cocos2d.actions import MoveTo
19 19
 from synergine2_cocos2d.actor import Actor
20
+from synergine2_cocos2d.animation import Animate
21
+from synergine2_cocos2d.animation import ANIMATION_WALK
20 22
 from synergine2_cocos2d.exception import InteractionNotFound
21 23
 from synergine2_cocos2d.exception import OuterWorldPosition
22 24
 from synergine2_cocos2d.gl import draw_rectangle
@@ -774,3 +776,5 @@ class TMXGui(Gui):
774 776
 
775 777
         move_action = MoveTo(new_window_position, 0.5)
776 778
         actor.do(move_action)
779
+        # TODO: values
780
+        actor.do(Animate(ANIMATION_WALK, 0.5, 1))

+ 2 - 1
synergine2_xyz/simulation.py View File

@@ -43,7 +43,7 @@ class XYZSimulation(BaseSimulation):
43 43
                 for neighbor in neighbors:
44 44
                     neighbor_x, neighbor_y = map(int, neighbor.split('.'))
45 45
 
46
-                    if neighbor_x > 39 or neighbor_x < 0:
46
+                    if neighbor_x > 69 or neighbor_x < 0:
47 47
                         continue
48 48
 
49 49
                     if neighbor_y > 69 or neighbor_y < 0:
@@ -51,6 +51,7 @@ class XYZSimulation(BaseSimulation):
51 51
 
52 52
                     # TODO: Voir https://pypi.python.org/pypi/Dijkstar/2.2
53 53
                     self.graph.add_edge(position, neighbor, 1)
54
+        pass
54 55
 
55 56
     def is_possible_subject_position(self, subject: XYZSubject, position: tuple) -> bool:
56 57
         return self.is_possible_position(position)