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