Changed resource spawning
added interact functionality temp added zoom with scroll wheel
This commit is contained in:
@@ -10,6 +10,9 @@ func init(grid: TileMap) -> void:
|
||||
func world_to_grid(world_loc: Vector2) -> Vector2i:
|
||||
return Vector2i(floor(world_loc.x / GRID_SIZE), floor(world_loc.y / GRID_SIZE))
|
||||
|
||||
func grid_to_world_center(grid_loc: Vector2i) -> Vector2:
|
||||
return Vector2((grid_loc.x + 0.5) * GRID_SIZE, (grid_loc.y + 0.5) * GRID_SIZE)
|
||||
|
||||
func set_selected_tile(tile: Vector2i) -> void:
|
||||
world_grid.clear_layer(Constants.TilemapLayers.CURSOR)
|
||||
world_grid.set_cell(Constants.TilemapLayers.CURSOR, tile,0,Vector2i(0,7))
|
||||
@@ -33,3 +36,4 @@ func get_location_data(pos: Vector2i) -> CellData:
|
||||
|
||||
func change_location_resource(pos: Vector2i, data: GameResource) -> void:
|
||||
world_data[pos].change_resource(data)
|
||||
world_grid.set_cell(Constants.TilemapLayers.ENVIRONMENT, pos, 0, data.atlas_location)
|
||||
|
||||
Reference in New Issue
Block a user