Пример #1
0
def game_map_turn_correct( arrow, play_map, direction ):
	# Is arrow near grid center that need to check current grid bound
	arrow_grid = play_map.detect_grid( arrow.position )
	grid_position = play_map.grid_center( arrow_grid )
	if ( cal.distance(arrow.position, grid_position) < res.distance_grid_turn*arrow.speed ):
		if ( direction!=arrow.direction and direction!=cal.reverse(arrow.direction) ):
			if ( game_map.direction_to_wall(direction) &
			play_map.grids[arrow_grid[1]*play_map.map_size[0]+arrow_grid[0]] == 0):
				arrow.set_direction( direction )
				arrow.set_position( grid_position )
Пример #2
0
def game_map_bump_correct( arrow, play_map ):
	# Is arrow near grid center that need to check current grid bound
	arrow_grid = play_map.detect_grid( arrow.position )
	grid_position = play_map.grid_center( arrow_grid )
	if ( cal.unit( cal.vector( grid_position, arrow.position ) ) == arrow.direction ):
		# convert vector to wall definition
		arrow_bump_wall = game_map.direction_to_wall( arrow.direction )

		# arrow bumps wall
		if ( arrow_bump_wall & 
			play_map.grids[arrow_grid[1]*play_map.map_size[0]+arrow_grid[0]] != 0 ):
			arrow.set_position( grid_position )