feat: Moved sprites into distinct folder
This commit is contained in:
parent
f65bbc1b79
commit
b0ee9493c7
BIN
Chef64new.png
BIN
Chef64new.png
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
2
app.py
2
app.py
@ -25,7 +25,7 @@ def initBoard():
|
||||
y1 = 2
|
||||
for i in range(x1, x1+4):
|
||||
for j in range(y1, y1+2):
|
||||
cells[i][j].prepareTexture("wall.png")
|
||||
cells[i][j].prepareTexture("sprites/wall.png")
|
||||
cells[i][j].blocking_movement = True
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ import pygame
|
||||
import prefs
|
||||
class Agent:
|
||||
def __init__(self, x, y, cells):
|
||||
self.sprite = pygame.image.load("Chef64new.png").convert_alpha()
|
||||
self.sprite = pygame.image.load("sprites/Chef64new.png").convert_alpha()
|
||||
self.sprite = pygame.transform.scale(self.sprite, (prefs.CELL_SIZE, prefs.CELL_SIZE))
|
||||
self.current_cell = cells[x][y]
|
||||
self.moved=False
|
||||
|
37
test.py
37
test.py
@ -1,37 +0,0 @@
|
||||
# Assuming you have an image file named "sprite.png" in the same directory
|
||||
import pygame
|
||||
|
||||
# Initialize Pygame
|
||||
pygame.init()
|
||||
|
||||
# Set up the display
|
||||
screen = pygame.display.set_mode((800, 600))
|
||||
pygame.display.set_caption("Sprite Example")
|
||||
|
||||
# Load the image
|
||||
sprite_image = pygame.image.load("Chef64new.png").convert_alpha()
|
||||
|
||||
# Scale the image to 200x200
|
||||
sprite_image = pygame.transform.scale(sprite_image, (200, 200))
|
||||
|
||||
# Get the rect of the sprite image for positioning
|
||||
sprite_rect = sprite_image.get_rect()
|
||||
|
||||
# Main game loop
|
||||
running = True
|
||||
while running:
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
|
||||
# Clear the screen
|
||||
screen.fill((255, 255, 255))
|
||||
|
||||
# Draw the sprite image onto the screen at position (250, 150)
|
||||
screen.blit(sprite_image, (250, 150))
|
||||
|
||||
# Update the display
|
||||
pygame.display.flip()
|
||||
|
||||
pygame.quit()
|
||||
pygame.quit()
|
Loading…
Reference in New Issue
Block a user