Exemplo n.º 1
0
				pyramid2.moveDown()
				blank.moveDown()
				if plane.crashing():
					graphics.remove(plane)
					graphics.remove(banner)
					graphics.remove(pyramid)
					graphics.remove(sphere)
					graphics.remove(pyramid2)
					graphics.remove(blank)
					pygame.mixer.music.stop()
					pygame.mixer.Sound.play(crash)
					clear()
					endScreen()

import event
event.register(quit)
event.register(click)

def gameLoop():
	gameSetup()
	render_graphics()
	pygame.mixer.music.play(-1)
	while (run):
		clock.tick(30)

		update_graphics()

	pygame.display.flip()

startScreen()
Exemplo n.º 2
0
#george2.speed = 0.4
#george2.facing = "left"

graphics.register(george)
#graphics.register(george2)

def quit(e):
	global run
	if e.type == pygame.QUIT:
		run = False
	elif e.type == pygame.KEYUP:
		if ((e.key == pygame.K_F4) and
		   (e.mod and pygame.KMOD_ALT)):
			run = False

event.register(george.handler)
event.register(quit)

clock = pygame.time.Clock()
run = True
frame = 0

while (run):


	clock.tick(30)

	event.update()
	george.update()
	#george2.update()
	graphics.update()
Exemplo n.º 3
0
cover = True


def handle(e):
    global run, cover
    if e.type == pygame.QUIT:
        run = False
    elif e.type == pygame.KEYUP:
        if ((e.key == pygame.K_F4) and (e.mod and pygame.KMOD_ALT)):
            run = False
        elif e.key == pygame.K_b:
            cover = not cover
            print "cover: ", cover


event.register(ava.handler)
event.register(handle)

clock = pygame.time.Clock()
frame = 0
while run:
    clock.tick(30)
    #for e in pygame.event.get():
    #    if e.type == pygame.QUIT:
    #        run = False
    #    elif e.type == pygame.KEYUP:
    #        if (e.key == pygame.K_F4) and (e.mod and pygame.KMOD_ALT):
    #            run = False
    #    elif e.type == pygame.KEYDOWN:
    #        if e.key == pygame.K_UP:
    #            ava.facing = "up"
Exemplo n.º 4
0
playing = True

def quit(e):
	global playing
	if e.type == pygame.QUIT:
		playing = False
	elif e.type == pygame.KEYUP:
		if ((e.key == pygame.K_F4) and
		   (e.mod and pygame.KMOD_ALT)):
			playing = False

player = units.player(500, 500)
display.register(player)

event.register(player.handler)
event.register(quit)
event.register(audio.handler)
event.register(display.handler)

audio.init()
clock = pygame.time.Clock()
while(playing):

	clock.tick(30)

	event.update()
	player.update()
	display.update()
	
pygame.display.quit()
Exemplo n.º 5
0
        sensor = components[attribs['sensor']]
        actor = components[attribs['actor']]
        agitator = components.get(attribs.get('agitator', ''), None)
        initialSetpoint = attribs.get('initialSetpoint', 67.0)
        initiallyEnabled = True if attribs.get('initialState',
                                               'on') == 'on' else 'off'
        components[name] = controller.Controller(name, sensor, actor, logic,
                                                 agitator, initialSetpoint,
                                                 initiallyEnabled)

for conn in config['connections']:
    (sendEvent, recvEvent) = conn.split('=>')
    (sendComponent, sendType) = sendEvent.split('.')
    (recvComponent, recvType) = recvEvent.split('.')
    event.register(sendEvent,
                   lambda event, rc=recvComponent, rt=recvType: components[rc].
                   callback(rt, event))


async def start_background_tasks(app):
    pass


async def cleanup_background_tasks(app):
    pass


app.on_startup.append(start_background_tasks)
app.on_cleanup.append(cleanup_background_tasks)

isWebUIenabled = config.get('enableWebUI', False)