Add sprites sidebar, x and y gravity instead of gravity, fix a bunch of bugs, so now rules work, add input, mouse move and mouse click events, fix color changes, fix very slow loading times, go from is rules to greater, less and between rules

This commit is contained in:
csd4ni3l
2025-11-23 22:40:17 +01:00
parent daa13e5814
commit d5de17f8e0
9 changed files with 420 additions and 199 deletions

View File

@@ -1,4 +1,4 @@
import pyglet
import pyglet, arcade.color
from utils.constants import DEFAULT_X_VELOCITY, DEFAULT_Y_VELOCITY
@@ -7,11 +7,22 @@ class BaseShape():
self.shape_type = ""
self.x_velocity = DEFAULT_X_VELOCITY
self.y_velocity = DEFAULT_Y_VELOCITY
self._shape_color = "WHITE"
def update(self, gravity):
def update(self, x_gravity, y_gravity):
self.x += self.x_velocity
self.y += self.y_velocity
self.y -= gravity
self.x -= x_gravity
self.y -= y_gravity
@property
def shape_color(self):
return self._shape_color
@shape_color.setter
def shape_color(self, color):
self._shape_color = color
self.color = getattr(arcade.color, color)
class Circle(pyglet.shapes.Circle, BaseShape):
def __init__(self, *args, **kwargs):
@@ -41,4 +52,4 @@ class Triangle(pyglet.shapes.Triangle, BaseShape):
@property
def shape_size(self):
return self.x2 - self.x
return max(self.x, self.x2, self.x3) - min(self.x, self.x2, self.x3)