background images

movement of chopper
This commit is contained in:
Olli Graf
2026-02-14 16:13:18 +01:00
parent c97a5ff09c
commit 8eed1cd581
62 changed files with 39 additions and 12 deletions

BIN
background/fort_01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
background/fort_05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
background/fort_06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
background/fort_07.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
background/fort_08.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
background/fort_09.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
background/fort_10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
background/fort_11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
background/fort_12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
background/fort_13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
background/fort_14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
background/fort_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
background/fort_17.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_18.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
background/fort_19.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
background/fort_20.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
background/fort_21.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_22.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

BIN
background/fort_23.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
background/fort_24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_25.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
background/fort_26.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
background/fort_27.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
background/fort_28.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
background/fort_29.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
background/fort_30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
background/fort_31.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
background/fort_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_33.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
background/fort_34.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
background/fort_37.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
background/fort_38.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_39.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
background/fort_40.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
background/fort_41.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
background/fort_42.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_43.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_44.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
background/fort_45.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
background/fort_46.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_47.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_48.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_49.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_50.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_51.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
background/fort_52.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_53.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_54.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
background/fort_55.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
background/fort_56.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
background/fort_57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

BIN
background/fort_58.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
background/fort_59.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
background/fort_60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -8,9 +8,37 @@ class Chopper:
self.STATE_FRONT=0 self.STATE_FRONT=0
self.STATE_RIGHT=1 self.STATE_RIGHT=1
self.STATE_LEFT = 2 self.STATE_LEFT = 2
# directions of movement
self.UP = 0
self.DOWN = 1
self.LEFT = 2
self.RIGHT = 3
self.images = {} self.images = {}
def add_sprite(self,state,sprite): def add_sprite(self,state,sprite):
self.images[state] = sprite self.images[state] = sprite
def move(self,direction):
match direction:
case self.UP:
self.state = self.STATE_FRONT
if self.ypos > 2:
self.ypos -= 2
case self.DOWN:
self.state = self.STATE_FRONT
self.ypos +=2
case self.LEFT:
self.state = self.STATE_LEFT
if self.xpos > 2:
self.xpos -=2
case self.RIGHT:
self.state = self.STATE_RIGHT
self.xpos += 2
def current_image(self):
return self.images[self.state]

View File

@@ -7,10 +7,9 @@ class Fort:
def __init__(self): def __init__(self):
print('init()') print('init()')
pygame.init() pygame.init()
pygame.display.set_mode((640, 480)) pygame.display.set_mode((384, 240))
self.chopper_x = 100 self.background =pygame.image.load('background/fort_02.png')
self.chopper_y = 100 self.screen = pygame.display.set_mode((384, 240))
self.screen = pygame.display.set_mode((800, 600))
self.chopper_front = pygame.image.load("sprites/chopper_front.png").convert() self.chopper_front = pygame.image.load("sprites/chopper_front.png").convert()
self.chopper_side_right = pygame.image.load("sprites/chopper_side_right.png").convert() self.chopper_side_right = pygame.image.load("sprites/chopper_side_right.png").convert()
self.chopper_moving_left = pygame.image.load("sprites/chopper_moving_left.png").convert() self.chopper_moving_left = pygame.image.load("sprites/chopper_moving_left.png").convert()
@@ -22,7 +21,8 @@ class Fort:
def mainloop(self): def mainloop(self):
running = True running = True
self.screen.blit(self.chopper_front, (self.chopper_x, self.chopper_y)) self.screen.blit(self.background,(0,0))
self.screen.blit(self.chopper_front, (self.chopper.xpos, self.chopper.ypos))
# self.screen.blit(self.chopper_side_right, (100, 100)) # self.screen.blit(self.chopper_side_right, (100, 100))
# self.screen.blit(self.chopper_moving_left, (150, 150)) # self.screen.blit(self.chopper_moving_left, (150, 150))
pygame.display.flip() pygame.display.flip()
@@ -36,16 +36,15 @@ class Fort:
case pygame.QUIT: case pygame.QUIT:
running = False running = False
case pygame.K_RIGHT: case pygame.K_RIGHT:
print('right') self.chopper.move(self.chopper.RIGHT)
self.screen.blit(self.chopper_side_right,(self.chopper_x,self.chopper_y))
case pygame.K_LEFT: case pygame.K_LEFT:
print('left') self.chopper.move(self.chopper.LEFT)
self.screen.blit(self.chopper_moving_left,(self.chopper_x,self.chopper_y)) case pygame.K_UP:
self.chopper.move(self.chopper.UP)
case pygame.K_DOWN: case pygame.K_DOWN:
print('down') self.chopper.move(self.chopper.DOWN)
self.screen.blit(self.chopper_front,(self.chopper_x,self.chopper_y))
self.screen.blit(self.chopper.current_image(),(self.chopper.xpos,self.chopper.ypos))
pygame.display.flip() pygame.display.flip()
if __name__ == '__main__': if __name__ == '__main__':
fort = Fort() fort = Fort()