This commit is contained in:
rhiannon morris 2023-08-17 11:16:05 +02:00
parent 0b245a6f86
commit 1a635a3140
22 changed files with 14 additions and 16 deletions

View File

@ -7,20 +7,6 @@ LEFT = 1
DOWN = 2
RIGHT = 3
def dir_str(dir):
if dir == UP:
return 'back'
elif dir == LEFT:
return 'left'
elif dir == DOWN:
return 'front'
elif dir == RIGHT:
return 'right'
def image_path(direction, step):
dir = os.path.dirname(__file__)
return f"{dir}/sprites/{dir_str(direction)}{str(step + 1)}.png"
class Random:
def __init__(self):
@ -49,15 +35,24 @@ class Quox(Application):
LEFT = -90
RIGHT = 70
@staticmethod
def image_path(direction, step):
dir = os.path.dirname(__file__)
bases = {UP: 'back', LEFT: 'left', DOWN: 'front', RIGHT: 'right'}
base = bases[direction]
return f"{dir}/sprites/{base}{step}.png"
def __init__(self, app_ctx):
super().__init__(app_ctx)
self.random = Random()
self.choose_direction()
self.choose_turn_delay()
self.step = 0
self.step_delay = Quox.STEP_DELAY
self.move_delay = Quox.MOVE_DELAY
self.x = -10
self.y = -10
@ -72,7 +67,7 @@ class Quox(Application):
.fill()
def image(self, ctx):
path = image_path(self.direction, self.step)
path = Quox.image_path(self.direction, self.step)
ctx.image(path, self.x, self.y, -1, -1)
@staticmethod

3
sprites/.directory Normal file
View File

@ -0,0 +1,3 @@
[Dolphin]
Timestamp=2023,8,16,15,52,48
Version=4

BIN
sprites/back0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

BIN
sprites/front0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 809 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 814 B

BIN
sprites/left0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 868 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

BIN
sprites/right0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 952 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 952 B

After

Width:  |  Height:  |  Size: 937 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 937 B