Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # gra - pirat musi dostać się na statek
- # Licencja: GNU GPL - https://www.gnu.org/licenses/gpl-3.0.html
- # obrazki oryginalnie w serwisie Pixabay:
- # Statek: https://pixabay.com/pl/vectors/statek-%C5%82%C3%B3d%C5%BA-pirat-korsarz-146312/
- # Pirat: https://pixabay.com/pl/vectors/pingwin-pirat-tux-zwierz%C4%85t-chustka-161356/
- # Morze: https://pixabay.com/pl/photos/sun-ustawienie-niebo-zach%C3%B3d-s%C5%82o%C5%84ca-3726030/
- WIDTH = 800
- HEIGHT = 532
- KROK = 3
- ODLEGLOSC = 40
- from random import randint
- ship = Actor("ship.png")
- ship.x = randint(10, 700)
- ship.y = randint(10, 432)
- pirat = Actor("pingwin.png")
- pirat.x = randint(10, 750)
- pirat.y = randint(10, 500)
- def draw():
- screen.blit("sun_800.jpg", (0, 0))
- ship.draw()
- pirat.draw()
- if pirat.distance_to(ship) < ODLEGLOSC:
- screen.draw.text("SUPER !!!", (40, 10), shadow=(2,2), scolor="#202020")
- def update():
- if keyboard.d:
- pirat.x += KROK
- if pirat.x > 780:
- pirat.x = 775
- if keyboard.a:
- pirat.x -= KROK
- if pirat.x < 20:
- pirat.x = 25
- if keyboard.w:
- pirat.y -= KROK
- if pirat.y < 20:
- pirat.y = 25
- if keyboard.s:
- pirat.y += KROK
- if pirat.y > 510:
- pirat.y = 495
Advertisement
Add Comment
Please, Sign In to add comment