blob: f622716369cbcab6e36763d58055dfb595eb9eb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
extends Stage
func _ready() -> void:
$Player.camera.limit_left = get_world_boundaries()[Vector2.LEFT]
$Player.camera.limit_right = get_world_boundaries()[Vector2.RIGHT]
$Player.camera.limit_top = get_world_boundaries()[Vector2.UP]
$Player.camera.limit_bottom = get_world_boundaries()[Vector2.DOWN]
$TileMapLayer.modulate = Color(max(0.1, randf()), max(0.1, randf()), max(0.1, randf()))
set_mobile_controls()
func get_world_boundaries() -> Dictionary:
return {
Vector2.LEFT: $TileMapLayer.get_used_rect().position.x * $TileMapLayer.tile_set.tile_size.x,
Vector2.RIGHT: $TileMapLayer.get_used_rect().end.x * $TileMapLayer.tile_set.tile_size.x,
Vector2.UP: $TileMapLayer.get_used_rect().position.y * $TileMapLayer.tile_set.tile_size.y - $HUD.size.y,
Vector2.DOWN: $TileMapLayer.get_used_rect().end.y * $TileMapLayer.tile_set.tile_size.y,
}
func has_win_condition() -> bool:
return %Opponents.get_child_count() == 0
|