play = PlayState('play', entitysystem)
play.activate()

# unterschied zwischen transitionTo und activate?

# setup StateMachine
sm = StateMachine()
# sm.start_state = splash
# sm.end_state = end

sm.setStartEnd(splash, end)
sm.addState(play)
sm.addTransition(splash, 'x', play)  # bei event x
#sm.addTransition(play, 'x', end) # bei event x
# messenger.subscribe('x');
messenger.subscribe(lambda: sm.handle('x'), "x")

sm.activate()

#teststates = {};
#teststates['src1'] = {};
#teststates['src2'] = {};
#teststates['src1']['msgX'] = 'destination1x'
#teststates['src1']['msgY'] = 'destination1y'
#teststates['src2']['msgZ'] = 'destination2z'

# enable termination of application from each single state
# messenger.subscribe(sm.handle(end), 'end')

# game loop
while not end_of_game:
示例#2
0
def add(entity):
    messenger.subscribe(entity.draw, "render");
    functions.append(lambda:entities.append(entity))
示例#3
0
def initialize_ship(dt, display):
    
    ship = Player(640/2,480/2, display, dt)
    add(ship)

    messenger.subscribe(ship.shoot, "shoot");
    messenger.subscribe(ship.accelerate, "accelerate");
    messenger.subscribe(ship.decelerate, "deaccelerate");
    messenger.subscribe(ship.turnRight, "right");
    messenger.subscribe(ship.turnLeft, "left");
    messenger.subscribe(ship.draw, "render");
示例#4
0
def add(entity):
    messenger.subscribe(entity.draw, "render")
    functions.append(lambda: entities.append(entity))
示例#5
0
def initialize_ship(dt, display):

    ship = Player(640 / 2, 480 / 2, display, dt)
    add(ship)

    messenger.subscribe(ship.shoot, "shoot")
    messenger.subscribe(ship.accelerate, "accelerate")
    messenger.subscribe(ship.decelerate, "deaccelerate")
    messenger.subscribe(ship.turnRight, "right")
    messenger.subscribe(ship.turnLeft, "left")
    messenger.subscribe(ship.draw, "render")
play = PlayState('play', entitysystem);
play.activate();

# unterschied zwischen transitionTo und activate? 

# setup StateMachine
sm = StateMachine()
# sm.start_state = splash
# sm.end_state = end

sm.setStartEnd(splash, end)
sm.addState(play);
sm.addTransition(splash, 'x', play) # bei event x
#sm.addTransition(play, 'x', end) # bei event x
# messenger.subscribe('x');
messenger.subscribe(lambda:sm.handle('x'), "x");

sm.activate()

#teststates = {};
#teststates['src1'] = {};
#teststates['src2'] = {};
#teststates['src1']['msgX'] = 'destination1x'
#teststates['src1']['msgY'] = 'destination1y'
#teststates['src2']['msgZ'] = 'destination2z'

# enable termination of application from each single state
# messenger.subscribe(sm.handle(end), 'end')


# game loop