Adds a seed entity.

Graphics!
This commit is contained in:
William Hubbard
2023-02-05 15:57:11 -07:00
parent 674ae01057
commit 3afe5322b3
2 changed files with 8 additions and 2 deletions

View File

@@ -11,7 +11,7 @@ from random import randrange
from Games.Throot.artrepository import * from Games.Throot.artrepository import *
from Games.Throot.player import Player, Camera from Games.Throot.player import Player, Camera
from Games.Throot.map import ObstacleSlice, OBSTACLE_SLICES from Games.Throot.map import ObstacleSlice, OBSTACLE_SLICES
from Games.Throot.sprites import Obstacle, Collectible, update_entities from Games.Throot.sprites import Entity, Obstacle, Collectible, update_entities
from Games.Throot.constants import * from Games.Throot.constants import *
@@ -92,8 +92,14 @@ class GameLoop(Room):
self.waterx = float(0) self.waterx = float(0)
seed_sprite = thumby.Sprite(seed.width, seed.height, seed.image, 0, 0, 0, False, False)
self.seed = Entity((thumby.display.width - seed.width) // 2, 0, seed.width, seed.height, None, seed_sprite)
def start(self, event): def start(self, event):
self.entities.clear() self.entities.clear()
self.entities.add(
self.seed
)
self.current_obstacle_slice = OBSTACLE_SLICES[0] self.current_obstacle_slice = OBSTACLE_SLICES[0]
self.player = Player() self.player = Player()
self.player.yspeed = 10 self.player.yspeed = 10

View File

@@ -67,7 +67,7 @@ class Entity:
True if the game should keep this entity, false if the game should drop True if the game should keep this entity, false if the game should drop
this entity from memory. this entity from memory.
""" """
return False return True
def render(self, tpf: float, camera: Camera) -> bool: def render(self, tpf: float, camera: Camera) -> bool:
""" """