Add cannons as characters instead
This commit is contained in:
parent
539982ef10
commit
0a87bce20d
24
World/Map.gd
24
World/Map.gd
|
@ -79,6 +79,28 @@ func parse_map_file(file_name):
|
|||
for ix in range(MapConfig.mapwidth):
|
||||
var letter_code = MapConfig.mapdata[iy * MapConfig.mapwidth + ix]
|
||||
if tile_dictionary.has(letter_code):
|
||||
match letter_code:
|
||||
# Cannon
|
||||
"c", "d", "r", "f":
|
||||
var cannon = preload("res://World/cannon.tscn").instantiate()
|
||||
cannon.position = 64*Vector2i(ix, iy) + Vector2i(32, 32)
|
||||
match letter_code:
|
||||
"c":
|
||||
cannon.rotation_degrees = 180
|
||||
"d":
|
||||
cannon.rotation_degrees = 270
|
||||
"r":
|
||||
cannon.rotation_degrees = 0
|
||||
"f":
|
||||
cannon.rotation_degrees = 90
|
||||
if MapConfig.edgewrap:
|
||||
if ix < MapConfig.mapwidth / 2:
|
||||
cannon.position.x += 64*MapConfig.mapwidth
|
||||
if iy < MapConfig.mapheight / 2:
|
||||
cannon.position.y += 64*MapConfig.mapheight
|
||||
$"../Cannons".add_child(cannon, true)
|
||||
|
||||
_:
|
||||
set_cell(0, Vector2i(ix, iy), 0, tile_dictionary[letter_code])
|
||||
if "_0123456789".contains(letter_code):
|
||||
base_positions.push_back(Vector2i(ix, iy))
|
||||
|
@ -104,3 +126,5 @@ func apply_options():
|
|||
else:
|
||||
if $"../Map boundaries".is_connected("body_exited", $".."._on_map_boundaries_body_exited):
|
||||
$"../Map boundaries".disconnect("body_exited", $".."._on_map_boundaries_body_exited)
|
||||
|
||||
# Engine.physics_ticks_per_second = MapConfig.framespersecond
|
||||
|
|
|
@ -178,7 +178,13 @@ shape = SubResource("RectangleShape2D_hjo0t")
|
|||
|
||||
[node name="Players" type="Node2D" parent="."]
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
[node name="PlayerSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("res://World/PlayerShip.tscn")
|
||||
spawn_path = NodePath("../Players")
|
||||
spawn_limit = 4
|
||||
|
||||
[node name="Cannons" type="Node2D" parent="."]
|
||||
|
||||
[node name="CannonSpawner" type="MultiplayerSpawner" parent="."]
|
||||
_spawnable_scenes = PackedStringArray("res://World/cannon.tscn")
|
||||
spawn_path = NodePath("../Cannons")
|
||||
|
|
Loading…
Reference in New Issue