Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
animation
Browse files Browse the repository at this point in the history
  • Loading branch information
buxx committed Jul 29, 2017
1 parent 5c99ce8 commit 03a21b1
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
15 changes: 7 additions & 8 deletions sandbox/tile/gui/actor.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# coding: utf-8
import pyglet

from sandbox.tile.gui.animation import ANIMATION_WALK
from sandbox.tile.gui.animation import ANIMATION_CRAWL
from synergine2.simulation import Subject
from synergine2_cocos2d.actor import Actor
from synergine2_cocos2d.animation import ANIMATION_WALK


class Man(Actor):
Expand All @@ -22,12 +21,12 @@ class Man(Actor):
'actors/man_w9.png',
'actors/man_w10.png',
],
ANIMATION_CRAWL: [
'actors/man_c1.png',
'actors/man_c2.png',
'actors/man_c3.png',
'actors/man_c4.png',
]
# ANIMATION_CRAWL: [
# 'actors/man_c1.png',
# 'actors/man_c2.png',
# 'actors/man_c3.png',
# 'actors/man_c4.png',
# ]
}

def __init__(self, subject: Subject) -> None:
Expand Down
5 changes: 0 additions & 5 deletions sandbox/tile/gui/animation.py

This file was deleted.

5 changes: 0 additions & 5 deletions sandbox/tile/gui/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# coding: utf-8
import random

from sandbox.tile.gui.animation import ANIMATION_WALK
from sandbox.tile.gui.animation import ANIMATION_CRAWL
from synergine2_cocos2d.animation import Animate
from synergine2_cocos2d.gui import TMXGui
from synergine2_cocos2d.interaction import MoveActorInteraction

Expand Down
3 changes: 3 additions & 0 deletions synergine2_cocos2d/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import pyglet
import cocos

ANIMATION_WALK = 'WALK'
ANIMATION_CRAWL = 'CRAWL'


class AnimatedInterface(object):
def get_images_for_animation(self, animation_name: str) -> typing.List[pyglet.image.TextureRegion]:
Expand Down
4 changes: 4 additions & 0 deletions synergine2_cocos2d/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from synergine2.terminals import TerminalPackage
from synergine2_cocos2d.actions import MoveTo
from synergine2_cocos2d.actor import Actor
from synergine2_cocos2d.animation import Animate
from synergine2_cocos2d.animation import ANIMATION_WALK
from synergine2_cocos2d.exception import InteractionNotFound
from synergine2_cocos2d.exception import OuterWorldPosition
from synergine2_cocos2d.gl import draw_rectangle
Expand Down Expand Up @@ -774,3 +776,5 @@ def move_subject(self, event: MoveEvent):

move_action = MoveTo(new_window_position, 0.5)
actor.do(move_action)
# TODO: values
actor.do(Animate(ANIMATION_WALK, 0.5, 1))
3 changes: 2 additions & 1 deletion synergine2_xyz/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ def __init__(
for neighbor in neighbors:
neighbor_x, neighbor_y = map(int, neighbor.split('.'))

if neighbor_x > 39 or neighbor_x < 0:
if neighbor_x > 69 or neighbor_x < 0:
continue

if neighbor_y > 69 or neighbor_y < 0:
continue

# TODO: Voir https://pypi.python.org/pypi/Dijkstar/2.2
self.graph.add_edge(position, neighbor, 1)
pass

def is_possible_subject_position(self, subject: XYZSubject, position: tuple) -> bool:
return self.is_possible_position(position)
Expand Down

0 comments on commit 03a21b1

Please sign in to comment.