code skelett
This commit is contained in:
parent
7bc89c3432
commit
ab1f1cdaea
3 changed files with 14 additions and 9224 deletions
8866
01_ndvi.ipynb
8866
01_ndvi.ipynb
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -6,13 +6,13 @@ import rasterio
|
||||||
|
|
||||||
pygame.init()
|
pygame.init()
|
||||||
|
|
||||||
WIDTH, HEIGHT = 800, 600
|
WIDTH, HEIGHT = 1920, 1080
|
||||||
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
|
||||||
pygame.display.set_caption("Water Bottle Shooter")
|
pygame.display.set_caption("Water Bottle Shooter")
|
||||||
|
|
||||||
WHITE = (255, 255, 255)
|
WHITE = (255, 255, 255)
|
||||||
BLUE = (0, 150, 255)
|
BLUE = (0, 150, 255)
|
||||||
PLAYER_COLOR = (0, 200, 0)
|
PLAYER_COLOR = (200, 200, 0)
|
||||||
WATER_COLOR = (0, 180, 255)
|
WATER_COLOR = (0, 180, 255)
|
||||||
|
|
||||||
PLAYER_SIZE = 40
|
PLAYER_SIZE = 40
|
||||||
|
|
@ -20,6 +20,14 @@ PLAYER_SPEED = 5
|
||||||
WATER_SIZE = 10
|
WATER_SIZE = 10
|
||||||
WATER_SPEED = 10
|
WATER_SPEED = 10
|
||||||
|
|
||||||
|
PLAYER_IMAGE_PATH = "player.png" # Path to your player image
|
||||||
|
try:
|
||||||
|
PLAYER_IMAGE = pygame.image.load(PLAYER_IMAGE_PATH).convert_alpha()
|
||||||
|
PLAYER_IMAGE = pygame.transform.scale(PLAYER_IMAGE, (PLAYER_SIZE, PLAYER_SIZE))
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Could not load player image: {e}")
|
||||||
|
PLAYER_IMAGE = None
|
||||||
|
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
|
|
||||||
# Load raster map as background
|
# Load raster map as background
|
||||||
|
|
@ -78,7 +86,10 @@ class Player:
|
||||||
self.rect.topleft = (self.x, self.y)
|
self.rect.topleft = (self.x, self.y)
|
||||||
|
|
||||||
def draw(self, win, offset_x, offset_y):
|
def draw(self, win, offset_x, offset_y):
|
||||||
pygame.draw.rect(win, PLAYER_COLOR, (self.x - offset_x, self.y - offset_y, PLAYER_SIZE, PLAYER_SIZE))
|
if PLAYER_IMAGE:
|
||||||
|
win.blit(PLAYER_IMAGE, (self.x - offset_x, self.y - offset_y))
|
||||||
|
else:
|
||||||
|
pygame.draw.rect(win, PLAYER_COLOR, (self.x - offset_x, self.y - offset_y, PLAYER_SIZE, PLAYER_SIZE))
|
||||||
|
|
||||||
|
|
||||||
class WaterBottle:
|
class WaterBottle:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue