Fixed names for a better traceability of code errors with orignal code lesson. End of lesson 25. Player is moving on the map viewport!
This commit is contained in:
21
scripts/game/maps/Map2d.gd
Normal file
21
scripts/game/maps/Map2d.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends Map
|
||||
|
||||
class_name Map2d
|
||||
|
||||
enum TerrainDataTypes { TerrainType }
|
||||
|
||||
func getTerrainDataForTile(layer, data, x, y):
|
||||
var tile:TileData = get_cell_tile_data(layer, Vector2i(x, y))
|
||||
|
||||
if (tile != null):
|
||||
return tile.get_custom_data(TerrainDataTypes.keys()[data])
|
||||
else:
|
||||
return null
|
||||
|
||||
|
||||
func spawnPlayerAtPosition(position, facing):
|
||||
player = load("res://scenes/game/maps/entities/player.tscn").instantiate()
|
||||
|
||||
super.spawnPlayerAtPosition(position, facing)
|
||||
|
||||
return player
|
||||
Reference in New Issue
Block a user