예제 #1
0
eventDelay = 750
timeTicks = 0
lastScriptEventTime = 0
map_renderer = MapRenderer(ourMap)
map_renderer.prepare_layers()
action_meter = meter(0, 300, 300, 1, True, color=(255, 0, 255))
geom_system = geom_draw_system()
# code for testing animated line geometry
#testLine = animated_line([(480, 32), (480, 32), (480, 32), (480, 32)], [(360, 64), (400, 98), (440, 128), (480, 164)], (255, 0, 0), 2, 10, anim_looping = True)

for k in range(ourScript.header[0]):
    if k != 0:
        currTile = Surface((32, 32)).convert()
        currTile.fill((0, 255, 255))
        currTile.set_alpha(75)
        gui.draw_text_block(1, 1, currTile, str(k + 1))
        print ourScript.defs[k][1]
        scriptTiles.append(currTile)

# just testing pathfinding with A*
ourEntities._list[0].calculate_astar_path(astar.script_to_grid(ourScript))
ourEntities._list[1].calculate_astar_path(astar.script_to_grid(ourScript))
ourEntities._list[2].calculate_astar_path(astar.script_to_grid(ourScript))

#ourEntities._list[0].does_chase_player = True
#ourEntities._list[1].does_chase_player = True
#ourEntities._list[2].does_chase_player = True

while 1:
    clock.tick(60)  #keep the framerate at 60 or lower
    timeTicks = pygame.time.get_ticks()
예제 #2
0
파일: mapedit.py 프로젝트: jyota/vHunter
offs_x, offs_y = (0, 0)
currentScript = 0
scriptTiles = []

collTile = Surface((32, 32))
collTile.fill((255, 0, 0))
collTile.set_alpha(68)

scriptTiles.append(collTile)

for k in range(ourScript.header[0]):
	if k != 0:
		currTile = Surface((32, 32))
		currTile.fill((0, 255, 255))
		currTile.set_alpha(75)
		gui.draw_text_block(1, 1, currTile, str(k+1))
		print ourScript.defs[k][1]
		scriptTiles.append(currTile)

while 1:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit()
		if event.type == pygame.KEYDOWN:
			if event.key == pygame.K_ESCAPE:
				# select a filename to save this map to
				get_text_kb(mapselect, screen)
			if event.key == pygame.K_s:
				# save the current map and script in memory
				ourMap.header[2] = scrselect.value
				savemap(mapselect.value, ourMap.header, ourMap.data)
예제 #3
0
파일: engine.py 프로젝트: jyota/vHunter
eventDelay = 750
timeTicks = 0
lastScriptEventTime = 0
map_renderer = MapRenderer(ourMap)
map_renderer.prepare_layers()
action_meter = meter(0, 300, 300, 1, True, color = (255, 0, 255))
geom_system = geom_draw_system()
# code for testing animated line geometry
#testLine = animated_line([(480, 32), (480, 32), (480, 32), (480, 32)], [(360, 64), (400, 98), (440, 128), (480, 164)], (255, 0, 0), 2, 10, anim_looping = True)

for k in range(ourScript.header[0]):
	if k != 0:
		currTile = Surface((32, 32)).convert()
		currTile.fill((0, 255, 255))
		currTile.set_alpha(75)
		gui.draw_text_block(1, 1, currTile, str(k+1))
		print ourScript.defs[k][1]
		scriptTiles.append(currTile)


# just testing pathfinding with A*
ourEntities._list[0].calculate_astar_path(astar.script_to_grid(ourScript))
ourEntities._list[1].calculate_astar_path(astar.script_to_grid(ourScript))
ourEntities._list[2].calculate_astar_path(astar.script_to_grid(ourScript))

#ourEntities._list[0].does_chase_player = True
#ourEntities._list[1].does_chase_player = True
#ourEntities._list[2].does_chase_player = True


while 1: