Compare commits
3 Commits
5e3cce852e
...
5976f41f12
Author | SHA1 | Date | |
---|---|---|---|
5976f41f12 | |||
|
e1c7e6d6e7 | ||
|
697a7cdebb |
@ -1,4 +1,5 @@
|
|||||||
import pygame
|
import pygame
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
class GameContext:
|
class GameContext:
|
||||||
dust_car_speed = 20
|
dust_car_speed = 20
|
||||||
@ -9,4 +10,10 @@ class GameContext:
|
|||||||
canvas = None
|
canvas = None
|
||||||
|
|
||||||
def startup(game_context: GameContext):
|
def startup(game_context: GameContext):
|
||||||
|
render_background(game_context)
|
||||||
game_context.canvas.blit(game_context.dust_car_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y))
|
game_context.canvas.blit(game_context.dust_car_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y))
|
||||||
|
|
||||||
|
def render_background(game_context: GameContext):
|
||||||
|
bg_img = Image.open("imgs/background.jpg")
|
||||||
|
pygame_bg_image = pygame.image.frombuffer(bg_img.tobytes(), bg_img.size, 'RGB')
|
||||||
|
game_context.canvas.blit(pygame_bg_image, (0, 0))
|
||||||
|
BIN
imgs/background.jpg
Normal file
BIN
imgs/background.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 238 KiB |
Loading…
Reference in New Issue
Block a user