Browse Source

jump animation added

Zero! Studio 1 năm trước cách đây
mục cha
commit
78309169ca
4 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 1 1
      data/02.yaml
  2. BIN
      images/characters/protagonist_forward.png
  3. 4 0
      jogai/character.py
  4. 2 1
      scripts/basics.py

+ 1 - 1
data/02.yaml

@@ -9,7 +9,7 @@ characters:
     lives: 5
     speed: 20
     width: 50
-    position: [2065, 300]
+    position: [265, 300]
     keys:
       forward: RIGHT
       backward: LEFT

BIN
images/characters/protagonist_forward.png


+ 4 - 0
jogai/character.py

@@ -904,6 +904,10 @@ class Character(pygame.sprite.Sprite):
             else:
                 self._jump_counter = settings.CHARACTER_DEFAULT_JUMP_FORCE
                 self.is_jumping = False
+                if _('stop') in self.animation_filenames.keys():
+                    self.load(
+                        self.animation_filenames[_('stop')], preserve_size=True
+                    )
 
     def _update_rect_position(
         self,

+ 2 - 1
scripts/basics.py

@@ -6,7 +6,8 @@ def test_example01():
     prepare('02.yaml')
     sq = StairsGroup(brick, 5)
     add_group(sq)
-    protagonist.inventory.add(brick)
 
     while is_running():
         update()
+        if protagonist.touch(secondary):
+            print('a')