corrections stylistiques mineures
This commit is contained in:
parent
a235f8f77e
commit
04197da18b
@ -12,13 +12,15 @@ class CollideRect(Component):
|
|||||||
self.vx = 0
|
self.vx = 0
|
||||||
self.vy = 0
|
self.vy = 0
|
||||||
|
|
||||||
def load(self):
|
def x_change_cb(self, x):
|
||||||
def x_change_cb(x):
|
|
||||||
self.rect.x = x
|
self.rect.x = x
|
||||||
def y_change_cb(y):
|
|
||||||
|
def y_change_cb(self, y):
|
||||||
self.rect.y = y
|
self.rect.y = y
|
||||||
self.parent.subscribe('x', x_change_cb)
|
|
||||||
self.parent.subscribe('y', y_change_cb)
|
def load(self):
|
||||||
|
self.parent.subscribe('x', self.x_change_cb)
|
||||||
|
self.parent.subscribe('y', self.y_change_cb)
|
||||||
|
|
||||||
def register(self):
|
def register(self):
|
||||||
PhysicsServer().register_component(self)
|
PhysicsServer().register_component(self)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from .observer import Observer
|
from .observer import Observer
|
||||||
|
|
||||||
|
|
||||||
class Entity(Observer):
|
class Entity(Observer):
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -4,7 +4,8 @@ from pygame import event
|
|||||||
from pygame.locals import QUIT
|
from pygame.locals import QUIT
|
||||||
|
|
||||||
|
|
||||||
class StopException(RuntimeError): pass
|
class StopException(RuntimeError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InputServer(Server):
|
class InputServer(Server):
|
||||||
|
@ -14,7 +14,6 @@ class Server(metaclass=Singleton):
|
|||||||
def unregister_component(self, component):
|
def unregister_component(self, component):
|
||||||
self._components.remove(component)
|
self._components.remove(component)
|
||||||
|
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def step(self):
|
def step(self):
|
||||||
pass
|
pass
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from random import random, randint
|
from random import random, randint
|
||||||
|
|
||||||
from pygame import Surface, draw, Rect, image
|
from pygame import Rect, image
|
||||||
|
|
||||||
from engine.entity import Entity
|
from engine.entity import Entity
|
||||||
from engine.scene_manager import SceneManager
|
from engine.scene_manager import SceneManager
|
||||||
@ -9,7 +9,6 @@ from engine.components.collide_rect import CollideRect
|
|||||||
from engine.components.sprite import Sprite
|
from engine.components.sprite import Sprite
|
||||||
|
|
||||||
from .common import S, Direction
|
from .common import S, Direction
|
||||||
from .pacdot import PacDot
|
|
||||||
|
|
||||||
|
|
||||||
class Ghost(Entity):
|
class Ghost(Entity):
|
||||||
|
@ -14,6 +14,7 @@ from .pacdot import PacDot, EnsmallmentDot
|
|||||||
|
|
||||||
class Node():
|
class Node():
|
||||||
cpt = 0
|
cpt = 0
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.id = self.__class__.cpt
|
self.id = self.__class__.cpt
|
||||||
self.__class__.cpt += 1
|
self.__class__.cpt += 1
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
class MainMenu(Scene):
|
|
||||||
pass
|
|
||||||
|
|
||||||
scene = MainMenu()
|
|
Reference in New Issue
Block a user