generated from krampus/template-godot4
way too many changes; multiplayer version, like, 0.6 or 0.7
Some checks failed
linting & formatting / build (push) Failing after 24s
Some checks failed
linting & formatting / build (push) Failing after 24s
This commit is contained in:
parent
ddd2fed714
commit
a9352d337d
BIN
assets/ui_buttons/button UI.png
(Stored with Git LFS)
Normal file
BIN
assets/ui_buttons/button UI.png
(Stored with Git LFS)
Normal file
Binary file not shown.
40
assets/ui_buttons/button UI.png.import
Normal file
40
assets/ui_buttons/button UI.png.import
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dalonthk63q26"
|
||||||
|
path="res://.godot/imported/button UI.png-3eed35efdb4062b809cd0c3862f90e91.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/ui_buttons/button UI.png"
|
||||||
|
dest_files=["res://.godot/imported/button UI.png-3eed35efdb4062b809cd0c3862f90e91.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
67
game.gd
67
game.gd
@ -1,67 +0,0 @@
|
|||||||
class_name Game extends Node
|
|
||||||
|
|
||||||
const DOWN_SPAWN_SCENE = preload("uid://d4ltd1geg7s2p")
|
|
||||||
|
|
||||||
var turn: int = 0:
|
|
||||||
set(value):
|
|
||||||
turn = value
|
|
||||||
controls.set_turn(turn)
|
|
||||||
var player: Player
|
|
||||||
var citizen_count: int = 0:
|
|
||||||
set(value):
|
|
||||||
print(value)
|
|
||||||
citizen_count = value
|
|
||||||
if citizen_count == 0:
|
|
||||||
handle_turn_over()
|
|
||||||
|
|
||||||
var spawn_placement_actions = 0
|
|
||||||
|
|
||||||
@onready var board: Board = %Board
|
|
||||||
@onready var controls: Controls = %Controls
|
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
|
||||||
Globals.game = self
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
player = Player.new()
|
|
||||||
controls.set_players([player])
|
|
||||||
start_turn()
|
|
||||||
|
|
||||||
|
|
||||||
func start_turn() -> void:
|
|
||||||
turn += 1
|
|
||||||
if spawn_placement_actions > 0:
|
|
||||||
board.set_active_tile(DOWN_SPAWN_SCENE.instantiate())
|
|
||||||
|
|
||||||
|
|
||||||
func select_tile(tile: Tile):
|
|
||||||
board.set_active_tile(tile)
|
|
||||||
|
|
||||||
|
|
||||||
func select_building(building: Building) -> void:
|
|
||||||
if building is Home:
|
|
||||||
board.set_active_building(building, player)
|
|
||||||
else:
|
|
||||||
board.set_active_building(building)
|
|
||||||
|
|
||||||
|
|
||||||
func place_walls() -> void:
|
|
||||||
board.is_placing_walls = !board.is_placing_walls
|
|
||||||
|
|
||||||
|
|
||||||
func handle_turn_over() -> void:
|
|
||||||
get_tree().call_group("PostTurnActions", "handle_post_turn_actions")
|
|
||||||
controls.reset_turn()
|
|
||||||
start_turn()
|
|
||||||
|
|
||||||
|
|
||||||
func queue_spawn_placement(num: int) -> void:
|
|
||||||
spawn_placement_actions += num
|
|
||||||
|
|
||||||
|
|
||||||
func handle_spawn_placed() -> void:
|
|
||||||
spawn_placement_actions = maxi(spawn_placement_actions - 1, 0)
|
|
||||||
if spawn_placement_actions > 0:
|
|
||||||
board.set_active_tile(DOWN_SPAWN_SCENE.instantiate())
|
|
||||||
@ -1 +0,0 @@
|
|||||||
uid://p10j5v8tlyb
|
|
||||||
82
game.tscn
82
game.tscn
@ -1,82 +0,0 @@
|
|||||||
[gd_scene format=3 uid="uid://fbdci3d048m7"]
|
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://ct6tclctgdrkm" path="res://prefabs/board.tscn" id="1_e2o6t"]
|
|
||||||
[ext_resource type="Script" uid="uid://p10j5v8tlyb" path="res://game.gd" id="1_fc0e3"]
|
|
||||||
[ext_resource type="Script" uid="uid://c5vwubjdr23jr" path="res://prefabs/game_camera.gd" id="1_feb5d"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://caq4f3l237i42" path="res://prefabs/ui/controls.tscn" id="4_fc0e3"]
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fc0e3"]
|
|
||||||
content_margin_left = 10.0
|
|
||||||
content_margin_top = 10.0
|
|
||||||
content_margin_right = 10.0
|
|
||||||
content_margin_bottom = 10.0
|
|
||||||
bg_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_7jktm"]
|
|
||||||
bg_color = Color(0, 0, 0, 1)
|
|
||||||
corner_radius_top_left = 16
|
|
||||||
corner_radius_top_right = 16
|
|
||||||
corner_radius_bottom_right = 16
|
|
||||||
corner_radius_bottom_left = 16
|
|
||||||
|
|
||||||
[node name="Game" type="Node" unique_id=384379479]
|
|
||||||
script = ExtResource("1_fc0e3")
|
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="." unique_id=161820979]
|
|
||||||
layout_mode = 3
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1771672320]
|
|
||||||
layout_mode = 1
|
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_fc0e3")
|
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Control/PanelContainer" unique_id=761660879]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Controls" parent="Control/PanelContainer/VBoxContainer" unique_id=1719205711 instance=ExtResource("4_fc0e3")]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
custom_minimum_size = Vector2(0, 50)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 4
|
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="Control/PanelContainer/VBoxContainer" unique_id=1428657222]
|
|
||||||
process_mode = 3
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 3
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7jktm")
|
|
||||||
|
|
||||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="Control/PanelContainer/VBoxContainer/PanelContainer" unique_id=444978634]
|
|
||||||
process_mode = 3
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 3
|
|
||||||
stretch = true
|
|
||||||
mouse_target = true
|
|
||||||
|
|
||||||
[node name="SubViewport" type="SubViewport" parent="Control/PanelContainer/VBoxContainer/PanelContainer/SubViewportContainer" unique_id=1761859829]
|
|
||||||
process_mode = 3
|
|
||||||
disable_3d = true
|
|
||||||
transparent_bg = true
|
|
||||||
handle_input_locally = false
|
|
||||||
physics_object_picking = true
|
|
||||||
size = Vector2i(1132, 574)
|
|
||||||
render_target_update_mode = 4
|
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="Control/PanelContainer/VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=296841783]
|
|
||||||
anchor_mode = 0
|
|
||||||
zoom = Vector2(0.94, 0.94)
|
|
||||||
position_smoothing_enabled = true
|
|
||||||
drag_horizontal_enabled = true
|
|
||||||
drag_vertical_enabled = true
|
|
||||||
script = ExtResource("1_feb5d")
|
|
||||||
|
|
||||||
[node name="Board" parent="Control/PanelContainer/VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=752933545 instance=ExtResource("1_e2o6t")]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
234
prefabs/board.gd
234
prefabs/board.gd
@ -1,124 +1,102 @@
|
|||||||
class_name Board extends Node2D
|
class_name Board extends Node2D
|
||||||
|
|
||||||
|
signal board_state_changed
|
||||||
|
|
||||||
enum Direction { NONE, UP, DOWN, LEFT, RIGHT }
|
enum Direction { NONE, UP, DOWN, LEFT, RIGHT }
|
||||||
|
|
||||||
|
const GROUND = preload("uid://c5y5ksmwhevd")
|
||||||
|
const UP_SPAWN = preload("uid://6ywvgci44ttv")
|
||||||
|
const RIGHT_SPAWN = preload("uid://c1y3s7daosghf")
|
||||||
|
const DOWN_SPAWN = preload("uid://d4ltd1geg7s2p")
|
||||||
|
const LEFT_SPAWN = preload("uid://noi2ko4hceus")
|
||||||
|
|
||||||
|
var tiles: Dictionary[Vector2i, Tile] = {}
|
||||||
var buildings: Dictionary[Vector2i, Building] = {}
|
var buildings: Dictionary[Vector2i, Building] = {}
|
||||||
var active_building: Building
|
var active_building: Building
|
||||||
var active_tile_id: int = -1
|
var active_tile: Tile
|
||||||
var current_map_coord: Vector2i
|
var current_map_coord: Vector2i
|
||||||
var prev_map_coord: Vector2i
|
var prev_map_coord: Vector2i
|
||||||
var is_placing_walls: bool = false:
|
var is_controlling_camera: bool = false
|
||||||
set(value):
|
|
||||||
is_placing_walls = value
|
|
||||||
if !is_placing_walls:
|
|
||||||
_clear_wall_preview()
|
|
||||||
var current_wall_direction: Direction = Direction.DOWN
|
|
||||||
var real_wall_coords: Array[Vector2i] = []
|
|
||||||
|
|
||||||
@onready var tile_map: SceneTileMapLayer = %Tiles
|
@onready var tile_map: TileMapLayer = %Tiles
|
||||||
@onready var tile_preview_map: SceneTileMapLayer = %TilesPreview
|
@onready var board_state: Node2D = %BoardState
|
||||||
@onready var wall_map: SceneTileMapLayer = %Walls
|
|
||||||
@onready var wall_preview_map: SceneTileMapLayer = %WallPreviews
|
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("camera_engage"):
|
||||||
|
is_controlling_camera = true
|
||||||
|
return
|
||||||
|
if event.is_action_released("camera_engage"):
|
||||||
|
is_controlling_camera = false
|
||||||
|
if is_controlling_camera:
|
||||||
|
return
|
||||||
|
#if Globals.board_game.current_board_state.current_player != Globals.game.this_player:
|
||||||
|
#return
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
current_map_coord = tile_map.local_to_map(tile_map.get_local_mouse_position())
|
current_map_coord = tile_map.local_to_map(tile_map.get_local_mouse_position())
|
||||||
_place_wall_preview()
|
if active_tile != null:
|
||||||
_place_tile_preview()
|
active_tile.position = tile_map.map_to_local(current_map_coord)
|
||||||
if active_building != null:
|
if active_building != null:
|
||||||
active_building.position = tile_map.map_to_local(current_map_coord)
|
active_building.position = tile_map.map_to_local(current_map_coord)
|
||||||
prev_map_coord = current_map_coord
|
prev_map_coord = current_map_coord
|
||||||
if event.is_action_pressed("select"):
|
if event.is_action_pressed("select"):
|
||||||
if is_placing_walls:
|
if active_tile != null:
|
||||||
_place_wall(current_map_coord, current_wall_direction)
|
place_active_tile()
|
||||||
match current_wall_direction:
|
|
||||||
Direction.UP:
|
|
||||||
_place_wall(current_map_coord + Vector2i.UP, Direction.DOWN)
|
|
||||||
Direction.DOWN:
|
|
||||||
_place_wall(current_map_coord + Vector2i.DOWN, Direction.UP)
|
|
||||||
Direction.LEFT:
|
|
||||||
_place_wall(current_map_coord + Vector2i.LEFT, Direction.RIGHT)
|
|
||||||
Direction.RIGHT:
|
|
||||||
_place_wall(current_map_coord + Vector2i.RIGHT, Direction.LEFT)
|
|
||||||
elif active_tile_id != -1:
|
|
||||||
tile_preview_map.set_cell(current_map_coord)
|
|
||||||
tile_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
|
||||||
if active_tile_id >= 7 and active_tile_id <= 10:
|
|
||||||
active_tile_id = -1
|
|
||||||
Globals.game.handle_spawn_placed()
|
|
||||||
else:
|
|
||||||
active_tile_id = -1
|
|
||||||
elif active_building != null:
|
elif active_building != null:
|
||||||
active_building.starting_coord = current_map_coord
|
place_active_building()
|
||||||
for coord in active_building.get_tile_coords():
|
|
||||||
buildings[coord] = active_building
|
|
||||||
active_building.position = tile_map.map_to_local(current_map_coord)
|
|
||||||
active_building.modulate = Color(1, 1, 1, 1)
|
|
||||||
active_building.is_placing = false
|
|
||||||
active_building = null
|
|
||||||
if event.is_action_pressed("rotate_wall_up") and is_placing_walls:
|
|
||||||
current_wall_direction = get_next_direction(current_wall_direction)
|
|
||||||
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
|
||||||
if is_instance_valid(wall_preview):
|
|
||||||
wall_preview.set_wall(current_wall_direction)
|
|
||||||
elif event.is_action_pressed("rotate_wall_down") and is_placing_walls:
|
|
||||||
current_wall_direction = get_previous_direction(current_wall_direction)
|
|
||||||
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
|
||||||
if is_instance_valid(wall_preview):
|
|
||||||
wall_preview.set_wall(current_wall_direction)
|
|
||||||
_handle_building_rotation(event)
|
_handle_building_rotation(event)
|
||||||
_handle_spawn_rotation(event)
|
#_handle_spawn_rotation(event)
|
||||||
|
|
||||||
|
|
||||||
func set_active_tile(tile: Tile) -> void:
|
func set_active_tile(tile: Tile) -> void:
|
||||||
active_tile_id = tile_map.tile_set.get_tile_id(tile)
|
active_tile = tile
|
||||||
if active_tile_id != -1:
|
board_state.add_child(active_tile)
|
||||||
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
active_tile.modulate = Color(1, 1, 1, 0.5)
|
||||||
|
active_tile.is_placing = true
|
||||||
|
|
||||||
|
|
||||||
func set_active_building(building: Building, player: Player = null) -> void:
|
func set_active_building(building: Building) -> void:
|
||||||
active_building = building.duplicate()
|
active_building = building
|
||||||
add_child(active_building)
|
board_state.add_child(active_building)
|
||||||
active_building.is_placing = true
|
if active_building is Home:
|
||||||
|
active_building.player = Globals.board_game.current_board_state.current_player
|
||||||
active_building.modulate = Color(1, 1, 1, 0.5)
|
active_building.modulate = Color(1, 1, 1, 0.5)
|
||||||
if player != null:
|
active_building.is_placing = true
|
||||||
active_building.player = player
|
|
||||||
|
|
||||||
|
|
||||||
func _place_wall(wall_coord: Vector2i, wall_direction: Direction) -> void:
|
func place_active_tile() -> void:
|
||||||
var current_wall = wall_map.get_cell_scene(wall_coord)
|
if tiles.has(current_map_coord) and tiles[current_map_coord] is Ground:
|
||||||
if is_instance_valid(current_wall):
|
tiles[current_map_coord].queue_free()
|
||||||
current_wall.add_wall(wall_direction)
|
tiles.erase(current_map_coord)
|
||||||
else:
|
if !tiles.has(current_map_coord) and !buildings.has(current_map_coord):
|
||||||
var wall_preview = wall_map.get_cell_scene(wall_coord)
|
Globals.board_game.current_board_state.players[0].money -= active_tile.cost
|
||||||
if is_instance_valid(wall_preview):
|
active_tile.modulate = Color(1, 1, 1, 1)
|
||||||
wall_preview.set_wall(wall_direction)
|
active_tile.coords = current_map_coord
|
||||||
|
tiles[current_map_coord] = active_tile
|
||||||
|
active_tile = null
|
||||||
|
board_state_changed.emit()
|
||||||
|
|
||||||
|
|
||||||
func _place_wall_preview() -> void:
|
func place_active_building() -> void:
|
||||||
if is_placing_walls:
|
active_building.starting_coord = current_map_coord
|
||||||
if prev_map_coord != current_map_coord:
|
if active_building is Home:
|
||||||
var previous_preview = wall_preview_map.get_cell_scene(prev_map_coord)
|
active_building.player = Globals.board_game.current_board_state.current_player
|
||||||
if is_instance_valid(previous_preview):
|
for coord in active_building.get_tile_coords():
|
||||||
previous_preview.set_wall(Direction.NONE)
|
if tiles.has(coord) and !(tiles[coord] is Ground):
|
||||||
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
return
|
||||||
if is_instance_valid(wall_preview):
|
if buildings.has(coord):
|
||||||
wall_preview.set_wall(current_wall_direction)
|
return
|
||||||
|
for surr_coord in tile_map.get_surrounding_cells(coord):
|
||||||
|
if buildings.has(surr_coord):
|
||||||
func _clear_wall_preview() -> void:
|
return
|
||||||
wall_preview_map.get_cell_scene(prev_map_coord).set_wall(Direction.NONE)
|
Globals.board_game.current_board_state.players[0].money -= active_building.cost
|
||||||
wall_preview_map.get_cell_scene(current_map_coord).set_wall(Direction.NONE)
|
active_building.modulate = Color(1, 1, 1, 1)
|
||||||
|
for coord in active_building.get_tile_coords():
|
||||||
|
buildings[coord] = active_building
|
||||||
func _place_tile_preview() -> void:
|
tiles[coord].queue_free()
|
||||||
if active_tile_id != -1:
|
tiles.erase(coord)
|
||||||
if prev_map_coord != current_map_coord:
|
active_building = null
|
||||||
var prev_preview_tile_id = tile_preview_map.get_cell_alternative_tile(prev_map_coord)
|
board_state_changed.emit()
|
||||||
if prev_preview_tile_id != -1:
|
|
||||||
tile_preview_map.set_cell(prev_map_coord)
|
|
||||||
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
|
||||||
|
|
||||||
|
|
||||||
func _handle_building_rotation(event: InputEvent) -> void:
|
func _handle_building_rotation(event: InputEvent) -> void:
|
||||||
@ -132,19 +110,67 @@ func _handle_building_rotation(event: InputEvent) -> void:
|
|||||||
active_building.tile_rotation = get_previous_direction(active_building.tile_rotation)
|
active_building.tile_rotation = get_previous_direction(active_building.tile_rotation)
|
||||||
|
|
||||||
|
|
||||||
func _handle_spawn_rotation(event: InputEvent) -> void:
|
func reset() -> void:
|
||||||
if active_tile_id < 7 or active_tile_id > 10:
|
for child in board_state.get_children():
|
||||||
return
|
child.queue_free()
|
||||||
if event.is_action_pressed("rotate_tile_up"):
|
|
||||||
active_tile_id += 1
|
|
||||||
if active_tile_id > 10:
|
func set_board_state(bs: BoardState) -> void:
|
||||||
active_tile_id = 7
|
for tile in bs.tiles:
|
||||||
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
board_state.add_child(tile)
|
||||||
elif event.is_action_pressed("rotate_tile_down"):
|
tiles[tile.coords] = tile
|
||||||
active_tile_id -= 1
|
tile.position = tile_map.map_to_local(tile.coords)
|
||||||
if active_tile_id < 7:
|
for building in bs.buildings:
|
||||||
active_tile_id = 10
|
board_state.add_child(building)
|
||||||
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
for coord in building.get_tile_coords():
|
||||||
|
buildings[coord] = building
|
||||||
|
building.position = tile_map.map_to_local(building.starting_coord)
|
||||||
|
building.rotation_degrees += 90 * building.get_rotation_count()
|
||||||
|
|
||||||
|
|
||||||
|
func initialize() -> void:
|
||||||
|
var max_x: int = 0
|
||||||
|
var max_y: int = 0
|
||||||
|
for i in range(Globals.game.players.size()):
|
||||||
|
var random_spawn = Vector2i(randi_range(0, 9), randi_range(0, 9))
|
||||||
|
for x in range(10):
|
||||||
|
for y in range(10):
|
||||||
|
var coord = Vector2i(x, y)
|
||||||
|
if i == 1:
|
||||||
|
coord.x += 10
|
||||||
|
if i == 2:
|
||||||
|
coord.y += 10
|
||||||
|
if i == 3:
|
||||||
|
coord += Vector2i(10, 10)
|
||||||
|
max_x = coord.x
|
||||||
|
max_y = coord.y
|
||||||
|
if x == random_spawn.x and y == random_spawn.y:
|
||||||
|
var possible_spawns = [UP_SPAWN, RIGHT_SPAWN, DOWN_SPAWN, LEFT_SPAWN]
|
||||||
|
if random_spawn.x == 9:
|
||||||
|
possible_spawns.erase(RIGHT_SPAWN)
|
||||||
|
elif random_spawn.x == 0:
|
||||||
|
possible_spawns.erase(LEFT_SPAWN)
|
||||||
|
if random_spawn.y == 9:
|
||||||
|
possible_spawns.erase(DOWN_SPAWN)
|
||||||
|
elif random_spawn.y == 0:
|
||||||
|
possible_spawns.erase(UP_SPAWN)
|
||||||
|
var spawn: Tile = possible_spawns.pick_random().instantiate()
|
||||||
|
board_state.add_child(spawn)
|
||||||
|
spawn.coords = coord
|
||||||
|
spawn.position = tile_map.map_to_local(coord)
|
||||||
|
tiles[coord] = spawn
|
||||||
|
else:
|
||||||
|
var ground: Tile = GROUND.instantiate()
|
||||||
|
board_state.add_child(ground)
|
||||||
|
ground.coords = coord
|
||||||
|
ground.position = tile_map.map_to_local(coord)
|
||||||
|
tiles[coord] = ground
|
||||||
|
#var extra_spawn_coord := Vector2i(randi_range(1, max_x - 1), randi_range(1, max_y - 1))
|
||||||
|
#var extra_spawn = [UP_SPAWN, RIGHT_SPAWN, DOWN_SPAWN, LEFT_SPAWN].pick_random().instantiate()
|
||||||
|
#board_state.add_child(extra_spawn)
|
||||||
|
#extra_spawn.coords = extra_spawn_coord
|
||||||
|
#extra_spawn.position = tile_map.map_to_local(extra_spawn_coord)
|
||||||
|
#tiles[extra_spawn_coord] = extra_spawn
|
||||||
|
|
||||||
|
|
||||||
static func get_next_direction(direction: Direction, count: int = 1) -> Direction:
|
static func get_next_direction(direction: Direction, count: int = 1) -> Direction:
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
[gd_scene format=4 uid="uid://ct6tclctgdrkm"]
|
[gd_scene format=3 uid="uid://ct6tclctgdrkm"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://co23vrpegtru5" path="res://prefabs/board.gd" id="1_p0ybc"]
|
[ext_resource type="Script" uid="uid://co23vrpegtru5" path="res://prefabs/board.gd" id="1_p0ybc"]
|
||||||
[ext_resource type="Script" uid="uid://t838aqnm6t4" path="res://prefabs/tiles/scene_tile_set.gd" id="2_1v70o"]
|
[ext_resource type="Script" uid="uid://t838aqnm6t4" path="res://prefabs/tiles/scene_tile_set.gd" id="2_1v70o"]
|
||||||
@ -8,10 +8,8 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="5_o7qh5"]
|
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="5_o7qh5"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ce25rk1nl0pqn" path="res://prefabs/tiles/turns/right_turn.tscn" id="6_3lgej"]
|
[ext_resource type="PackedScene" uid="uid://ce25rk1nl0pqn" path="res://prefabs/tiles/turns/right_turn.tscn" id="6_3lgej"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cisd4grq8kxqn" path="res://prefabs/tiles/turns/up_turn.tscn" id="7_yen83"]
|
[ext_resource type="PackedScene" uid="uid://cisd4grq8kxqn" path="res://prefabs/tiles/turns/up_turn.tscn" id="7_yen83"]
|
||||||
[ext_resource type="PackedScene" uid="uid://woxamn2574q" path="res://prefabs/tiles/walls.tscn" id="9_3lgej"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://d4ltd1geg7s2p" path="res://prefabs/tiles/spawns/down_spawn.tscn" id="9_u033i"]
|
[ext_resource type="PackedScene" uid="uid://d4ltd1geg7s2p" path="res://prefabs/tiles/spawns/down_spawn.tscn" id="9_u033i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://noi2ko4hceus" path="res://prefabs/tiles/spawns/left_spawn.tscn" id="10_58ym1"]
|
[ext_resource type="PackedScene" uid="uid://noi2ko4hceus" path="res://prefabs/tiles/spawns/left_spawn.tscn" id="10_58ym1"]
|
||||||
[ext_resource type="Script" uid="uid://cgu06uwnsod7u" path="res://prefabs/scene_tile_map_layer.gd" id="10_yen83"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c1y3s7daosghf" path="res://prefabs/tiles/spawns/right_spawn.tscn" id="11_cxwd1"]
|
[ext_resource type="PackedScene" uid="uid://c1y3s7daosghf" path="res://prefabs/tiles/spawns/right_spawn.tscn" id="11_cxwd1"]
|
||||||
|
|
||||||
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_o7qh5"]
|
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_o7qh5"]
|
||||||
@ -31,20 +29,6 @@ sources/0 = SubResource("TileSetScenesCollectionSource_o7qh5")
|
|||||||
script = ExtResource("2_1v70o")
|
script = ExtResource("2_1v70o")
|
||||||
metadata/_custom_type_script = "uid://t838aqnm6t4"
|
metadata/_custom_type_script = "uid://t838aqnm6t4"
|
||||||
|
|
||||||
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_wi6i1"]
|
|
||||||
scenes/1/scene = ExtResource("9_3lgej")
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_6l02p"]
|
|
||||||
tile_size = Vector2i(110, 110)
|
|
||||||
sources/0 = SubResource("TileSetScenesCollectionSource_wi6i1")
|
|
||||||
|
|
||||||
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_yen83"]
|
|
||||||
scenes/1/scene = ExtResource("9_3lgej")
|
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_wi6i1"]
|
|
||||||
tile_size = Vector2i(110, 110)
|
|
||||||
sources/0 = SubResource("TileSetScenesCollectionSource_yen83")
|
|
||||||
|
|
||||||
[node name="Board" type="Node2D" unique_id=752933545]
|
[node name="Board" type="Node2D" unique_id=752933545]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_p0ybc")
|
script = ExtResource("1_p0ybc")
|
||||||
@ -52,111 +36,7 @@ script = ExtResource("1_p0ybc")
|
|||||||
[node name="Tiles" type="TileMapLayer" parent="." unique_id=1799727608]
|
[node name="Tiles" type="TileMapLayer" parent="." unique_id=1799727608]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
tile_map_data = PackedByteArray("AAAAAAEAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAQAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAAAAAAAAAAAAQACAAAAAAAAAAAABwADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQACAAIAAAAAAAAAAQACAAEAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAQAAAAAAAAAAQAEAAQAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAFAAQAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAAAAAAAAAAAAQAGAAAAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAUAAAAAAAAAAQA=")
|
|
||||||
tile_set = SubResource("TileSet_87tqm")
|
tile_set = SubResource("TileSet_87tqm")
|
||||||
script = ExtResource("10_yen83")
|
|
||||||
|
|
||||||
[node name="TilesPreview" type="TileMapLayer" parent="." unique_id=34888141]
|
[node name="BoardState" type="Node2D" parent="." unique_id=1744934972]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 3
|
|
||||||
modulate = Color(1, 1, 1, 0.5)
|
|
||||||
tile_set = SubResource("TileSet_87tqm")
|
|
||||||
script = ExtResource("10_yen83")
|
|
||||||
|
|
||||||
[node name="Walls" type="TileMapLayer" parent="." unique_id=2075701520]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
|
||||||
tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAAAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAQAAAAAAAAAAQACAAAAAAAAAAAAAQACAAEAAAAAAAAAAQACAAIAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQADAAQAAAAAAAAAAQAEAAAAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAQAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAGAAUAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAAAAAAAAAAAAQAFAAAAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAQAAAAAAAAAAQA=")
|
|
||||||
tile_set = SubResource("TileSet_6l02p")
|
|
||||||
script = ExtResource("10_yen83")
|
|
||||||
|
|
||||||
[node name="WallPreviews" type="TileMapLayer" parent="." unique_id=1643053787]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
|
||||||
modulate = Color(1, 1, 1, 0.5)
|
|
||||||
tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAAAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAQAAAAAAAAAAQACAAAAAAAAAAAAAQACAAEAAAAAAAAAAQACAAIAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQADAAQAAAAAAAAAAQAEAAAAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAQAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQAGAAAAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAFAAAAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAQAAAAAAAAAAQA=")
|
|
||||||
tile_set = SubResource("TileSet_wi6i1")
|
|
||||||
script = ExtResource("10_yen83")
|
|
||||||
|
|
||||||
[connection signal="mouse_entered" from="Tiles/Ground" to="Tiles/Ground" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/Ground" to="Tiles/Ground" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521340" to="Tiles/@TextureRect@521340" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521340" to="Tiles/@TextureRect@521340" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521341" to="Tiles/@TextureRect@521341" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521341" to="Tiles/@TextureRect@521341" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521342" to="Tiles/@TextureRect@521342" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521342" to="Tiles/@TextureRect@521342" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521343" to="Tiles/@TextureRect@521343" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521343" to="Tiles/@TextureRect@521343" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521344" to="Tiles/@TextureRect@521344" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521344" to="Tiles/@TextureRect@521344" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521345" to="Tiles/@TextureRect@521345" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521345" to="Tiles/@TextureRect@521345" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521346" to="Tiles/@TextureRect@521346" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521346" to="Tiles/@TextureRect@521346" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521347" to="Tiles/@TextureRect@521347" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521347" to="Tiles/@TextureRect@521347" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521348" to="Tiles/@TextureRect@521348" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521348" to="Tiles/@TextureRect@521348" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521349" to="Tiles/@TextureRect@521349" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521349" to="Tiles/@TextureRect@521349" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521350" to="Tiles/@TextureRect@521350" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521350" to="Tiles/@TextureRect@521350" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521351" to="Tiles/@TextureRect@521351" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521351" to="Tiles/@TextureRect@521351" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521352" to="Tiles/@TextureRect@521352" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521352" to="Tiles/@TextureRect@521352" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521353" to="Tiles/@TextureRect@521353" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521353" to="Tiles/@TextureRect@521353" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521354" to="Tiles/@TextureRect@521354" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521354" to="Tiles/@TextureRect@521354" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521355" to="Tiles/@TextureRect@521355" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521355" to="Tiles/@TextureRect@521355" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521356" to="Tiles/@TextureRect@521356" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521356" to="Tiles/@TextureRect@521356" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521357" to="Tiles/@TextureRect@521357" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521357" to="Tiles/@TextureRect@521357" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521358" to="Tiles/@TextureRect@521358" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521358" to="Tiles/@TextureRect@521358" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521359" to="Tiles/@TextureRect@521359" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521359" to="Tiles/@TextureRect@521359" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521360" to="Tiles/@TextureRect@521360" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521360" to="Tiles/@TextureRect@521360" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521361" to="Tiles/@TextureRect@521361" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521361" to="Tiles/@TextureRect@521361" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521362" to="Tiles/@TextureRect@521362" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521362" to="Tiles/@TextureRect@521362" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521363" to="Tiles/@TextureRect@521363" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521363" to="Tiles/@TextureRect@521363" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521364" to="Tiles/@TextureRect@521364" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521364" to="Tiles/@TextureRect@521364" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521365" to="Tiles/@TextureRect@521365" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521365" to="Tiles/@TextureRect@521365" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521366" to="Tiles/@TextureRect@521366" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521366" to="Tiles/@TextureRect@521366" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521367" to="Tiles/@TextureRect@521367" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521367" to="Tiles/@TextureRect@521367" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521368" to="Tiles/@TextureRect@521368" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521368" to="Tiles/@TextureRect@521368" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521369" to="Tiles/@TextureRect@521369" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521369" to="Tiles/@TextureRect@521369" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521370" to="Tiles/@TextureRect@521370" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521370" to="Tiles/@TextureRect@521370" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521371" to="Tiles/@TextureRect@521371" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521371" to="Tiles/@TextureRect@521371" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521372" to="Tiles/@TextureRect@521372" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521372" to="Tiles/@TextureRect@521372" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521373" to="Tiles/@TextureRect@521373" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521373" to="Tiles/@TextureRect@521373" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521374" to="Tiles/@TextureRect@521374" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521374" to="Tiles/@TextureRect@521374" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521375" to="Tiles/@TextureRect@521375" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521375" to="Tiles/@TextureRect@521375" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521376" to="Tiles/@TextureRect@521376" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521376" to="Tiles/@TextureRect@521376" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521377" to="Tiles/@TextureRect@521377" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521377" to="Tiles/@TextureRect@521377" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521378" to="Tiles/@TextureRect@521378" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521378" to="Tiles/@TextureRect@521378" method="handle_ground_mouse_exited"]
|
|
||||||
[connection signal="mouse_entered" from="Tiles/@TextureRect@521379" to="Tiles/@TextureRect@521379" method="handle_ground_mouse_entered"]
|
|
||||||
[connection signal="mouse_exited" from="Tiles/@TextureRect@521379" to="Tiles/@TextureRect@521379" method="handle_ground_mouse_exited"]
|
|
||||||
|
|||||||
274
prefabs/board_old.gd
Normal file
274
prefabs/board_old.gd
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
class_name BoardOLD extends Node2D
|
||||||
|
|
||||||
|
enum Direction { NONE, UP, DOWN, LEFT, RIGHT }
|
||||||
|
|
||||||
|
var buildings: Dictionary[Vector2i, Building] = {}
|
||||||
|
var active_building_id: int = -1
|
||||||
|
var active_building: Building
|
||||||
|
var active_tile_id: int = -1
|
||||||
|
var current_map_coord: Vector2i
|
||||||
|
var prev_map_coord: Vector2i
|
||||||
|
var is_placing_walls: bool = false:
|
||||||
|
set(value):
|
||||||
|
is_placing_walls = value
|
||||||
|
if !is_placing_walls:
|
||||||
|
_clear_wall_preview()
|
||||||
|
var current_wall_direction: Direction = Direction.DOWN
|
||||||
|
var real_wall_coords: Array[Vector2i] = []
|
||||||
|
var is_controlling_camera: bool = false
|
||||||
|
|
||||||
|
@onready var tile_map: SceneTileMapLayer = %Tiles
|
||||||
|
@onready var tile_preview_map: TileMapLayer = %TilesPreview
|
||||||
|
@onready var wall_map: SceneTileMapLayer = %Walls
|
||||||
|
@onready var wall_preview_map: SceneTileMapLayer = %WallPreviews
|
||||||
|
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("camera_engage"):
|
||||||
|
is_controlling_camera = true
|
||||||
|
return
|
||||||
|
if event.is_action_released("camera_engage"):
|
||||||
|
is_controlling_camera = false
|
||||||
|
if is_controlling_camera:
|
||||||
|
return
|
||||||
|
if Globals.board_game.current_player.id != Globals.game.this_player.id:
|
||||||
|
return
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
current_map_coord = tile_map.local_to_map(tile_map.get_local_mouse_position())
|
||||||
|
_place_wall_preview()
|
||||||
|
_place_tile_preview()
|
||||||
|
if active_building != null:
|
||||||
|
active_building.position = tile_map.map_to_local(current_map_coord)
|
||||||
|
prev_map_coord = current_map_coord
|
||||||
|
if event.is_action_pressed("select"):
|
||||||
|
if is_placing_walls:
|
||||||
|
_place_wall(current_map_coord, current_wall_direction)
|
||||||
|
match current_wall_direction:
|
||||||
|
Direction.UP:
|
||||||
|
_place_wall(current_map_coord + Vector2i.UP, Direction.DOWN)
|
||||||
|
Direction.DOWN:
|
||||||
|
_place_wall(current_map_coord + Vector2i.DOWN, Direction.UP)
|
||||||
|
Direction.LEFT:
|
||||||
|
_place_wall(current_map_coord + Vector2i.LEFT, Direction.RIGHT)
|
||||||
|
Direction.RIGHT:
|
||||||
|
_place_wall(current_map_coord + Vector2i.RIGHT, Direction.LEFT)
|
||||||
|
elif active_tile_id != -1:
|
||||||
|
place_active_tile.rpc(current_map_coord, active_tile_id)
|
||||||
|
active_tile_id = -1
|
||||||
|
elif active_building != null:
|
||||||
|
place_active_building.rpc(current_map_coord, active_building_id)
|
||||||
|
active_building = null
|
||||||
|
if event.is_action_pressed("rotate_wall_up") and is_placing_walls:
|
||||||
|
current_wall_direction = get_next_direction(current_wall_direction)
|
||||||
|
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
||||||
|
if is_instance_valid(wall_preview):
|
||||||
|
wall_preview.set_wall(current_wall_direction)
|
||||||
|
elif event.is_action_pressed("rotate_wall_down") and is_placing_walls:
|
||||||
|
current_wall_direction = get_previous_direction(current_wall_direction)
|
||||||
|
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
||||||
|
if is_instance_valid(wall_preview):
|
||||||
|
wall_preview.set_wall(current_wall_direction)
|
||||||
|
_handle_building_rotation(event)
|
||||||
|
_handle_spawn_rotation(event)
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func place_active_building(coords: Vector2i, building_id: int) -> void:
|
||||||
|
var building = Globals.board_game.building_id_array[building_id].duplicate()
|
||||||
|
add_child(building)
|
||||||
|
if building is Home:
|
||||||
|
building.player = Globals.board_game.current_player
|
||||||
|
building.starting_coord = coords
|
||||||
|
for coord in building.get_tile_coords():
|
||||||
|
buildings[coord] = building
|
||||||
|
building.position = tile_map.map_to_local(coords)
|
||||||
|
building.modulate = Color(1, 1, 1, 1)
|
||||||
|
building.is_placing = false
|
||||||
|
if active_building != null:
|
||||||
|
Globals.game.add_player_money(Globals.board_game.current_player.id, -active_building.cost)
|
||||||
|
if building is Home:
|
||||||
|
print("here")
|
||||||
|
Globals.board_game.place_home()
|
||||||
|
if is_instance_valid(active_building):
|
||||||
|
active_building.queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func place_active_tile(coords: Vector2i, tile_id: int) -> void:
|
||||||
|
tile_preview_map.set_cell(coords)
|
||||||
|
tile_map.set_cell(coords)
|
||||||
|
await tile_map.child_exiting_tree
|
||||||
|
tile_map.set_cell(coords, 0, Vector2i.ZERO, tile_id)
|
||||||
|
if tile_id >= 7 and tile_id <= 10:
|
||||||
|
Globals.board_game.handle_spawn_placed()
|
||||||
|
|
||||||
|
|
||||||
|
func set_active_tile(tile: Tile) -> void:
|
||||||
|
active_tile_id = tile_map.tile_set.get_tile_id(tile)
|
||||||
|
if active_tile_id != -1:
|
||||||
|
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func set_active_building(building: Building, player: Player = null) -> void:
|
||||||
|
active_building_id = Globals.board_game.get_id_for_building(building)
|
||||||
|
active_building = building
|
||||||
|
add_child(active_building)
|
||||||
|
active_building.is_placing = true
|
||||||
|
active_building.modulate = Color(1, 1, 1, 0.5)
|
||||||
|
if building is Home:
|
||||||
|
active_building.player = player
|
||||||
|
|
||||||
|
|
||||||
|
func _place_wall(wall_coord: Vector2i, wall_direction: Direction) -> void:
|
||||||
|
var current_wall = wall_map.get_cell_scene(wall_coord)
|
||||||
|
if is_instance_valid(current_wall):
|
||||||
|
current_wall.add_wall(wall_direction)
|
||||||
|
else:
|
||||||
|
var wall_preview = wall_map.get_cell_scene(wall_coord)
|
||||||
|
if is_instance_valid(wall_preview):
|
||||||
|
wall_preview.set_wall(wall_direction)
|
||||||
|
|
||||||
|
|
||||||
|
func _place_wall_preview() -> void:
|
||||||
|
if is_placing_walls:
|
||||||
|
if prev_map_coord != current_map_coord:
|
||||||
|
var previous_preview = wall_preview_map.get_cell_scene(prev_map_coord)
|
||||||
|
if is_instance_valid(previous_preview):
|
||||||
|
previous_preview.set_wall(Direction.NONE)
|
||||||
|
var wall_preview = wall_preview_map.get_cell_scene(current_map_coord)
|
||||||
|
if is_instance_valid(wall_preview):
|
||||||
|
wall_preview.set_wall(current_wall_direction)
|
||||||
|
|
||||||
|
|
||||||
|
func _clear_wall_preview() -> void:
|
||||||
|
wall_preview_map.get_cell_scene(prev_map_coord).set_wall(Direction.NONE)
|
||||||
|
wall_preview_map.get_cell_scene(current_map_coord).set_wall(Direction.NONE)
|
||||||
|
|
||||||
|
|
||||||
|
func _place_tile_preview() -> void:
|
||||||
|
if active_tile_id != -1:
|
||||||
|
if prev_map_coord != current_map_coord:
|
||||||
|
var prev_preview_tile_id = tile_preview_map.get_cell_alternative_tile(prev_map_coord)
|
||||||
|
if prev_preview_tile_id != -1:
|
||||||
|
tile_preview_map.set_cell(prev_map_coord)
|
||||||
|
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_building_rotation(event: InputEvent) -> void:
|
||||||
|
if active_building == null:
|
||||||
|
return
|
||||||
|
if event.is_action_pressed("rotate_tile_up"):
|
||||||
|
active_building.rotation_degrees += 90
|
||||||
|
active_building.tile_rotation = get_next_direction(active_building.tile_rotation)
|
||||||
|
elif event.is_action_pressed("rotate_tile_down"):
|
||||||
|
active_building.rotation_degrees -= 90
|
||||||
|
active_building.tile_rotation = get_previous_direction(active_building.tile_rotation)
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_spawn_rotation(event: InputEvent) -> void:
|
||||||
|
if active_tile_id < 7 or active_tile_id > 10:
|
||||||
|
return
|
||||||
|
if event.is_action_pressed("rotate_tile_up"):
|
||||||
|
active_tile_id += 1
|
||||||
|
if active_tile_id > 10:
|
||||||
|
active_tile_id = 7
|
||||||
|
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
||||||
|
elif event.is_action_pressed("rotate_tile_down"):
|
||||||
|
active_tile_id -= 1
|
||||||
|
if active_tile_id < 7:
|
||||||
|
active_tile_id = 10
|
||||||
|
tile_preview_map.set_cell(current_map_coord, 0, Vector2i.ZERO, active_tile_id)
|
||||||
|
|
||||||
|
|
||||||
|
func initialize() -> void:
|
||||||
|
for i in range(Globals.game.players.size()):
|
||||||
|
var random_spawn = Vector2i(randi_range(0, 9), randi_range(0, 9))
|
||||||
|
for x in range(10):
|
||||||
|
for y in range(10):
|
||||||
|
var coord = Vector2i(x, y)
|
||||||
|
if i == 1:
|
||||||
|
coord.x += 10
|
||||||
|
if i == 2:
|
||||||
|
coord.y += 10
|
||||||
|
if i == 3:
|
||||||
|
coord += Vector2i(10, 10)
|
||||||
|
tile_map.set_cell(coord)
|
||||||
|
if x == random_spawn.x and y == random_spawn.y:
|
||||||
|
var possible_spawns = [7, 8, 9, 10]
|
||||||
|
if random_spawn.x == 9:
|
||||||
|
possible_spawns.erase(9)
|
||||||
|
elif random_spawn.x == 0:
|
||||||
|
possible_spawns.erase(8)
|
||||||
|
if random_spawn.y == 9:
|
||||||
|
possible_spawns.erase(7)
|
||||||
|
elif random_spawn.y == 0:
|
||||||
|
possible_spawns.erase(10)
|
||||||
|
tile_map.set_cell(coord, 0, Vector2i.ZERO, possible_spawns.pick_random())
|
||||||
|
else:
|
||||||
|
tile_map.set_cell(coord, 0, Vector2i.ZERO, 1)
|
||||||
|
var extra_spawn_coord := Vector2i(
|
||||||
|
randi_range(1, tile_map.get_used_rect().size.x - 1),
|
||||||
|
randi_range(1, tile_map.get_used_rect().size.y - 1)
|
||||||
|
)
|
||||||
|
tile_map.set_cell(extra_spawn_coord, 0, Vector2i.ZERO, randi_range(7, 10))
|
||||||
|
|
||||||
|
|
||||||
|
static func get_next_direction(direction: Direction, count: int = 1) -> Direction:
|
||||||
|
var result := direction
|
||||||
|
if count == 0:
|
||||||
|
return result
|
||||||
|
match direction:
|
||||||
|
Direction.UP:
|
||||||
|
result = Direction.RIGHT
|
||||||
|
Direction.RIGHT:
|
||||||
|
result = Direction.DOWN
|
||||||
|
Direction.DOWN:
|
||||||
|
result = Direction.LEFT
|
||||||
|
Direction.LEFT:
|
||||||
|
result = Direction.UP
|
||||||
|
if count == 1:
|
||||||
|
return result
|
||||||
|
return get_next_direction(result, count - 1)
|
||||||
|
|
||||||
|
|
||||||
|
static func get_previous_direction(direction: Direction) -> Direction:
|
||||||
|
match direction:
|
||||||
|
Direction.UP:
|
||||||
|
return Direction.LEFT
|
||||||
|
Direction.RIGHT:
|
||||||
|
return Direction.UP
|
||||||
|
Direction.DOWN:
|
||||||
|
return Direction.RIGHT
|
||||||
|
Direction.LEFT:
|
||||||
|
return Direction.DOWN
|
||||||
|
_:
|
||||||
|
return direction
|
||||||
|
|
||||||
|
|
||||||
|
static func get_direction_vector(direction: Direction) -> Vector2i:
|
||||||
|
match direction:
|
||||||
|
Direction.UP:
|
||||||
|
return Vector2i.UP
|
||||||
|
Direction.RIGHT:
|
||||||
|
return Vector2i.RIGHT
|
||||||
|
Direction.DOWN:
|
||||||
|
return Vector2i.DOWN
|
||||||
|
Direction.LEFT:
|
||||||
|
return Vector2i.LEFT
|
||||||
|
_:
|
||||||
|
return Vector2i.ZERO
|
||||||
|
|
||||||
|
#func generate() -> void:
|
||||||
|
#for child in get_children():
|
||||||
|
#child.queue_free()
|
||||||
|
#for x in range(width):
|
||||||
|
#for y in range(height):
|
||||||
|
#var tile: Control
|
||||||
|
#if x == 1 and y == 1:
|
||||||
|
#tile = spawn_scene.instantiate()
|
||||||
|
#else:
|
||||||
|
#tile = ground_scene.instantiate()
|
||||||
|
#add_child(tile)
|
||||||
|
#tile.position = get_coordinate(x, y)
|
||||||
|
#tile.owner = self
|
||||||
1
prefabs/board_old.gd.uid
Normal file
1
prefabs/board_old.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://cj1lvlyx2wc10
|
||||||
161
prefabs/board_old.tscn
Normal file
161
prefabs/board_old.tscn
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
[gd_scene format=4 uid="uid://ccrv2sslslv7e"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cj1lvlyx2wc10" path="res://prefabs/board_old.gd" id="1_s1yg0"]
|
||||||
|
[ext_resource type="Script" uid="uid://t838aqnm6t4" path="res://prefabs/tiles/scene_tile_set.gd" id="2_ephv2"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c5y5ksmwhevd" path="res://prefabs/tiles/ground.tscn" id="3_6cxcw"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://6ywvgci44ttv" path="res://prefabs/tiles/spawns/up_spawn.tscn" id="4_hjct4"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://2qudi2d82y73" path="res://prefabs/tiles/turns/down_turn.tscn" id="5_353j6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="6_y0m14"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ce25rk1nl0pqn" path="res://prefabs/tiles/turns/right_turn.tscn" id="7_p8oxp"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cisd4grq8kxqn" path="res://prefabs/tiles/turns/up_turn.tscn" id="8_wac32"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://d4ltd1geg7s2p" path="res://prefabs/tiles/spawns/down_spawn.tscn" id="9_a4q0p"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://noi2ko4hceus" path="res://prefabs/tiles/spawns/left_spawn.tscn" id="10_qfwpr"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c1y3s7daosghf" path="res://prefabs/tiles/spawns/right_spawn.tscn" id="11_w7tfe"]
|
||||||
|
[ext_resource type="Script" uid="uid://cgu06uwnsod7u" path="res://prefabs/scene_tile_map_layer.gd" id="12_38qs2"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://woxamn2574q" path="res://prefabs/tiles/walls.tscn" id="13_en8er"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_o7qh5"]
|
||||||
|
scenes/1/scene = ExtResource("3_6cxcw")
|
||||||
|
scenes/3/scene = ExtResource("5_353j6")
|
||||||
|
scenes/4/scene = ExtResource("6_y0m14")
|
||||||
|
scenes/5/scene = ExtResource("7_p8oxp")
|
||||||
|
scenes/6/scene = ExtResource("8_wac32")
|
||||||
|
scenes/7/scene = ExtResource("9_a4q0p")
|
||||||
|
scenes/8/scene = ExtResource("10_qfwpr")
|
||||||
|
scenes/9/scene = ExtResource("11_w7tfe")
|
||||||
|
scenes/10/scene = ExtResource("4_hjct4")
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_87tqm"]
|
||||||
|
tile_size = Vector2i(110, 110)
|
||||||
|
sources/0 = SubResource("TileSetScenesCollectionSource_o7qh5")
|
||||||
|
script = ExtResource("2_ephv2")
|
||||||
|
metadata/_custom_type_script = "uid://t838aqnm6t4"
|
||||||
|
|
||||||
|
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_wi6i1"]
|
||||||
|
scenes/1/scene = ExtResource("13_en8er")
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_6l02p"]
|
||||||
|
tile_size = Vector2i(110, 110)
|
||||||
|
sources/0 = SubResource("TileSetScenesCollectionSource_wi6i1")
|
||||||
|
|
||||||
|
[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_yen83"]
|
||||||
|
scenes/1/scene = ExtResource("13_en8er")
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_wi6i1"]
|
||||||
|
tile_size = Vector2i(110, 110)
|
||||||
|
sources/0 = SubResource("TileSetScenesCollectionSource_yen83")
|
||||||
|
|
||||||
|
[node name="Board" type="Node2D" unique_id=752933545]
|
||||||
|
process_mode = 3
|
||||||
|
script = ExtResource("1_s1yg0")
|
||||||
|
|
||||||
|
[node name="Tiles" type="TileMapLayer" parent="." unique_id=1799727608]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
tile_map_data = PackedByteArray("AAAAAAEAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAQAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAAAAAAAAAAAAQACAAAAAAAAAAAABwADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQACAAIAAAAAAAAAAQACAAEAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAQAAAAAAAAAAQAEAAQAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAAAAAAAAAAAAQAAAAAAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAFAAQAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAAAAAAAAAAAAQAGAAAAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAUAAAAAAAAAAQA=")
|
||||||
|
tile_set = SubResource("TileSet_87tqm")
|
||||||
|
script = ExtResource("12_38qs2")
|
||||||
|
|
||||||
|
[node name="TilesPreview" type="TileMapLayer" parent="." unique_id=34888141]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
modulate = Color(1, 1, 1, 0.5)
|
||||||
|
tile_set = SubResource("TileSet_87tqm")
|
||||||
|
|
||||||
|
[node name="Walls" type="TileMapLayer" parent="." unique_id=2075701520]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAAAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAQAAAAAAAAAAQACAAAAAAAAAAAAAQACAAEAAAAAAAAAAQACAAIAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQADAAQAAAAAAAAAAQAEAAAAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAQAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAGAAUAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAAAAAAAAAAAAQAFAAAAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAQAAAAAAAAAAQA=")
|
||||||
|
tile_set = SubResource("TileSet_6l02p")
|
||||||
|
script = ExtResource("12_38qs2")
|
||||||
|
|
||||||
|
[node name="WallPreviews" type="TileMapLayer" parent="." unique_id=1643053787]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
modulate = Color(1, 1, 1, 0.5)
|
||||||
|
tile_map_data = PackedByteArray("AAAAAAAAAAAAAAAAAQAAAAEAAAAAAAAAAQAAAAIAAAAAAAAAAQAAAAMAAAAAAAAAAQAAAAQAAAAAAAAAAQABAAAAAAAAAAAAAQABAAEAAAAAAAAAAQABAAIAAAAAAAAAAQABAAMAAAAAAAAAAQABAAQAAAAAAAAAAQACAAAAAAAAAAAAAQACAAEAAAAAAAAAAQACAAIAAAAAAAAAAQACAAMAAAAAAAAAAQACAAQAAAAAAAAAAQADAAAAAAAAAAAAAQADAAEAAAAAAAAAAQADAAIAAAAAAAAAAQADAAMAAAAAAAAAAQADAAQAAAAAAAAAAQAEAAAAAAAAAAAAAQAEAAEAAAAAAAAAAQAEAAIAAAAAAAAAAQAEAAMAAAAAAAAAAQAEAAQAAAAAAAAAAQAAAAUAAAAAAAAAAQABAAUAAAAAAAAAAQACAAUAAAAAAAAAAQAGAAAAAAAAAAAAAQAGAAEAAAAAAAAAAQAGAAIAAAAAAAAAAQAGAAMAAAAAAAAAAQAGAAQAAAAAAAAAAQAGAAUAAAAAAAAAAQADAAUAAAAAAAAAAQAEAAUAAAAAAAAAAQAFAAUAAAAAAAAAAQAFAAAAAAAAAAAAAQAFAAEAAAAAAAAAAQAFAAIAAAAAAAAAAQAFAAMAAAAAAAAAAQAFAAQAAAAAAAAAAQA=")
|
||||||
|
tile_set = SubResource("TileSet_wi6i1")
|
||||||
|
script = ExtResource("12_38qs2")
|
||||||
|
|
||||||
|
[connection signal="mouse_entered" from="Tiles/Ground" to="Tiles/Ground" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/Ground" to="Tiles/Ground" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136203" to="Tiles/@TextureRect@136203" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136203" to="Tiles/@TextureRect@136203" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136204" to="Tiles/@TextureRect@136204" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136204" to="Tiles/@TextureRect@136204" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136205" to="Tiles/@TextureRect@136205" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136205" to="Tiles/@TextureRect@136205" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136206" to="Tiles/@TextureRect@136206" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136206" to="Tiles/@TextureRect@136206" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136207" to="Tiles/@TextureRect@136207" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136207" to="Tiles/@TextureRect@136207" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136208" to="Tiles/@TextureRect@136208" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136208" to="Tiles/@TextureRect@136208" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136209" to="Tiles/@TextureRect@136209" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136209" to="Tiles/@TextureRect@136209" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136210" to="Tiles/@TextureRect@136210" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136210" to="Tiles/@TextureRect@136210" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136211" to="Tiles/@TextureRect@136211" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136211" to="Tiles/@TextureRect@136211" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136212" to="Tiles/@TextureRect@136212" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136212" to="Tiles/@TextureRect@136212" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136213" to="Tiles/@TextureRect@136213" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136213" to="Tiles/@TextureRect@136213" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136214" to="Tiles/@TextureRect@136214" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136214" to="Tiles/@TextureRect@136214" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136215" to="Tiles/@TextureRect@136215" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136215" to="Tiles/@TextureRect@136215" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136216" to="Tiles/@TextureRect@136216" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136216" to="Tiles/@TextureRect@136216" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136217" to="Tiles/@TextureRect@136217" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136217" to="Tiles/@TextureRect@136217" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136218" to="Tiles/@TextureRect@136218" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136218" to="Tiles/@TextureRect@136218" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136219" to="Tiles/@TextureRect@136219" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136219" to="Tiles/@TextureRect@136219" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136220" to="Tiles/@TextureRect@136220" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136220" to="Tiles/@TextureRect@136220" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136221" to="Tiles/@TextureRect@136221" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136221" to="Tiles/@TextureRect@136221" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136222" to="Tiles/@TextureRect@136222" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136222" to="Tiles/@TextureRect@136222" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136223" to="Tiles/@TextureRect@136223" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136223" to="Tiles/@TextureRect@136223" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136224" to="Tiles/@TextureRect@136224" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136224" to="Tiles/@TextureRect@136224" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136225" to="Tiles/@TextureRect@136225" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136225" to="Tiles/@TextureRect@136225" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136226" to="Tiles/@TextureRect@136226" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136226" to="Tiles/@TextureRect@136226" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136227" to="Tiles/@TextureRect@136227" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136227" to="Tiles/@TextureRect@136227" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136228" to="Tiles/@TextureRect@136228" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136228" to="Tiles/@TextureRect@136228" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136229" to="Tiles/@TextureRect@136229" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136229" to="Tiles/@TextureRect@136229" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136230" to="Tiles/@TextureRect@136230" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136230" to="Tiles/@TextureRect@136230" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136231" to="Tiles/@TextureRect@136231" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136231" to="Tiles/@TextureRect@136231" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136232" to="Tiles/@TextureRect@136232" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136232" to="Tiles/@TextureRect@136232" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136233" to="Tiles/@TextureRect@136233" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136233" to="Tiles/@TextureRect@136233" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136234" to="Tiles/@TextureRect@136234" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136234" to="Tiles/@TextureRect@136234" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136235" to="Tiles/@TextureRect@136235" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136235" to="Tiles/@TextureRect@136235" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136236" to="Tiles/@TextureRect@136236" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136236" to="Tiles/@TextureRect@136236" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136237" to="Tiles/@TextureRect@136237" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136237" to="Tiles/@TextureRect@136237" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136238" to="Tiles/@TextureRect@136238" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136238" to="Tiles/@TextureRect@136238" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136239" to="Tiles/@TextureRect@136239" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136239" to="Tiles/@TextureRect@136239" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136240" to="Tiles/@TextureRect@136240" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136240" to="Tiles/@TextureRect@136240" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136241" to="Tiles/@TextureRect@136241" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136241" to="Tiles/@TextureRect@136241" method="handle_ground_mouse_exited"]
|
||||||
|
[connection signal="mouse_entered" from="Tiles/@TextureRect@136242" to="Tiles/@TextureRect@136242" method="handle_ground_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="Tiles/@TextureRect@136242" to="Tiles/@TextureRect@136242" method="handle_ground_mouse_exited"]
|
||||||
@ -23,7 +23,6 @@ var paused: bool:
|
|||||||
animated_sprite.play()
|
animated_sprite.play()
|
||||||
|
|
||||||
var speed: float = 50
|
var speed: float = 50
|
||||||
var board: Board
|
|
||||||
var current_tile_coords: Vector2i
|
var current_tile_coords: Vector2i
|
||||||
var direction_queue: Array[Board.Direction] = []
|
var direction_queue: Array[Board.Direction] = []
|
||||||
var money: int = 0
|
var money: int = 0
|
||||||
@ -41,7 +40,7 @@ var _statuses: Array[Status] = []
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Globals.game.citizen_count += 1
|
Globals.board_game.citizen_count += 1
|
||||||
|
|
||||||
|
|
||||||
func pause() -> void:
|
func pause() -> void:
|
||||||
@ -120,14 +119,10 @@ func _physics_process(delta: float) -> void:
|
|||||||
#position = position.move_toward(position + Vector2.LEFT, speed * delta)
|
#position = position.move_toward(position + Vector2.LEFT, speed * delta)
|
||||||
motion = Vector2.LEFT * speed * delta
|
motion = Vector2.LEFT * speed * delta
|
||||||
move_and_collide(motion)
|
move_and_collide(motion)
|
||||||
var tile_map_coords := board.tile_map.local_to_map(animated_sprite.global_position)
|
|
||||||
if board.tile_map.get_cell_alternative_tile(tile_map_coords) == -1:
|
|
||||||
if !board.buildings.has(tile_map_coords):
|
|
||||||
direction = Board.Direction.NONE
|
|
||||||
|
|
||||||
|
|
||||||
func idle() -> void:
|
func idle() -> void:
|
||||||
Globals.game.citizen_count -= 1
|
Globals.board_game.citizen_count -= 1
|
||||||
animated_sprite.play("idle")
|
animated_sprite.play("idle")
|
||||||
|
|
||||||
|
|
||||||
@ -145,11 +140,11 @@ func walk() -> void:
|
|||||||
animated_sprite.play("walk_right")
|
animated_sprite.play("walk_right")
|
||||||
|
|
||||||
|
|
||||||
func check_for_wall() -> void:
|
#func check_for_wall() -> void:
|
||||||
var tile_walls = board.wall_map.get_cell_scene(current_tile_coords).walls
|
#var tile_walls = board.wall_map.get_cell_scene(current_tile_coords).walls
|
||||||
if tile_walls.has(direction):
|
#if tile_walls.has(direction):
|
||||||
direction = Board.get_next_direction(direction)
|
#direction = Board.get_next_direction(direction)
|
||||||
check_for_wall()
|
#check_for_wall()
|
||||||
|
|
||||||
|
|
||||||
func check_for_turn(tile: Tile) -> void:
|
func check_for_turn(tile: Tile) -> void:
|
||||||
@ -161,32 +156,45 @@ func check_for_turn(tile: Tile) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func check_for_building() -> void:
|
func check_for_building() -> void:
|
||||||
if board.buildings.has(current_tile_coords + Board.get_direction_vector(direction)):
|
if Globals.board_game.board.buildings.has(
|
||||||
var building = board.buildings[current_tile_coords + Board.get_direction_vector(direction)]
|
current_tile_coords + Board.get_direction_vector(direction)
|
||||||
|
):
|
||||||
|
var building = Globals.board_game.board.buildings[
|
||||||
|
current_tile_coords + Board.get_direction_vector(direction)
|
||||||
|
]
|
||||||
if !building.can_citizen_enter(current_tile_coords, direction):
|
if !building.can_citizen_enter(current_tile_coords, direction):
|
||||||
direction = Board.get_next_direction(direction)
|
direction = Board.get_next_direction(direction)
|
||||||
check_for_building()
|
check_for_building()
|
||||||
|
|
||||||
|
|
||||||
func handle_tile_area_entered(area: Area2D):
|
func handle_tile_area_exited(_area: Area2D):
|
||||||
var tile = area.get_parent()
|
if is_queued_for_deletion():
|
||||||
current_tile_coords = board.tile_map.local_to_map(area.global_position)
|
return
|
||||||
|
current_tile_coords = Globals.board_game.board.tile_map.local_to_map(tile_area.global_position)
|
||||||
|
if (
|
||||||
|
!Globals.board_game.board.tiles.has(current_tile_coords)
|
||||||
|
and !Globals.board_game.board.buildings.has(current_tile_coords)
|
||||||
|
):
|
||||||
|
if direction != Board.Direction.NONE:
|
||||||
|
direction = Board.Direction.NONE
|
||||||
|
return
|
||||||
if !direction_queue.is_empty():
|
if !direction_queue.is_empty():
|
||||||
direction = direction_queue.pop_front()
|
direction = direction_queue.pop_front()
|
||||||
elif tile is Building:
|
elif Globals.board_game.board.buildings.has(current_tile_coords):
|
||||||
if !buildings_visited.has(tile):
|
var building = Globals.board_game.board.buildings[current_tile_coords]
|
||||||
buildings_visited.set(tile, 0)
|
if !buildings_visited.has(building):
|
||||||
buildings_visited[tile as Building] += 1
|
buildings_visited.set(building, 0)
|
||||||
tile.activate(self)
|
buildings_visited[building] += 1
|
||||||
direction_queue = tile.get_direction_queue(self)
|
building.activate(self)
|
||||||
|
direction_queue = building.get_direction_queue(self)
|
||||||
direction = direction_queue.pop_front()
|
direction = direction_queue.pop_front()
|
||||||
else:
|
elif Globals.board_game.board.tiles.has(current_tile_coords):
|
||||||
|
var tile = Globals.board_game.board.tiles[current_tile_coords]
|
||||||
if !tiles_visited.has(tile):
|
if !tiles_visited.has(tile):
|
||||||
tiles_visited.set(tile, 0)
|
tiles_visited.set(tile, 0)
|
||||||
tiles_visited[tile as Tile] += 1
|
tiles_visited[tile as Tile] += 1
|
||||||
check_for_building()
|
check_for_building()
|
||||||
check_for_turn(tile)
|
check_for_turn(tile)
|
||||||
check_for_wall()
|
|
||||||
if (
|
if (
|
||||||
buildings_visited.values().any(func(v: int): return v > 3)
|
buildings_visited.values().any(func(v: int): return v > 3)
|
||||||
or tiles_visited.values().any(func(v: int): return v > 3)
|
or tiles_visited.values().any(func(v: int): return v > 3)
|
||||||
|
|||||||
@ -161,7 +161,7 @@ animations = [{
|
|||||||
size = Vector2(18, 18)
|
size = Vector2(18, 18)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f20g1"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_f20g1"]
|
||||||
size = Vector2(2, 2)
|
size = Vector2(108, 108)
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_f20g1"]
|
[sub_resource type="LabelSettings" id="LabelSettings_f20g1"]
|
||||||
font_color = Color(0, 1, 0, 1)
|
font_color = Color(0, 1, 0, 1)
|
||||||
@ -173,7 +173,6 @@ process_mode = 1
|
|||||||
z_index = 2
|
z_index = 2
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
collision_layer = 4
|
collision_layer = 4
|
||||||
collision_mask = 3
|
|
||||||
script = ExtResource("1_noc4a")
|
script = ExtResource("1_noc4a")
|
||||||
|
|
||||||
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="." unique_id=53044239]
|
[node name="AnimatedSprite" type="AnimatedSprite2D" parent="." unique_id=53044239]
|
||||||
@ -189,7 +188,6 @@ shape = SubResource("RectangleShape2D_noc4a")
|
|||||||
[node name="TileArea" type="Area2D" parent="." unique_id=1604684578]
|
[node name="TileArea" type="Area2D" parent="." unique_id=1604684578]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 4
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TileArea" unique_id=1001840681]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="TileArea" unique_id=1001840681]
|
||||||
shape = SubResource("RectangleShape2D_f20g1")
|
shape = SubResource("RectangleShape2D_f20g1")
|
||||||
@ -222,4 +220,4 @@ offset_right = 26.0
|
|||||||
offset_bottom = 5.0
|
offset_bottom = 5.0
|
||||||
theme_override_constants/separation = 1
|
theme_override_constants/separation = 1
|
||||||
|
|
||||||
[connection signal="area_entered" from="TileArea" to="." method="handle_tile_area_entered"]
|
[connection signal="area_exited" from="TileArea" to="." method="handle_tile_area_exited"]
|
||||||
|
|||||||
@ -1,20 +1,29 @@
|
|||||||
extends Camera2D
|
extends Camera2D
|
||||||
|
|
||||||
|
var is_controlling_camera: bool = false
|
||||||
var is_dragging: bool = false
|
var is_dragging: bool = false
|
||||||
|
|
||||||
#func _input(event: InputEvent) -> void:
|
|
||||||
#if event.is_action_pressed("camera_drag"):
|
func _input(event: InputEvent) -> void:
|
||||||
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
if event.is_action_pressed("camera_engage"):
|
||||||
#is_dragging = true
|
is_controlling_camera = true
|
||||||
#elif event.is_action_released("camera_drag"):
|
elif event.is_action_released("camera_engage"):
|
||||||
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
is_controlling_camera = false
|
||||||
#is_dragging = false
|
return
|
||||||
#
|
if !is_controlling_camera:
|
||||||
#if event.is_action_pressed("zoom_in"):
|
return
|
||||||
#zoom *= Vector2(1.25, 1.25)
|
if event.is_action_pressed("camera_drag"):
|
||||||
#elif event.is_action_pressed("zoom_out"):
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
#zoom *= Vector2(0.75, 0.75)
|
is_dragging = true
|
||||||
#
|
elif event.is_action_released("camera_drag"):
|
||||||
#if is_dragging:
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
#if event is InputEventMouseMotion:
|
is_dragging = false
|
||||||
#position = lerp(position, event.screen_velocity, 0.01)
|
|
||||||
|
if event.is_action_pressed("zoom_in"):
|
||||||
|
zoom *= Vector2(1.25, 1.25)
|
||||||
|
elif event.is_action_pressed("zoom_out"):
|
||||||
|
zoom *= Vector2(0.75, 0.75)
|
||||||
|
|
||||||
|
if is_dragging:
|
||||||
|
if event is InputEventMouseMotion:
|
||||||
|
position = lerp(position, event.screen_velocity, 0.01)
|
||||||
|
|||||||
@ -1 +1,35 @@
|
|||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
|
signal create_session(player: Player)
|
||||||
|
|
||||||
|
@onready var name_line_edit: LineEdit = %NameLineEdit
|
||||||
|
@onready var player_color: ColorPickerButton = %PlayerColor
|
||||||
|
@onready var create_session_button: Button = %CreateSession
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
player_color.color = Color(randf(), randf(), randf())
|
||||||
|
var picker := player_color.get_picker()
|
||||||
|
picker.picker_shape = ColorPicker.SHAPE_HSV_WHEEL
|
||||||
|
picker.sampler_visible = false
|
||||||
|
picker.edit_alpha = false
|
||||||
|
picker.edit_intensity = false
|
||||||
|
picker.color_modes_visible = false
|
||||||
|
picker.sliders_visible = false
|
||||||
|
picker.hex_visible = false
|
||||||
|
picker.presets_visible = false
|
||||||
|
picker.can_add_swatches = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_name_line_edit_text_changed(new_text: String) -> void:
|
||||||
|
if !new_text.is_empty():
|
||||||
|
create_session_button.disabled = false
|
||||||
|
else:
|
||||||
|
create_session_button.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_create_session_pressed():
|
||||||
|
var player = Player.new()
|
||||||
|
player.name = name_line_edit.text
|
||||||
|
player.color = player_color.color
|
||||||
|
create_session.emit(player)
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
[gd_scene format=3 uid="uid://b7rfnt0d4qoew"]
|
[gd_scene format=3 uid="uid://b7rfnt0d4qoew"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cee85aokdb5ts" path="res://prefabs/lobby/create_session.gd" id="1_58eib"]
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_tftiq"]
|
[sub_resource type="LabelSettings" id="LabelSettings_tftiq"]
|
||||||
font_size = 32
|
font_size = 32
|
||||||
|
|
||||||
@ -11,6 +13,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_constants/separation = 20
|
theme_override_constants/separation = 20
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
script = ExtResource("1_58eib")
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." unique_id=893154611]
|
[node name="Label" type="Label" parent="." unique_id=893154611]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -27,7 +30,8 @@ alignment = 1
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Player Name"
|
text = "Player Name"
|
||||||
|
|
||||||
[node name="LineEdit" type="LineEdit" parent="Name" unique_id=1835313745]
|
[node name="NameLineEdit" type="LineEdit" parent="Name" unique_id=1835313745]
|
||||||
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(250, 0)
|
custom_minimum_size = Vector2(250, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
@ -40,12 +44,18 @@ alignment = 1
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Player Color"
|
text = "Player Color"
|
||||||
|
|
||||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="Color" unique_id=1931635282]
|
[node name="PlayerColor" type="ColorPickerButton" parent="Color" unique_id=1931635282]
|
||||||
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(150, 0)
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="." unique_id=1053608712]
|
[node name="CreateSession" type="Button" parent="." unique_id=1053608712]
|
||||||
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(150, 0)
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
|
disabled = true
|
||||||
text = "Create Session"
|
text = "Create Session"
|
||||||
|
|
||||||
|
[connection signal="text_changed" from="Name/NameLineEdit" to="." method="_on_name_line_edit_text_changed"]
|
||||||
|
[connection signal="pressed" from="CreateSession" to="." method="_on_create_session_pressed"]
|
||||||
|
|||||||
43
prefabs/lobby/join_session.gd
Normal file
43
prefabs/lobby/join_session.gd
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
extends VBoxContainer
|
||||||
|
|
||||||
|
signal join_session(session_id: String, player: Player)
|
||||||
|
|
||||||
|
@onready var session_id_line_edit: LineEdit = %SessionIdLineEdit
|
||||||
|
@onready var name_line_edit: LineEdit = %NameLineEdit
|
||||||
|
@onready var player_color: ColorPickerButton = %PlayerColor
|
||||||
|
@onready var join_session_button: Button = %JoinSession
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
player_color.color = Color(randf(), randf(), randf())
|
||||||
|
var picker := player_color.get_picker()
|
||||||
|
picker.picker_shape = ColorPicker.SHAPE_HSV_WHEEL
|
||||||
|
picker.sampler_visible = false
|
||||||
|
picker.edit_alpha = false
|
||||||
|
picker.edit_intensity = false
|
||||||
|
picker.color_modes_visible = false
|
||||||
|
picker.sliders_visible = false
|
||||||
|
picker.hex_visible = false
|
||||||
|
picker.presets_visible = false
|
||||||
|
picker.can_add_swatches = false
|
||||||
|
|
||||||
|
|
||||||
|
func _on_session_id_line_edit_text_changed(new_text: String) -> void:
|
||||||
|
if !new_text.is_empty() and !name_line_edit.text.is_empty():
|
||||||
|
join_session_button.disabled = false
|
||||||
|
else:
|
||||||
|
join_session_button.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_name_line_edit_text_changed(new_text: String) -> void:
|
||||||
|
if !new_text.is_empty() and !session_id_line_edit.text.is_empty():
|
||||||
|
join_session_button.disabled = false
|
||||||
|
else:
|
||||||
|
join_session_button.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_join_session_pressed():
|
||||||
|
var player = Player.new()
|
||||||
|
player.name = name_line_edit.text
|
||||||
|
player.color = player_color.color
|
||||||
|
join_session.emit(session_id_line_edit.text, player)
|
||||||
1
prefabs/lobby/join_session.gd.uid
Normal file
1
prefabs/lobby/join_session.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://c3qxf3fy71710
|
||||||
75
prefabs/lobby/join_session.tscn
Normal file
75
prefabs/lobby/join_session.tscn
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
[gd_scene format=3 uid="uid://j3v0ad1b28il"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://c3qxf3fy71710" path="res://prefabs/lobby/join_session.gd" id="1_i3e7f"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_ir4al"]
|
||||||
|
font_size = 32
|
||||||
|
|
||||||
|
[node name="JoinSessionContainer" type="VBoxContainer" unique_id=1106179304]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
alignment = 1
|
||||||
|
script = ExtResource("1_i3e7f")
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="." unique_id=400290031]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Join Session"
|
||||||
|
label_settings = SubResource("LabelSettings_ir4al")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="Session" type="HBoxContainer" parent="." unique_id=1558660847]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Session" unique_id=266353272]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Session ID"
|
||||||
|
|
||||||
|
[node name="SessionIdLineEdit" type="LineEdit" parent="Session" unique_id=2058870951]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Name" type="HBoxContainer" parent="." unique_id=1040827513]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Name" unique_id=1431785707]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Player Name"
|
||||||
|
|
||||||
|
[node name="NameLineEdit" type="LineEdit" parent="Name" unique_id=660083812]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Color" type="HBoxContainer" parent="." unique_id=344337316]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Color" unique_id=593000274]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Player Color"
|
||||||
|
|
||||||
|
[node name="PlayerColor" type="ColorPickerButton" parent="Color" unique_id=1063590661]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="JoinSession" type="Button" parent="." unique_id=1644825806]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
disabled = true
|
||||||
|
text = "Join Session"
|
||||||
|
|
||||||
|
[connection signal="text_changed" from="Session/SessionIdLineEdit" to="." method="_on_session_id_line_edit_text_changed"]
|
||||||
|
[connection signal="text_changed" from="Name/NameLineEdit" to="." method="_on_name_line_edit_text_changed"]
|
||||||
|
[connection signal="pressed" from="JoinSession" to="." method="_on_join_session_pressed"]
|
||||||
@ -1,27 +1,79 @@
|
|||||||
extends Node
|
class_name Lobby extends VBoxContainer
|
||||||
|
|
||||||
@onready var session_label: Label = %SessionLabel
|
const PLAYER_ENTRY_SCENE = preload("uid://c1wn1ghkp12hb")
|
||||||
@onready var join_session_id: LineEdit = %JoinSessionId
|
|
||||||
@onready var tube_client: TubeClient = %TubeClient
|
@onready var session_id: LineEdit = %SessionId
|
||||||
@onready var chat_log: RichTextLabel = %ChatLabel
|
@onready var player_list: Container = %PlayerList
|
||||||
@onready var chat_text_input: LineEdit = %ChatTextInput
|
|
||||||
|
@onready var ready_button: Button = %ReadyButton
|
||||||
|
@onready var unready_button: Button = %UnreadyButton
|
||||||
|
|
||||||
|
@onready var message_line_edit: LineEdit = %MessageLineEdit
|
||||||
|
@onready var chat: RichTextLabel = %Chat
|
||||||
|
|
||||||
|
|
||||||
func handle_create_session():
|
func set_session_id(id: String) -> void:
|
||||||
tube_client.create_session()
|
session_id.text = id
|
||||||
session_label.text = tube_client.session_id
|
|
||||||
|
|
||||||
|
|
||||||
func handle_join_session():
|
#@rpc("any_peer", "call_local", "reliable")
|
||||||
tube_client.join_session(join_session_id.text)
|
#func update_chat(text):
|
||||||
session_label.text = tube_client.session_id
|
#chat_log.text += text + "\n"
|
||||||
|
|
||||||
|
|
||||||
func handle_chat_update(new_text):
|
#@rpc("any_peer", "call_local", "reliable")
|
||||||
update_chat.rpc(new_text)
|
func load_players(players: Array[Player]) -> void:
|
||||||
chat_text_input.text = ""
|
for child in player_list.get_children():
|
||||||
|
child.queue_free()
|
||||||
|
for player in players:
|
||||||
|
var player_entry: PlayerEntry = PLAYER_ENTRY_SCENE.instantiate()
|
||||||
|
player_list.add_child(player_entry)
|
||||||
|
player_entry.set_player(player)
|
||||||
|
|
||||||
|
|
||||||
@rpc("any_peer", "call_local", "reliable")
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
func update_chat(text):
|
func ready_player(player_data: Dictionary, is_ready: bool) -> void:
|
||||||
chat_log.text += text + "\n"
|
for pe: PlayerEntry in player_list.get_children():
|
||||||
|
if pe.player.id == player_data["id"]:
|
||||||
|
if is_ready:
|
||||||
|
pe.ready()
|
||||||
|
else:
|
||||||
|
pe.unready()
|
||||||
|
_check_for_game_start()
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func update_chat(message: String, player_data: Dictionary) -> void:
|
||||||
|
chat.push_color(player_data["color"])
|
||||||
|
chat.add_text("%s: " % player_data["name"])
|
||||||
|
chat.push_color(Color.WHITE)
|
||||||
|
chat.add_text("%s\n" % message)
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func start_game() -> void:
|
||||||
|
Globals.game.start_game()
|
||||||
|
|
||||||
|
|
||||||
|
func _check_for_game_start() -> void:
|
||||||
|
for pe: PlayerEntry in player_list.get_children():
|
||||||
|
if !pe.is_ready:
|
||||||
|
return
|
||||||
|
start_game()
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_message_submitted() -> void:
|
||||||
|
update_chat.rpc(message_line_edit.text, Globals.game.this_player.serialize())
|
||||||
|
message_line_edit.text = ""
|
||||||
|
|
||||||
|
|
||||||
|
func _on_ready_button_pressed():
|
||||||
|
ready_button.hide()
|
||||||
|
unready_button.show()
|
||||||
|
ready_player.rpc(Globals.game.this_player.serialize(), true)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_unready_button_pressed():
|
||||||
|
ready_button.show()
|
||||||
|
unready_button.hide()
|
||||||
|
ready_player.rpc(Globals.game.this_player.serialize(), false)
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
uid://ccycmp8aj70fe
|
uid://lko2kbbcgy0u
|
||||||
|
|||||||
@ -1,102 +1,117 @@
|
|||||||
[gd_scene format=3 uid="uid://dpuwsqorot65h"]
|
[gd_scene format=3 uid="uid://cfci3j2ur3g31"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ccycmp8aj70fe" path="res://prefabs/lobby/lobby.gd" id="1_2wvic"]
|
[ext_resource type="Script" uid="uid://lko2kbbcgy0u" path="res://prefabs/lobby/lobby.gd" id="1_2wvic"]
|
||||||
[ext_resource type="Script" uid="uid://cy006uvidc4y" path="res://addons/tube/tube_client.gd" id="2_tftiq"]
|
|
||||||
[ext_resource type="Script" uid="uid://t4pe7yqc3pnt" path="res://addons/tube/tube_context.gd" id="3_1gg6n"]
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_x4164"]
|
[sub_resource type="LabelSettings" id="LabelSettings_47oqe"]
|
||||||
script = ExtResource("3_1gg6n")
|
font_size = 24
|
||||||
app_id = "g^o#isR0W!x|+?8"
|
|
||||||
trackers_urls = Array[String](["wss://tracker.openwebtorrent.com", "wss://tracker.files.fm:7073/announce", "wss://tracker.btorrent.xyz/", "wss://tracker.ghostchu-services.top:443/announce"])
|
|
||||||
stun_servers_urls = Array[String](["stun:stun.l.google.com:19302", "stun:stun.cloudflare.com:3478", "stun:stun.bethesda.net:3478"])
|
|
||||||
metadata/_custom_type_script = "uid://t4pe7yqc3pnt"
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_2wvic"]
|
[sub_resource type="SystemFont" id="SystemFont_47oqe"]
|
||||||
font_size = 48
|
font_names = PackedStringArray("Monospace")
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_tftiq"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pohc3"]
|
||||||
font_size = 32
|
bg_color = Color(0.60038817, 0.60038817, 0.60038817, 0)
|
||||||
|
border_width_left = 2
|
||||||
|
border_width_top = 2
|
||||||
|
border_width_right = 2
|
||||||
|
border_width_bottom = 2
|
||||||
|
border_color = Color(0, 0, 0, 1)
|
||||||
|
corner_radius_top_left = 8
|
||||||
|
corner_radius_top_right = 8
|
||||||
|
corner_radius_bottom_right = 8
|
||||||
|
corner_radius_bottom_left = 8
|
||||||
|
|
||||||
[node name="Lobby" type="Node" unique_id=459413586]
|
[node name="Lobby" type="VBoxContainer" unique_id=581427024]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
script = ExtResource("1_2wvic")
|
script = ExtResource("1_2wvic")
|
||||||
|
|
||||||
[node name="TubeClient" type="Node" parent="." unique_id=1351185338]
|
[node name="Players" type="HBoxContainer" parent="." unique_id=722026949]
|
||||||
unique_name_in_owner = true
|
layout_mode = 2
|
||||||
script = ExtResource("2_tftiq")
|
size_flags_vertical = 3
|
||||||
context = SubResource("Resource_x4164")
|
|
||||||
metadata/_custom_type_script = "uid://cy006uvidc4y"
|
|
||||||
|
|
||||||
[node name="MenuContainer" type="VBoxContainer" parent="." unique_id=1667537625]
|
[node name="PlayerList" type="VBoxContainer" parent="Players" unique_id=619905746]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Info" type="VBoxContainer" parent="Players" unique_id=532914324]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
theme_override_constants/separation = 30
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Session" type="HBoxContainer" parent="Players/Info" unique_id=444337944]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Players/Info/Session" unique_id=842082166]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Session ID:"
|
||||||
|
label_settings = SubResource("LabelSettings_47oqe")
|
||||||
|
|
||||||
|
[node name="SessionId" type="LineEdit" parent="Players/Info/Session" unique_id=1698107040]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(100, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_colors/font_uneditable_color = Color(0.8750814, 0.8750814, 0.8750814, 1)
|
||||||
|
theme_override_fonts/font = SubResource("SystemFont_47oqe")
|
||||||
|
theme_override_font_sizes/font_size = 24
|
||||||
|
alignment = 1
|
||||||
|
editable = false
|
||||||
|
|
||||||
|
[node name="ReadyButton" type="Button" parent="Players/Info" unique_id=419988826]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "Ready"
|
||||||
|
|
||||||
|
[node name="UnreadyButton" type="Button" parent="Players/Info" unique_id=757772261]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
anchors_preset = 15
|
custom_minimum_size = Vector2(150, 0)
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
theme_override_constants/separation = 20
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="Title" type="Label" parent="MenuContainer" unique_id=1959052214]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Clockwork City"
|
|
||||||
label_settings = SubResource("LabelSettings_2wvic")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="CreateSession" type="Button" parent="MenuContainer" unique_id=1320477862]
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
text = "Create Session"
|
text = "Ready"
|
||||||
|
|
||||||
[node name="JoinSession" type="Button" parent="MenuContainer" unique_id=897089302]
|
[node name="Chat" type="VBoxContainer" parent="." unique_id=1295152456]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_vertical = 3
|
||||||
text = "Join Session"
|
theme_override_constants/separation = 1
|
||||||
|
|
||||||
[node name="CreateSessionContainer" type="VBoxContainer" parent="." unique_id=1261110903]
|
[node name="ChatContainer" type="PanelContainer" parent="Chat" unique_id=691964308]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 3
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_pohc3")
|
||||||
|
|
||||||
|
[node name="Chat" type="RichTextLabel" parent="Chat/ChatContainer" unique_id=1340192570]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
anchors_preset = 15
|
|
||||||
anchor_right = 1.0
|
|
||||||
anchor_bottom = 1.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
theme_override_constants/separation = 20
|
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CreateSessionContainer" unique_id=1668422341]
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Create Session"
|
size_flags_vertical = 3
|
||||||
label_settings = SubResource("LabelSettings_tftiq")
|
bbcode_enabled = true
|
||||||
horizontal_alignment = 1
|
scroll_following = true
|
||||||
|
|
||||||
[node name="Name" type="HBoxContainer" parent="CreateSessionContainer" unique_id=1986198559]
|
[node name="HBoxContainer" type="HBoxContainer" parent="Chat" unique_id=2121694632]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 20
|
theme_override_constants/separation = 10
|
||||||
alignment = 1
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CreateSessionContainer/Name" unique_id=2042865933]
|
[node name="MessageLineEdit" type="LineEdit" parent="Chat/HBoxContainer" unique_id=2073316126]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Player Name"
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="LineEdit" type="LineEdit" parent="CreateSessionContainer/Name" unique_id=1717454671]
|
[node name="MessageSubmit" type="Button" parent="Chat/HBoxContainer" unique_id=850033256]
|
||||||
custom_minimum_size = Vector2(250, 0)
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(100, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
text = "Submit"
|
||||||
|
|
||||||
[node name="Color" type="HBoxContainer" parent="CreateSessionContainer" unique_id=237702841]
|
[connection signal="pressed" from="Players/Info/ReadyButton" to="." method="_on_ready_button_pressed"]
|
||||||
layout_mode = 2
|
[connection signal="pressed" from="Players/Info/UnreadyButton" to="." method="_on_unready_button_pressed"]
|
||||||
theme_override_constants/separation = 20
|
[connection signal="text_submitted" from="Chat/HBoxContainer/MessageLineEdit" to="." method="_handle_message_submitted" unbinds=1]
|
||||||
alignment = 1
|
[connection signal="pressed" from="Chat/HBoxContainer/MessageSubmit" to="." method="_handle_message_submitted"]
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CreateSessionContainer/Color" unique_id=803879737]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "Player Color"
|
|
||||||
|
|
||||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="CreateSessionContainer/Color" unique_id=165152573]
|
|
||||||
custom_minimum_size = Vector2(150, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="CreateSessionContainer" unique_id=218018842]
|
|
||||||
custom_minimum_size = Vector2(150, 0)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
text = "Create Session"
|
|
||||||
|
|||||||
26
prefabs/lobby/player_entry.gd
Normal file
26
prefabs/lobby/player_entry.gd
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
class_name PlayerEntry extends HBoxContainer
|
||||||
|
|
||||||
|
var player: Player
|
||||||
|
var is_ready: bool = false
|
||||||
|
|
||||||
|
@onready var unready_icon: TextureRect = %UnreadyIcon
|
||||||
|
@onready var ready_icon: TextureRect = %ReadyIcon
|
||||||
|
@onready var player_name_label: Label = %PlayerName
|
||||||
|
|
||||||
|
|
||||||
|
func ready() -> void:
|
||||||
|
is_ready = true
|
||||||
|
unready_icon.hide()
|
||||||
|
ready_icon.show()
|
||||||
|
|
||||||
|
|
||||||
|
func unready() -> void:
|
||||||
|
is_ready = false
|
||||||
|
unready_icon.show()
|
||||||
|
ready_icon.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func set_player(p: Player) -> void:
|
||||||
|
player = p
|
||||||
|
player_name_label.text = player.name
|
||||||
|
player_name_label.label_settings.font_color = player.color
|
||||||
1
prefabs/lobby/player_entry.gd.uid
Normal file
1
prefabs/lobby/player_entry.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://cnyjvrs1iem5
|
||||||
45
prefabs/lobby/player_entry.tscn
Normal file
45
prefabs/lobby/player_entry.tscn
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
[gd_scene format=3 uid="uid://c1wn1ghkp12hb"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dalonthk63q26" path="res://assets/ui_buttons/button UI.png" id="1_8wymv"]
|
||||||
|
[ext_resource type="Script" uid="uid://cnyjvrs1iem5" path="res://prefabs/lobby/player_entry.gd" id="1_41ya2"]
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_41ya2"]
|
||||||
|
atlas = ExtResource("1_8wymv")
|
||||||
|
region = Rect2(64, 64, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="AtlasTexture" id="AtlasTexture_ysqhn"]
|
||||||
|
atlas = ExtResource("1_8wymv")
|
||||||
|
region = Rect2(80, 16, 16, 16)
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_yycat"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
font_size = 32
|
||||||
|
|
||||||
|
[node name="PlayerEntry" type="HBoxContainer" unique_id=2138291579]
|
||||||
|
theme_override_constants/separation = 20
|
||||||
|
script = ExtResource("1_41ya2")
|
||||||
|
|
||||||
|
[node name="UnreadyIcon" type="TextureRect" parent="." unique_id=723007847]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
texture_filter = 1
|
||||||
|
custom_minimum_size = Vector2(40, 40)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = SubResource("AtlasTexture_41ya2")
|
||||||
|
expand_mode = 3
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="ReadyIcon" type="TextureRect" parent="." unique_id=710160353]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
texture_filter = 1
|
||||||
|
custom_minimum_size = Vector2(40, 40)
|
||||||
|
layout_mode = 2
|
||||||
|
texture = SubResource("AtlasTexture_ysqhn")
|
||||||
|
expand_mode = 3
|
||||||
|
stretch_mode = 5
|
||||||
|
|
||||||
|
[node name="PlayerName" type="Label" parent="." unique_id=689457220]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Player"
|
||||||
|
label_settings = SubResource("LabelSettings_yycat")
|
||||||
@ -5,12 +5,12 @@ signal child_registered
|
|||||||
var scene_coords: Dictionary[Vector2i, Node] = {}
|
var scene_coords: Dictionary[Vector2i, Node] = {}
|
||||||
|
|
||||||
|
|
||||||
func _enter_tree():
|
func _enter_tree() -> void:
|
||||||
child_entered_tree.connect(_register_child)
|
child_entered_tree.connect(_register_child)
|
||||||
child_exiting_tree.connect(_unregister_child)
|
child_exiting_tree.connect(_unregister_child)
|
||||||
|
|
||||||
|
|
||||||
func _register_child(child):
|
func _register_child(child: Node) -> void:
|
||||||
await child.ready
|
await child.ready
|
||||||
var coords = local_to_map(to_local(child.global_position))
|
var coords = local_to_map(to_local(child.global_position))
|
||||||
scene_coords[coords] = child
|
scene_coords[coords] = child
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_68e07")
|
atlas = ExtResource("2_68e07")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_68e07")
|
atlas = ExtResource("2_68e07")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Bank" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
[node name="Bank" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_q4p5y")
|
script = ExtResource("1_q4p5y")
|
||||||
@ -84,29 +81,41 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1773735924]
|
[node name="Square2" type="Area2D" parent="." unique_id=1695837302]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=451761201]
|
||||||
position = Vector2(165, 165)
|
position = Vector2(165, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="BuildingArea" unique_id=1677987437]
|
[node name="Square3" type="Area2D" parent="." unique_id=1667620998]
|
||||||
position = Vector2(165, 55)
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=636207289]
|
||||||
|
position = Vector2(55, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square4" type="Area2D" parent="." unique_id=2144774838]
|
||||||
position = Vector2(55, 55)
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=847000506]
|
||||||
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
||||||
@ -139,35 +148,17 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=1957708982]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -205.0
|
||||||
|
offset_right = 165.0
|
||||||
|
offset_bottom = 55.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=2142538939]
|
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||||
position = Vector2(110, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=2060476818]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=535904517]
|
|
||||||
position = Vector2(110, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1107926939]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square4" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(0, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_iv3ev")
|
atlas = ExtResource("2_iv3ev")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_iv3ev")
|
atlas = ExtResource("2_iv3ev")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Bar" type="Node2D" unique_id=746270571]
|
[node name="Bar" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_cy06p")
|
script = ExtResource("1_cy06p")
|
||||||
@ -54,20 +51,22 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square2" type="Area2D" parent="." unique_id=576493787]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=1628737156]
|
||||||
position = Vector2(55, 55)
|
position = Vector2(55, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
@ -101,19 +100,15 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=645153151]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -205.0
|
||||||
|
offset_right = 55.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(0, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -1,14 +1,18 @@
|
|||||||
class_name Building extends Node2D
|
class_name Building extends Node2D
|
||||||
|
|
||||||
|
@export var cost: int = 0
|
||||||
|
|
||||||
var is_placing: bool = false:
|
var is_placing: bool = false:
|
||||||
set(value):
|
set(value):
|
||||||
is_placing = value
|
is_placing = value
|
||||||
building_area.monitoring = !is_placing
|
for child in get_children():
|
||||||
|
if child is Area2D:
|
||||||
|
child.monitoring = !is_placing
|
||||||
|
|
||||||
var starting_coord: Vector2i
|
var starting_coord: Vector2i
|
||||||
var tile_rotation: Board.Direction = Board.Direction.UP
|
var tile_rotation: Board.Direction = Board.Direction.UP
|
||||||
|
|
||||||
@onready var building_area: Area2D = %BuildingArea
|
@onready var size_node: Control = %Size
|
||||||
|
|
||||||
|
|
||||||
func building_entered(body: Node2D) -> void:
|
func building_entered(body: Node2D) -> void:
|
||||||
@ -33,3 +37,25 @@ func get_rotation_count() -> int:
|
|||||||
elif tile_rotation == Board.Direction.LEFT:
|
elif tile_rotation == Board.Direction.LEFT:
|
||||||
rotation_count = 3
|
rotation_count = 3
|
||||||
return rotation_count
|
return rotation_count
|
||||||
|
|
||||||
|
|
||||||
|
func serialize() -> Dictionary:
|
||||||
|
var result = {}
|
||||||
|
result["scene_file_path"] = scene_file_path
|
||||||
|
result["starting_coord"] = starting_coord
|
||||||
|
result["tile_rotation"] = tile_rotation
|
||||||
|
result["cost"] = cost
|
||||||
|
result["player"] = null
|
||||||
|
if get("player") != null:
|
||||||
|
result["player"] = get("player").serialize()
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func deserialize(data: Dictionary) -> Building:
|
||||||
|
var building: Building = load(data["scene_file_path"]).instantiate()
|
||||||
|
building.tile_rotation = data["tile_rotation"]
|
||||||
|
building.starting_coord = data["starting_coord"]
|
||||||
|
building.cost = data["cost"]
|
||||||
|
if data["player"] != null:
|
||||||
|
building.player = Player.deserialize(data["player"])
|
||||||
|
return building
|
||||||
|
|||||||
@ -47,7 +47,7 @@ func get_tile_coords() -> Array[Vector2i]:
|
|||||||
|
|
||||||
|
|
||||||
func get_direction_queue(citizen: Citizen) -> Array[Board.Direction]:
|
func get_direction_queue(citizen: Citizen) -> Array[Board.Direction]:
|
||||||
if (citizen.current_tile_coords - starting_coord) == Vector2i.ZERO:
|
if citizen.current_tile_coords == starting_coord:
|
||||||
return [
|
return [
|
||||||
Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count()),
|
Board.get_next_direction(Board.Direction.RIGHT, get_rotation_count()),
|
||||||
Board.get_next_direction(Board.Direction.UP, get_rotation_count()),
|
Board.get_next_direction(Board.Direction.UP, get_rotation_count()),
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_721qv")
|
atlas = ExtResource("2_721qv")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_721qv")
|
atlas = ExtResource("2_721qv")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Cafe" type="Node2D" unique_id=746270571]
|
[node name="Cafe" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_rc38y")
|
script = ExtResource("1_rc38y")
|
||||||
@ -72,29 +69,41 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1773735924]
|
[node name="Square2" type="Area2D" parent="." unique_id=1384097423]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=686018821]
|
||||||
position = Vector2(165, 165)
|
position = Vector2(165, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="BuildingArea" unique_id=1677987437]
|
[node name="Square3" type="Area2D" parent="." unique_id=837457110]
|
||||||
position = Vector2(165, 55)
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=1976346563]
|
||||||
|
position = Vector2(275, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square4" type="Area2D" parent="." unique_id=1074092983]
|
||||||
position = Vector2(275, 55)
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=442777190]
|
||||||
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
||||||
@ -129,35 +138,17 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=705793849]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -95.0
|
||||||
|
offset_top = -165.0
|
||||||
|
offset_right = 315.0
|
||||||
|
offset_bottom = 55.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=2142538939]
|
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||||
position = Vector2(110, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=2060476818]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=535904517]
|
|
||||||
position = Vector2(110, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1107926939]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square4" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(220, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_fupku"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_fupku"]
|
||||||
atlas = ExtResource("2_rnjsh")
|
atlas = ExtResource("2_rnjsh")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(0, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_rnjsh")
|
atlas = ExtResource("2_rnjsh")
|
||||||
region = Rect2(16, 16, 16, 16)
|
region = Rect2(16, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Fork" type="Node2D" unique_id=746270571]
|
[node name="Fork" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_pht35")
|
script = ExtResource("1_pht35")
|
||||||
@ -45,17 +42,12 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=1969702659]
|
[node name="Sprite2D2" type="Sprite2D" parent="." unique_id=1969702659]
|
||||||
@ -82,19 +74,14 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=1036213581]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -95.0
|
||||||
|
offset_top = -55.0
|
||||||
|
offset_right = 95.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(0, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_qam00")
|
atlas = ExtResource("2_qam00")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_qam00")
|
atlas = ExtResource("2_qam00")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="GunShop" type="Node2D" unique_id=746270571]
|
[node name="GunShop" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_llmep")
|
script = ExtResource("1_llmep")
|
||||||
@ -90,36 +87,58 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square2" type="Area2D" parent="." unique_id=1379529856]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=955594279]
|
||||||
position = Vector2(55, 55)
|
position = Vector2(55, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1549040997]
|
[node name="Square3" type="Area2D" parent="." unique_id=1616965064]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=298326013]
|
||||||
position = Vector2(165, 55)
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="BuildingArea" unique_id=1578115167]
|
[node name="Square4" type="Area2D" parent="." unique_id=2008550121]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=2089225905]
|
||||||
position = Vector2(55, -55)
|
position = Vector2(55, -55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D5" type="CollisionShape2D" parent="BuildingArea" unique_id=1640076722]
|
[node name="Square5" type="Area2D" parent="." unique_id=1035600618]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D5" type="CollisionShape2D" parent="Square5" unique_id=1170834008]
|
||||||
position = Vector2(165, -55)
|
position = Vector2(165, -55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D6" type="CollisionShape2D" parent="BuildingArea" unique_id=1850783102]
|
[node name="Square6" type="Area2D" parent="." unique_id=567720258]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D6" type="CollisionShape2D" parent="Square6" unique_id=1706049840]
|
||||||
position = Vector2(275, -55)
|
position = Vector2(275, -55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
@ -154,51 +173,19 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=404984063]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -275.0
|
||||||
|
offset_right = 315.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=289882156]
|
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||||
position = Vector2(0, -110)
|
[connection signal="area_entered" from="Square5" to="." method="_on_building_area_entered"]
|
||||||
collision_layer = 4
|
[connection signal="area_entered" from="Square6" to="." method="_on_building_area_entered"]
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=520831463]
|
|
||||||
position = Vector2(110, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=309772651]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square4" type="Area2D" parent="." unique_id=229115924]
|
|
||||||
position = Vector2(0, -220)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=261500077]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square5" type="Area2D" parent="." unique_id=826236086]
|
|
||||||
position = Vector2(110, -220)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square5" unique_id=1360179714]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square6" type="Area2D" parent="." unique_id=1250539767]
|
|
||||||
position = Vector2(220, -220)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square6" unique_id=783421603]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -8,6 +8,10 @@ var player: Player:
|
|||||||
@onready var border: PanelContainer = %Border
|
@onready var border: PanelContainer = %Border
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
_set_border_color()
|
||||||
|
|
||||||
|
|
||||||
func activate(citizen: Citizen) -> void:
|
func activate(citizen: Citizen) -> void:
|
||||||
player.money += citizen.money
|
player.money += citizen.money
|
||||||
|
|
||||||
@ -25,5 +29,7 @@ func get_tile_coords() -> Array[Vector2i]:
|
|||||||
|
|
||||||
|
|
||||||
func _set_border_color() -> void:
|
func _set_border_color() -> void:
|
||||||
|
if !is_node_ready() or player == null:
|
||||||
|
return
|
||||||
var style_box: StyleBoxFlat = border.get_theme_stylebox("panel")
|
var style_box: StyleBoxFlat = border.get_theme_stylebox("panel")
|
||||||
style_box.border_color = player.color
|
style_box.border_color = player.color
|
||||||
|
|||||||
@ -25,11 +25,8 @@ font_size = 24
|
|||||||
outline_size = 4
|
outline_size = 4
|
||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i0ot4"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ja20k"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ja20k"]
|
||||||
size = Vector2(100, 100)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[node name="Home" type="Node2D" unique_id=1701297833]
|
[node name="Home" type="Node2D" unique_id=1701297833]
|
||||||
script = ExtResource("2_g5sxs")
|
script = ExtResource("2_g5sxs")
|
||||||
@ -90,20 +87,22 @@ label_settings = SubResource("LabelSettings_26feb")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="." unique_id=2110660720]
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=2100290177]
|
|
||||||
shape = SubResource("RectangleShape2D_i0ot4")
|
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=812662804]
|
[node name="BuildingArea" type="Area2D" parent="." unique_id=812662804]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=660262437]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=660262437]
|
||||||
shape = SubResource("RectangleShape2D_ja20k")
|
shape = SubResource("RectangleShape2D_ja20k")
|
||||||
|
|
||||||
|
[node name="Size" type="Control" parent="." unique_id=1792197698]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -55.0
|
||||||
|
offset_right = 55.0
|
||||||
|
offset_bottom = 55.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[connection signal="tree_entered" from="." to="." method="_on_tree_entered"]
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
||||||
|
|||||||
@ -65,7 +65,7 @@ func get_direction_queue(citizen: Citizen) -> Array[Board.Direction]:
|
|||||||
|
|
||||||
|
|
||||||
func activate(citizen: Citizen) -> void:
|
func activate(citizen: Citizen) -> void:
|
||||||
var new_citizen: Citizen = CITIZEN_SCENE.instantiate()
|
var new_citizen: Citizen = load("uid://bwx0lqtkd2jd7").instantiate()
|
||||||
citizen.call_deferred("add_sibling", new_citizen)
|
citizen.call_deferred("add_sibling", new_citizen)
|
||||||
await new_citizen.ready
|
await new_citizen.ready
|
||||||
new_citizen.direction = citizen.direction
|
new_citizen.direction = citizen.direction
|
||||||
@ -81,3 +81,4 @@ func activate(citizen: Citizen) -> void:
|
|||||||
new_citizen.current_tile_coords = starting_coord + Vector2i(1, -1)
|
new_citizen.current_tile_coords = starting_coord + Vector2i(1, -1)
|
||||||
new_citizen.position = citizen.position - Vector2(110, 0)
|
new_citizen.position = citizen.position - Vector2(110, 0)
|
||||||
new_citizen.direction_queue = get_direction_queue(new_citizen)
|
new_citizen.direction_queue = get_direction_queue(new_citizen)
|
||||||
|
new_citizen.direction_queue.remove_at(0)
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_kp5oa")
|
atlas = ExtResource("2_kp5oa")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_kp5oa")
|
atlas = ExtResource("2_kp5oa")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Hospital" type="Node2D" unique_id=746270571]
|
[node name="Hospital" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_sjpox")
|
script = ExtResource("1_sjpox")
|
||||||
@ -90,39 +87,61 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1773735924]
|
[node name="Square2" type="Area2D" parent="." unique_id=51068946]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=1785473598]
|
||||||
position = Vector2(165, 165)
|
position = Vector2(165, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="BuildingArea" unique_id=1677987437]
|
[node name="Square3" type="Area2D" parent="." unique_id=1451949629]
|
||||||
position = Vector2(165, 55)
|
process_mode = 3
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=2080468580]
|
||||||
position = Vector2(275, 165)
|
position = Vector2(275, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D6" type="CollisionShape2D" parent="BuildingArea" unique_id=522644288]
|
[node name="Square4" type="Area2D" parent="." unique_id=1551174518]
|
||||||
position = Vector2(385, 165)
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square4" unique_id=1859931627]
|
||||||
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D5" type="CollisionShape2D" parent="BuildingArea" unique_id=183896438]
|
[node name="Square5" type="Area2D" parent="." unique_id=1045227304]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D5" type="CollisionShape2D" parent="Square5" unique_id=493084342]
|
||||||
position = Vector2(275, 55)
|
position = Vector2(275, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
|
[node name="Square6" type="Area2D" parent="." unique_id=1247523759]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D6" type="CollisionShape2D" parent="Square6" unique_id=1628210223]
|
||||||
|
position = Vector2(385, 165)
|
||||||
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=1585332168]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
position = Vector2(110, -190)
|
position = Vector2(110, -190)
|
||||||
@ -153,51 +172,19 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=1067155101]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -95.0
|
||||||
|
offset_top = -205.0
|
||||||
|
offset_right = 425.0
|
||||||
|
offset_bottom = 55.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=2142538939]
|
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||||
position = Vector2(110, -110)
|
[connection signal="area_entered" from="Square5" to="." method="_on_building_area_entered"]
|
||||||
collision_layer = 4
|
[connection signal="area_entered" from="Square6" to="." method="_on_building_area_entered"]
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=2060476818]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=535904517]
|
|
||||||
position = Vector2(110, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1107926939]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square4" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(220, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square6" type="Area2D" parent="." unique_id=1663203880]
|
|
||||||
position = Vector2(330, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square6" unique_id=797794700]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square5" type="Area2D" parent="." unique_id=927113755]
|
|
||||||
position = Vector2(220, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square5" unique_id=1982283119]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("1_fupku")
|
atlas = ExtResource("1_fupku")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("1_fupku")
|
atlas = ExtResource("1_fupku")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Office" type="Node2D" unique_id=746270571]
|
[node name="Office" type="Node2D" unique_id=746270571]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_wwwaf")
|
script = ExtResource("1_wwwaf")
|
||||||
@ -72,28 +69,44 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1773735924]
|
[node name="Square2" type="Area2D" parent="." unique_id=1569010849]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=2062368795]
|
||||||
position = Vector2(165, 165)
|
position = Vector2(165, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D4" type="CollisionShape2D" parent="BuildingArea" unique_id=1677987437]
|
[node name="Square3" type="Area2D" parent="." unique_id=755825200]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D4" type="CollisionShape2D" parent="Square3" unique_id=1969675340]
|
||||||
position = Vector2(165, 55)
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square4" type="Area2D" parent="." unique_id=933131529]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square4" unique_id=2117224975]
|
||||||
position = Vector2(275, 165)
|
position = Vector2(275, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
@ -112,35 +125,17 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=300012791]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -165.0
|
||||||
|
offset_right = 275.0
|
||||||
|
offset_bottom = 55.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=2142538939]
|
[connection signal="area_entered" from="Square4" to="." method="_on_building_area_entered"]
|
||||||
position = Vector2(110, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=2060476818]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=535904517]
|
|
||||||
position = Vector2(110, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=1107926939]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square4" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(220, 0)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square4" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -70,7 +70,7 @@ func activate(citizen: Citizen) -> void:
|
|||||||
|
|
||||||
|
|
||||||
func handle_post_turn_actions() -> void:
|
func handle_post_turn_actions() -> void:
|
||||||
Globals.game.queue_spawn_placement(floori(money / 15.0))
|
Globals.board_game.queue_spawn_placement(floori(money / 15.0))
|
||||||
money = money % 15
|
money = money % 15
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ outline_size = 4
|
|||||||
outline_color = Color(0, 0, 0, 1)
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vwg8v"]
|
||||||
size = Vector2(110, 110)
|
size = Vector2(109, 109)
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_wwwaf"]
|
||||||
atlas = ExtResource("2_6buuw")
|
atlas = ExtResource("2_6buuw")
|
||||||
@ -18,9 +18,6 @@ region = Rect2(16, 16, 16, 16)
|
|||||||
atlas = ExtResource("2_6buuw")
|
atlas = ExtResource("2_6buuw")
|
||||||
region = Rect2(0, 16, 16, 16)
|
region = Rect2(0, 16, 16, 16)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_wwwaf"]
|
|
||||||
size = Vector2(1, 1)
|
|
||||||
|
|
||||||
[node name="Shop" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
[node name="Shop" type="Node2D" unique_id=746270571 groups=["PostTurnActions"]]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
script = ExtResource("1_cugdd")
|
script = ExtResource("1_cugdd")
|
||||||
@ -75,24 +72,31 @@ label_settings = SubResource("LabelSettings_vwg8v")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="BuildingArea" type="Area2D" parent="." unique_id=333775731]
|
[node name="Square1" type="Area2D" parent="." unique_id=333775731]
|
||||||
unique_name_in_owner = true
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(-55, -165)
|
position = Vector2(-55, -165)
|
||||||
collision_layer = 0
|
|
||||||
collision_mask = 5
|
|
||||||
monitoring = false
|
monitoring = false
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="BuildingArea" unique_id=1122204523]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square1" unique_id=1122204523]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(55, 165)
|
position = Vector2(55, 165)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="BuildingArea" unique_id=1638062176]
|
[node name="Square2" type="Area2D" parent="." unique_id=1178103316]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D2" type="CollisionShape2D" parent="Square2" unique_id=1888689165]
|
||||||
position = Vector2(55, 55)
|
position = Vector2(55, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
[node name="CollisionShape2D3" type="CollisionShape2D" parent="BuildingArea" unique_id=1549040997]
|
[node name="Square3" type="Area2D" parent="." unique_id=1807846223]
|
||||||
|
process_mode = 3
|
||||||
|
position = Vector2(-55, -165)
|
||||||
|
monitoring = false
|
||||||
|
|
||||||
|
[node name="CollisionShape2D3" type="CollisionShape2D" parent="Square3" unique_id=1353761825]
|
||||||
position = Vector2(165, 55)
|
position = Vector2(165, 55)
|
||||||
shape = SubResource("RectangleShape2D_vwg8v")
|
shape = SubResource("RectangleShape2D_vwg8v")
|
||||||
|
|
||||||
@ -127,27 +131,16 @@ scale = Vector2(2, 2)
|
|||||||
texture = SubResource("AtlasTexture_fupku")
|
texture = SubResource("AtlasTexture_fupku")
|
||||||
flip_v = true
|
flip_v = true
|
||||||
|
|
||||||
[node name="Square" type="Area2D" parent="." unique_id=1309579334]
|
[node name="Size" type="Control" parent="." unique_id=732774293]
|
||||||
collision_layer = 4
|
unique_name_in_owner = true
|
||||||
collision_mask = 0
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
offset_left = -55.0
|
||||||
|
offset_top = -165.0
|
||||||
|
offset_right = 205.0
|
||||||
|
offset_bottom = 95.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square" unique_id=2040153103]
|
[connection signal="area_entered" from="Square1" to="." method="_on_building_area_entered"]
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
[connection signal="area_entered" from="Square2" to="." method="_on_building_area_entered"]
|
||||||
|
[connection signal="area_entered" from="Square3" to="." method="_on_building_area_entered"]
|
||||||
[node name="Square2" type="Area2D" parent="." unique_id=289882156]
|
|
||||||
position = Vector2(0, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square2" unique_id=1476676009]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[node name="Square3" type="Area2D" parent="." unique_id=520831463]
|
|
||||||
position = Vector2(110, -110)
|
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 0
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Square3" unique_id=309772651]
|
|
||||||
shape = SubResource("RectangleShape2D_wwwaf")
|
|
||||||
|
|
||||||
[connection signal="area_entered" from="BuildingArea" to="." method="_on_building_area_entered"]
|
|
||||||
|
|||||||
@ -16,13 +16,13 @@ load_path = "res://.godot/imported/Squares.png-fa45fbe99d22448c54fd764146a6d2d3.
|
|||||||
atlas = SubResource("CompressedTexture2D_fd67e")
|
atlas = SubResource("CompressedTexture2D_fd67e")
|
||||||
region = Rect2(50, 160, 10, 10)
|
region = Rect2(50, 160, 10, 10)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_yeyfm"]
|
|
||||||
size = Vector2(2, 2)
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kmcv5"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_kmcv5"]
|
||||||
size = Vector2(100, 100)
|
size = Vector2(110, 110)
|
||||||
|
|
||||||
[node name="Ground" type="TextureRect" unique_id=1636895806]
|
[node name="Ground" type="Node2D" unique_id=220734189]
|
||||||
|
script = ExtResource("1_fd67e")
|
||||||
|
|
||||||
|
[node name="Lowlight" type="TextureRect" parent="." unique_id=1636895806]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
custom_minimum_size = Vector2(100, 100)
|
custom_minimum_size = Vector2(100, 100)
|
||||||
anchors_preset = -1
|
anchors_preset = -1
|
||||||
@ -34,9 +34,8 @@ pivot_offset = Vector2(50, 50)
|
|||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
texture = SubResource("AtlasTexture_kmcv5")
|
texture = SubResource("AtlasTexture_kmcv5")
|
||||||
script = ExtResource("1_fd67e")
|
|
||||||
|
|
||||||
[node name="Highlight" type="TextureRect" parent="." unique_id=1075021487]
|
[node name="Highlight" type="TextureRect" parent="Lowlight" unique_id=1075021487]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
@ -46,21 +45,12 @@ offset_right = 100.0
|
|||||||
offset_bottom = 100.0
|
offset_bottom = 100.0
|
||||||
texture = SubResource("AtlasTexture_unv4h")
|
texture = SubResource("AtlasTexture_unv4h")
|
||||||
|
|
||||||
[node name="CitizensArea" type="Area2D" parent="." unique_id=295299364]
|
[node name="Area" type="Area2D" parent="." unique_id=499432344]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(50, 50)
|
collision_mask = 0
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 4
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CitizensArea" unique_id=1296255500]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area" unique_id=501086298]
|
||||||
shape = SubResource("RectangleShape2D_yeyfm")
|
|
||||||
|
|
||||||
[node name="TilesArea" type="Area2D" parent="." unique_id=499432344]
|
|
||||||
process_mode = 3
|
|
||||||
position = Vector2(50, 50)
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TilesArea" unique_id=501086298]
|
|
||||||
shape = SubResource("RectangleShape2D_kmcv5")
|
shape = SubResource("RectangleShape2D_kmcv5")
|
||||||
|
|
||||||
[connection signal="mouse_entered" from="." to="." method="handle_ground_mouse_entered"]
|
[connection signal="mouse_entered" from="Lowlight" to="." method="handle_ground_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="." to="." method="handle_ground_mouse_exited"]
|
[connection signal="mouse_exited" from="Lowlight" to="." method="handle_ground_mouse_exited"]
|
||||||
|
|||||||
@ -3,8 +3,9 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cmx882wng57du" path="res://prefabs/tiles/spawns/spawn.tscn" id="1_8pp6a"]
|
[ext_resource type="PackedScene" uid="uid://cmx882wng57du" path="res://prefabs/tiles/spawns/spawn.tscn" id="1_8pp6a"]
|
||||||
|
|
||||||
[node name="DownSpawn" unique_id=189795230 instance=ExtResource("1_8pp6a")]
|
[node name="DownSpawn" unique_id=189795230 instance=ExtResource("1_8pp6a")]
|
||||||
|
direction = 2
|
||||||
|
|
||||||
[node name="TextureRect" parent="." index="2" unique_id=801970580]
|
[node name="TextureRect" parent="Icon" parent_id_path=PackedInt32Array(189795230) index="2" unique_id=801970580]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
[node name="LeftSpawn" unique_id=189795230 instance=ExtResource("1_0mffo")]
|
[node name="LeftSpawn" unique_id=189795230 instance=ExtResource("1_0mffo")]
|
||||||
direction = 3
|
direction = 3
|
||||||
|
|
||||||
[node name="TextureRect" parent="." index="2" unique_id=801970580]
|
[node name="TextureRect" parent="Icon" parent_id_path=PackedInt32Array(189795230) index="2" unique_id=801970580]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
offset_left = 10.565
|
offset_left = 10.565
|
||||||
offset_top = 33.3
|
offset_top = 33.3
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
[node name="RightSpawn" unique_id=189795230 instance=ExtResource("1_0et8l")]
|
[node name="RightSpawn" unique_id=189795230 instance=ExtResource("1_0et8l")]
|
||||||
direction = 4
|
direction = 4
|
||||||
|
|
||||||
[node name="TextureRect" parent="." index="2" unique_id=801970580]
|
[node name="TextureRect" parent="Icon" parent_id_path=PackedInt32Array(189795230) index="2" unique_id=801970580]
|
||||||
offset_left = 92.46
|
offset_left = 92.46
|
||||||
offset_top = 69.315
|
offset_top = 69.315
|
||||||
offset_right = 112.46
|
offset_right = 112.46
|
||||||
|
|||||||
@ -10,15 +10,15 @@ const CITIZEN_SCENE = preload("uid://bwx0lqtkd2jd7")
|
|||||||
var spawn_time: float = 0.5
|
var spawn_time: float = 0.5
|
||||||
var spawn_left: int
|
var spawn_left: int
|
||||||
var current_time: float = 0
|
var current_time: float = 0
|
||||||
var board: Board
|
|
||||||
var paused: bool = true
|
var paused: bool = true
|
||||||
|
|
||||||
|
@onready var icon: ColorRect = %Icon
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
board = get_parent().get_parent()
|
|
||||||
match spawn_size:
|
match spawn_size:
|
||||||
Size.SMALL:
|
Size.SMALL:
|
||||||
spawn_left = 10
|
spawn_left = 1
|
||||||
|
|
||||||
|
|
||||||
func pause() -> void:
|
func pause() -> void:
|
||||||
@ -46,7 +46,6 @@ func _physics_process(delta: float) -> void:
|
|||||||
var citizen: Citizen = CITIZEN_SCENE.instantiate()
|
var citizen: Citizen = CITIZEN_SCENE.instantiate()
|
||||||
add_sibling(citizen)
|
add_sibling(citizen)
|
||||||
citizen.add_to_group("Pausable")
|
citizen.add_to_group("Pausable")
|
||||||
citizen.board = board
|
citizen.position = position
|
||||||
citizen.position = position + (size / 2)
|
|
||||||
citizen.set_offset(Vector2(randf_range(-40, 40), randf_range(-40, 40)))
|
citizen.set_offset(Vector2(randf_range(-40, 40), randf_range(-40, 40)))
|
||||||
citizen.direction = direction
|
citizen.direction = direction
|
||||||
|
|||||||
@ -13,9 +13,13 @@ atlas = ExtResource("2_26feb")
|
|||||||
region = Rect2(20, 66, 7, 11)
|
region = Rect2(20, 66, 7, 11)
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bs4fa"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bs4fa"]
|
||||||
size = Vector2(1, 1)
|
size = Vector2(110, 110)
|
||||||
|
|
||||||
[node name="Spawn" type="ColorRect" unique_id=189795230 groups=["Pausable", "PostTurnActions"]]
|
[node name="Spawn" type="Node2D" unique_id=606603079 groups=["Pausable", "PostTurnActions"]]
|
||||||
|
script = ExtResource("2_c3hvl")
|
||||||
|
|
||||||
|
[node name="Icon" type="ColorRect" parent="." unique_id=189795230]
|
||||||
|
unique_name_in_owner = true
|
||||||
process_mode = 1
|
process_mode = 1
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
custom_minimum_size = Vector2(100, 100)
|
custom_minimum_size = Vector2(100, 100)
|
||||||
@ -24,10 +28,8 @@ offset_top = -50.0
|
|||||||
offset_right = 50.0
|
offset_right = 50.0
|
||||||
offset_bottom = 50.0
|
offset_bottom = 50.0
|
||||||
color = Color(0, 0, 1, 1)
|
color = Color(0, 0, 1, 1)
|
||||||
script = ExtResource("2_c3hvl")
|
|
||||||
direction = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="." unique_id=134308374]
|
[node name="Label" type="Label" parent="Icon" unique_id=134308374]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
@ -46,7 +48,7 @@ label_settings = SubResource("LabelSettings_26feb")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="Amount" type="Label" parent="." unique_id=1728513182]
|
[node name="Amount" type="Label" parent="Icon" unique_id=1728513182]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
@ -66,7 +68,7 @@ label_settings = SubResource("LabelSettings_26feb")
|
|||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=801970580]
|
[node name="TextureRect" type="TextureRect" parent="Icon" unique_id=801970580]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 40.0
|
offset_bottom = 40.0
|
||||||
@ -75,9 +77,7 @@ expand_mode = 5
|
|||||||
stretch_mode = 4
|
stretch_mode = 4
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="." unique_id=1478096785]
|
[node name="Area2D" type="Area2D" parent="." unique_id=1478096785]
|
||||||
position = Vector2(50, 50)
|
collision_mask = 0
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 4
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=2097036302]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=2097036302]
|
||||||
shape = SubResource("RectangleShape2D_bs4fa")
|
shape = SubResource("RectangleShape2D_bs4fa")
|
||||||
|
|||||||
@ -3,9 +3,8 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cmx882wng57du" path="res://prefabs/tiles/spawns/spawn.tscn" id="1_lqvn7"]
|
[ext_resource type="PackedScene" uid="uid://cmx882wng57du" path="res://prefabs/tiles/spawns/spawn.tscn" id="1_lqvn7"]
|
||||||
|
|
||||||
[node name="UpSpawn" unique_id=189795230 instance=ExtResource("1_lqvn7")]
|
[node name="UpSpawn" unique_id=189795230 instance=ExtResource("1_lqvn7")]
|
||||||
direction = 1
|
|
||||||
|
|
||||||
[node name="TextureRect" parent="." index="2" unique_id=801970580]
|
[node name="TextureRect" parent="Icon" parent_id_path=PackedInt32Array(189795230) index="2" unique_id=801970580]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 5
|
anchors_preset = 5
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
class_name Tile extends Control
|
class_name Tile extends Node2D
|
||||||
|
|
||||||
@warning_ignore("unused_signal")
|
@warning_ignore("unused_signal")
|
||||||
signal tile_selected(tile: Tile)
|
signal tile_selected(tile: Tile)
|
||||||
|
|
||||||
|
@export var coords: Vector2i
|
||||||
|
@export var cost: int = 0
|
||||||
|
|
||||||
var highlighted: bool = false
|
var highlighted: bool = false
|
||||||
|
var is_placing: bool = false
|
||||||
|
|
||||||
|
|
||||||
func handle_mouse_entered() -> void:
|
func handle_mouse_entered() -> void:
|
||||||
@ -12,3 +16,18 @@ func handle_mouse_entered() -> void:
|
|||||||
|
|
||||||
func handle_mouse_exited() -> void:
|
func handle_mouse_exited() -> void:
|
||||||
highlighted = false
|
highlighted = false
|
||||||
|
|
||||||
|
|
||||||
|
func serialize() -> Dictionary:
|
||||||
|
var result = {}
|
||||||
|
result["scene_file_path"] = scene_file_path
|
||||||
|
result["coords"] = coords
|
||||||
|
result["cost"] = cost
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func deserialize(data: Dictionary) -> Tile:
|
||||||
|
var tile: Tile = load(data["scene_file_path"]).instantiate()
|
||||||
|
tile.coords = data["coords"]
|
||||||
|
tile.cost = data["cost"]
|
||||||
|
return tile
|
||||||
|
|||||||
@ -3,11 +3,11 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="1_s65nw"]
|
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="1_s65nw"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_xxpct"]
|
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_xxpct"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dxc6q"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_s65nw"]
|
||||||
atlas = ExtResource("1_s65nw")
|
atlas = ExtResource("1_s65nw")
|
||||||
region = Rect2(0, 11, 9, 9)
|
region = Rect2(0, 11, 9, 9)
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_s65nw"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xxpct"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
bg_color = Color(1, 1, 1, 0)
|
bg_color = Color(1, 1, 1, 0)
|
||||||
border_width_left = 5
|
border_width_left = 5
|
||||||
@ -21,8 +21,10 @@ expand_margin_right = 8.0
|
|||||||
expand_margin_bottom = 8.0
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[node name="DownTurn" unique_id=1363157270 instance=ExtResource("1_xxpct")]
|
[node name="DownTurn" unique_id=1363157270 instance=ExtResource("1_xxpct")]
|
||||||
texture = SubResource("AtlasTexture_dxc6q")
|
|
||||||
direction = 2
|
direction = 2
|
||||||
|
|
||||||
[node name="Highlight" parent="." index="0" unique_id=715172504]
|
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_s65nw")
|
texture = SubResource("AtlasTexture_s65nw")
|
||||||
|
|
||||||
|
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_xxpct")
|
||||||
|
|||||||
@ -3,11 +3,29 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_exig8"]
|
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_exig8"]
|
||||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_4tde2"]
|
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_4tde2"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_41d4x"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_4tde2"]
|
||||||
atlas = ExtResource("2_4tde2")
|
atlas = ExtResource("2_4tde2")
|
||||||
region = Rect2(1, 1, 9, 9)
|
region = Rect2(1, 1, 9, 9)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_41d4x"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
bg_color = Color(1, 1, 1, 0)
|
||||||
|
border_width_left = 5
|
||||||
|
border_width_top = 5
|
||||||
|
border_width_right = 5
|
||||||
|
border_width_bottom = 5
|
||||||
|
border_color = Color(1, 1, 1, 1)
|
||||||
|
expand_margin_left = 8.0
|
||||||
|
expand_margin_top = 8.0
|
||||||
|
expand_margin_right = 8.0
|
||||||
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[node name="LeftTurn" unique_id=1363157270 instance=ExtResource("1_exig8")]
|
[node name="LeftTurn" unique_id=1363157270 instance=ExtResource("1_exig8")]
|
||||||
texture = SubResource("AtlasTexture_41d4x")
|
|
||||||
flip_h = true
|
|
||||||
direction = 3
|
direction = 3
|
||||||
|
|
||||||
|
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||||
|
texture = SubResource("AtlasTexture_4tde2")
|
||||||
|
flip_h = true
|
||||||
|
|
||||||
|
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_41d4x")
|
||||||
|
|||||||
@ -3,10 +3,28 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_2yiqp"]
|
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_2yiqp"]
|
||||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3t120"]
|
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3t120"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dlxmt"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3t120"]
|
||||||
atlas = ExtResource("2_3t120")
|
atlas = ExtResource("2_3t120")
|
||||||
region = Rect2(1, 1, 9, 9)
|
region = Rect2(1, 1, 9, 9)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlxmt"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
bg_color = Color(1, 1, 1, 0)
|
||||||
|
border_width_left = 5
|
||||||
|
border_width_top = 5
|
||||||
|
border_width_right = 5
|
||||||
|
border_width_bottom = 5
|
||||||
|
border_color = Color(1, 1, 1, 1)
|
||||||
|
expand_margin_left = 8.0
|
||||||
|
expand_margin_top = 8.0
|
||||||
|
expand_margin_right = 8.0
|
||||||
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[node name="RightTurn" unique_id=1363157270 instance=ExtResource("1_2yiqp")]
|
[node name="RightTurn" unique_id=1363157270 instance=ExtResource("1_2yiqp")]
|
||||||
texture = SubResource("AtlasTexture_dlxmt")
|
|
||||||
direction = 4
|
direction = 4
|
||||||
|
|
||||||
|
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||||
|
texture = SubResource("AtlasTexture_3t120")
|
||||||
|
|
||||||
|
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_dlxmt")
|
||||||
|
|||||||
@ -5,14 +5,14 @@ class_name Turn extends Tile
|
|||||||
@onready var highlight: Panel = %Highlight
|
@onready var highlight: Panel = %Highlight
|
||||||
|
|
||||||
|
|
||||||
func handle_mouse_entered() -> void:
|
func handle_turn_mouse_entered() -> void:
|
||||||
highlight.show()
|
highlight.show()
|
||||||
|
|
||||||
|
|
||||||
func handle_mouse_exited() -> void:
|
func handle_turn_mouse_exited() -> void:
|
||||||
highlight.hide()
|
highlight.hide()
|
||||||
|
|
||||||
|
|
||||||
func handle_gui_input(event: InputEvent):
|
func handle_gui_input(event: InputEvent):
|
||||||
if event.is_action_pressed("select"):
|
if event.is_action_pressed("select") and !is_placing:
|
||||||
tile_selected.emit(self)
|
tile_selected.emit(self)
|
||||||
|
|||||||
@ -21,9 +21,12 @@ expand_margin_right = 8.0
|
|||||||
expand_margin_bottom = 8.0
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qqie6"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_qqie6"]
|
||||||
size = Vector2(2, 2)
|
size = Vector2(110, 110)
|
||||||
|
|
||||||
[node name="Turn" type="TextureRect" unique_id=1363157270]
|
[node name="Turn" type="Node2D" unique_id=397844073]
|
||||||
|
script = ExtResource("2_qqie6")
|
||||||
|
|
||||||
|
[node name="Icon" type="TextureRect" parent="." unique_id=1363157270]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
custom_minimum_size = Vector2(100, 100)
|
custom_minimum_size = Vector2(100, 100)
|
||||||
offset_left = -50.0
|
offset_left = -50.0
|
||||||
@ -31,9 +34,8 @@ offset_top = -50.0
|
|||||||
offset_right = 50.0
|
offset_right = 50.0
|
||||||
offset_bottom = 50.0
|
offset_bottom = 50.0
|
||||||
texture = SubResource("AtlasTexture_x2hlk")
|
texture = SubResource("AtlasTexture_x2hlk")
|
||||||
script = ExtResource("2_qqie6")
|
|
||||||
|
|
||||||
[node name="Highlight" type="Panel" parent="." unique_id=715172504]
|
[node name="Highlight" type="Panel" parent="Icon" unique_id=715172504]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
@ -47,13 +49,11 @@ theme_override_styles/panel = SubResource("StyleBoxFlat_qqie6")
|
|||||||
|
|
||||||
[node name="Area2D2" type="Area2D" parent="." unique_id=1370367200]
|
[node name="Area2D2" type="Area2D" parent="." unique_id=1370367200]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
position = Vector2(50, 50)
|
collision_mask = 0
|
||||||
collision_layer = 4
|
|
||||||
collision_mask = 4
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D2" unique_id=1032001784]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D2" unique_id=1032001784]
|
||||||
shape = SubResource("RectangleShape2D_qqie6")
|
shape = SubResource("RectangleShape2D_qqie6")
|
||||||
|
|
||||||
[connection signal="gui_input" from="." to="." method="handle_gui_input"]
|
[connection signal="gui_input" from="Icon" to="." method="handle_gui_input"]
|
||||||
[connection signal="mouse_entered" from="." to="." method="handle_mouse_entered"]
|
[connection signal="mouse_entered" from="Icon" to="." method="handle_turn_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="." to="." method="handle_mouse_exited"]
|
[connection signal="mouse_exited" from="Icon" to="." method="handle_turn_mouse_exited"]
|
||||||
|
|||||||
@ -3,11 +3,29 @@
|
|||||||
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_3bmx7"]
|
[ext_resource type="PackedScene" uid="uid://cdb6bf7dat3bw" path="res://prefabs/tiles/turns/turn.tscn" id="1_3bmx7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3ect2"]
|
[ext_resource type="Texture2D" uid="uid://8b86ftb4iwfj" path="res://assets/Pattern-Panic-10x10/no-background/Points-and-Pulses.png" id="2_3ect2"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sl6be"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_3bmx7"]
|
||||||
atlas = ExtResource("2_3ect2")
|
atlas = ExtResource("2_3ect2")
|
||||||
region = Rect2(0, 11, 9, 9)
|
region = Rect2(0, 11, 9, 9)
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_3ect2"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
bg_color = Color(1, 1, 1, 0)
|
||||||
|
border_width_left = 5
|
||||||
|
border_width_top = 5
|
||||||
|
border_width_right = 5
|
||||||
|
border_width_bottom = 5
|
||||||
|
border_color = Color(1, 1, 1, 1)
|
||||||
|
expand_margin_left = 8.0
|
||||||
|
expand_margin_top = 8.0
|
||||||
|
expand_margin_right = 8.0
|
||||||
|
expand_margin_bottom = 8.0
|
||||||
|
|
||||||
[node name="UpTurn" unique_id=1363157270 instance=ExtResource("1_3bmx7")]
|
[node name="UpTurn" unique_id=1363157270 instance=ExtResource("1_3bmx7")]
|
||||||
texture = SubResource("AtlasTexture_sl6be")
|
|
||||||
flip_v = true
|
|
||||||
direction = 1
|
direction = 1
|
||||||
|
|
||||||
|
[node name="Icon" parent="." index="0" unique_id=1363157270]
|
||||||
|
texture = SubResource("AtlasTexture_3bmx7")
|
||||||
|
flip_v = true
|
||||||
|
|
||||||
|
[node name="Highlight" parent="Icon" index="0" unique_id=715172504]
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_3ect2")
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
extends PanelContainer
|
class_name BuildingSelector extends PanelContainer
|
||||||
|
|
||||||
signal select_building(building: Building)
|
signal select_building(building: Building)
|
||||||
|
|
||||||
@ -26,3 +26,12 @@ func _on_mouse_exited() -> void:
|
|||||||
func _on_gui_input(event: InputEvent) -> void:
|
func _on_gui_input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("select"):
|
if event.is_action_pressed("select"):
|
||||||
select_building.emit(get_child(0))
|
select_building.emit(get_child(0))
|
||||||
|
|
||||||
|
|
||||||
|
func _on_child_entered_tree(node: Node) -> void:
|
||||||
|
if node is Building:
|
||||||
|
await node.ready
|
||||||
|
if is_instance_valid(node.size_node):
|
||||||
|
custom_minimum_size = node.size_node.size + Vector2(10, 10)
|
||||||
|
node.position = position - node.size_node.position
|
||||||
|
node.position += Vector2(5, 5)
|
||||||
|
|||||||
@ -10,9 +10,12 @@ border_color = Color(1, 1, 1, 1)
|
|||||||
[node name="BuildingSelector" type="PanelContainer" unique_id=133308872]
|
[node name="BuildingSelector" type="PanelContainer" unique_id=133308872]
|
||||||
offset_right = 310.0
|
offset_right = 310.0
|
||||||
offset_bottom = 210.0
|
offset_bottom = 210.0
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
size_flags_vertical = 4
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_xurng")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_xurng")
|
||||||
script = ExtResource("1_xurng")
|
script = ExtResource("1_xurng")
|
||||||
|
|
||||||
|
[connection signal="child_entered_tree" from="." to="." method="_on_child_entered_tree"]
|
||||||
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
|
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
|
||||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
|
|||||||
@ -1,24 +1,46 @@
|
|||||||
class_name Controls extends Control
|
class_name Controls extends Control
|
||||||
|
|
||||||
|
const DRAFT_BUILDING_SCENE = preload("uid://87u3upovcueb")
|
||||||
|
|
||||||
var rem_tween: Tween
|
var rem_tween: Tween
|
||||||
|
var hand_tween: Tween
|
||||||
var es_tween: Tween
|
var es_tween: Tween
|
||||||
|
|
||||||
@onready var player_1_label: Label = %Player1Label
|
var draft_building: Building
|
||||||
@onready var player_1_money: Label = %Player1Money
|
|
||||||
@onready var turn_label: Label = %TurnLabel
|
@onready var turn_label: Label = %TurnLabel
|
||||||
|
@onready var player_display: PlayerDisplay = %PlayerDisplay
|
||||||
|
|
||||||
@onready var submit_button: Button = %Submit
|
@onready var submit_button: Button = %Submit
|
||||||
|
@onready var pass_button: Button = %Pass
|
||||||
|
@onready var undo_button: Button = %Undo
|
||||||
@onready var pause_button: Button = %Pause
|
@onready var pause_button: Button = %Pause
|
||||||
@onready var play_button: Button = %Play
|
@onready var play_button: Button = %Play
|
||||||
@onready var blueprints_container: Container = %BlueprintsContainer
|
@onready var rem_button: Button = %RealEstateMarket
|
||||||
@onready var start_walls: Button = %StartWalls
|
@onready var start_walls: Button = %StartWalls
|
||||||
@onready var stop_walls: Button = %StopWalls
|
@onready var stop_walls: Button = %StopWalls
|
||||||
|
@onready var cancel_placement_button: Button = %CancelPlacement
|
||||||
|
|
||||||
|
@onready var blueprints_container: Container = %BlueprintsContainer
|
||||||
|
@onready var draft_container: Container = %DraftContainer
|
||||||
|
@onready var hand: Hand = %Hand
|
||||||
|
|
||||||
@onready var fast_1: Button = %FastForward1
|
@onready var fast_1: Button = %FastForward1
|
||||||
@onready var fast_2: Button = %FastForward2
|
@onready var fast_2: Button = %FastForward2
|
||||||
@onready var fast_4: Button = %FastForward4
|
@onready var fast_4: Button = %FastForward4
|
||||||
@onready var fast_10: Button = %FastForward10
|
@onready var fast_10: Button = %FastForward10
|
||||||
|
|
||||||
|
@onready var draft_cost_container: Container = %DraftCost
|
||||||
|
@onready var draft_cost_spinner: SpinBox = %BuildingDraftCost
|
||||||
|
|
||||||
|
|
||||||
|
func give_hand(buildings: Array[Building]) -> void:
|
||||||
|
hand.give_buildings(buildings)
|
||||||
|
print_debug("this sucks!")
|
||||||
|
await get_tree().process_frame
|
||||||
|
await get_tree().process_frame
|
||||||
|
_show_hand()
|
||||||
|
|
||||||
|
|
||||||
func reset_turn() -> void:
|
func reset_turn() -> void:
|
||||||
get_tree().call_group("Pausable", "pause")
|
get_tree().call_group("Pausable", "pause")
|
||||||
@ -27,24 +49,63 @@ func reset_turn() -> void:
|
|||||||
play_button.hide()
|
play_button.hide()
|
||||||
|
|
||||||
|
|
||||||
func set_turn(turn: int) -> void:
|
func set_info() -> void:
|
||||||
turn_label.text = str(turn)
|
turn_label.text = (
|
||||||
|
"%d.%d"
|
||||||
|
% [Globals.board_game.current_board_state.day, Globals.board_game.current_board_state.turn]
|
||||||
|
)
|
||||||
|
player_display.set_players(Globals.board_game.current_board_state.players)
|
||||||
|
|
||||||
|
|
||||||
func set_players(players: Array[Player]) -> void:
|
func check_controls_enabled() -> void:
|
||||||
_update_player_info(players[0])
|
if Globals.board_game.current_board_state.current_player.id == Globals.game.this_player.id:
|
||||||
players[0].changed.connect(_update_player_info)
|
if Globals.board_game.current_board_state.state != BoardState.State.PLAY:
|
||||||
|
pass_button.hide()
|
||||||
|
submit_button.show()
|
||||||
|
rem_button.disabled = true
|
||||||
|
submit_button.disabled = Globals.board_game.pending_board_state == null
|
||||||
|
else:
|
||||||
|
if Globals.board_game.pending_board_state != null:
|
||||||
|
pass_button.hide()
|
||||||
|
submit_button.show()
|
||||||
|
submit_button.disabled = false
|
||||||
|
undo_button.disabled = false
|
||||||
|
rem_button.disabled = true
|
||||||
|
else:
|
||||||
|
pass_button.show()
|
||||||
|
submit_button.hide()
|
||||||
|
submit_button.disabled = true
|
||||||
|
pass_button.disabled = false
|
||||||
|
undo_button.disabled = true
|
||||||
|
rem_button.disabled = false
|
||||||
|
else:
|
||||||
|
pass_button.show()
|
||||||
|
submit_button.hide()
|
||||||
|
rem_button.disabled = true
|
||||||
|
pass_button.disabled = true
|
||||||
|
undo_button.disabled = true
|
||||||
|
submit_button.disabled = true
|
||||||
|
|
||||||
|
|
||||||
func _update_player_info(player: Player) -> void:
|
func end_day() -> void:
|
||||||
player_1_label.text = "%s:" % player.name
|
undo_button.hide()
|
||||||
player_1_money.text = "$%d" % player.money
|
play_button.hide()
|
||||||
|
pause_button.show()
|
||||||
|
pass_button.hide()
|
||||||
|
submit_button.hide()
|
||||||
|
rem_button.disabled = true
|
||||||
|
|
||||||
|
|
||||||
|
func _on_pass_pressed():
|
||||||
|
Globals.board_game.handle_pass()
|
||||||
|
|
||||||
|
|
||||||
func _on_submit_pressed():
|
func _on_submit_pressed():
|
||||||
get_tree().call_group("Pausable", "unpause")
|
Globals.board_game.handle_board_state_confirmed()
|
||||||
submit_button.hide()
|
|
||||||
pause_button.show()
|
|
||||||
|
func _on_undo_pressed():
|
||||||
|
print("TODO: Handle undo!")
|
||||||
|
|
||||||
|
|
||||||
func _on_pause_pressed():
|
func _on_pause_pressed():
|
||||||
@ -65,16 +126,20 @@ func _on_blueprints_pressed():
|
|||||||
|
|
||||||
func handle_tile_selected(tile: Tile):
|
func handle_tile_selected(tile: Tile):
|
||||||
_hide_real_estate_market()
|
_hide_real_estate_market()
|
||||||
Globals.game.select_tile(tile)
|
Globals.board_game.select_tile(tile)
|
||||||
|
|
||||||
|
|
||||||
func handle_building_selected(building: Building) -> void:
|
func handle_building_selected(building: Building) -> void:
|
||||||
_hide_real_estate_market()
|
_hide_real_estate_market()
|
||||||
Globals.game.select_building(building)
|
var db = building.get_parent().get_parent()
|
||||||
|
if db is DraftBuilding:
|
||||||
|
Globals.board_game.select_building(building, db.get_index())
|
||||||
|
else:
|
||||||
|
Globals.board_game.select_building(building)
|
||||||
|
|
||||||
|
|
||||||
func _on_walls_pressed():
|
func _on_walls_pressed():
|
||||||
Globals.game.place_walls()
|
Globals.board_game.place_walls()
|
||||||
if start_walls.visible:
|
if start_walls.visible:
|
||||||
start_walls.hide()
|
start_walls.hide()
|
||||||
stop_walls.show()
|
stop_walls.show()
|
||||||
@ -90,7 +155,7 @@ func _hide_real_estate_market() -> void:
|
|||||||
rem_tween = create_tween()
|
rem_tween = create_tween()
|
||||||
rem_tween.set_ignore_time_scale(true)
|
rem_tween.set_ignore_time_scale(true)
|
||||||
rem_tween.set_trans(Tween.TRANS_BACK)
|
rem_tween.set_trans(Tween.TRANS_BACK)
|
||||||
rem_tween.tween_property(blueprints_container, "position:y", -450, 0.5)
|
rem_tween.tween_property(blueprints_container, "offset_bottom", 0, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func _show_real_estate_market() -> void:
|
func _show_real_estate_market() -> void:
|
||||||
@ -99,7 +164,27 @@ func _show_real_estate_market() -> void:
|
|||||||
rem_tween = create_tween()
|
rem_tween = create_tween()
|
||||||
rem_tween.set_ignore_time_scale(true)
|
rem_tween.set_ignore_time_scale(true)
|
||||||
rem_tween.set_trans(Tween.TRANS_BACK)
|
rem_tween.set_trans(Tween.TRANS_BACK)
|
||||||
rem_tween.tween_property(blueprints_container, "position:y", 0, 0.5)
|
rem_tween.tween_property(
|
||||||
|
blueprints_container, "offset_bottom", blueprints_container.size.y, 0.5
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
func _hide_hand() -> void:
|
||||||
|
if is_instance_valid(hand_tween):
|
||||||
|
hand_tween.kill()
|
||||||
|
hand_tween = create_tween()
|
||||||
|
hand_tween.set_ignore_time_scale(true)
|
||||||
|
hand_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
hand_tween.tween_property(hand, "offset_top", 0, 0.5)
|
||||||
|
|
||||||
|
|
||||||
|
func _show_hand() -> void:
|
||||||
|
if is_instance_valid(hand_tween):
|
||||||
|
hand_tween.kill()
|
||||||
|
hand_tween = create_tween()
|
||||||
|
hand_tween.set_ignore_time_scale(true)
|
||||||
|
hand_tween.set_trans(Tween.TRANS_BACK)
|
||||||
|
hand_tween.tween_property(hand, "offset_top", -hand.size.y, 0.5)
|
||||||
|
|
||||||
|
|
||||||
func _speed_up_engine(speed: float) -> void:
|
func _speed_up_engine(speed: float) -> void:
|
||||||
@ -140,3 +225,37 @@ func _on_fast_forward_10_pressed():
|
|||||||
fast_2.hide()
|
fast_2.hide()
|
||||||
fast_4.hide()
|
fast_4.hide()
|
||||||
fast_10.hide()
|
fast_10.hide()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_cancel_placement_pressed():
|
||||||
|
_hide_real_estate_market()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_hand_building_selected(building: Building) -> void:
|
||||||
|
for selector in hand.buildings_container.get_children():
|
||||||
|
if selector.get_child(0) != building:
|
||||||
|
selector.hide()
|
||||||
|
draft_building = building
|
||||||
|
draft_cost_container.show()
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func add_to_draft(building_data: Dictionary) -> void:
|
||||||
|
Globals.board_game.add_building_to_draft.rpc()
|
||||||
|
var db: DraftBuilding = DRAFT_BUILDING_SCENE.instantiate()
|
||||||
|
draft_container.add_child(db)
|
||||||
|
draft_building = Building.deserialize(building_data)
|
||||||
|
db.set_building(draft_building)
|
||||||
|
db.building_selector.select_building.connect(handle_building_selected)
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func remove_from_draft(draft_building_index: int) -> void:
|
||||||
|
draft_container.get_child(draft_building_index).queue_free()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_set_draft_cost_pressed():
|
||||||
|
_hide_hand()
|
||||||
|
draft_cost_container.hide()
|
||||||
|
draft_building.cost = roundi(draft_cost_spinner.value)
|
||||||
|
add_to_draft.rpc(draft_building.serialize())
|
||||||
|
|||||||
@ -2,19 +2,13 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cuk0e8hibj3ag" path="res://prefabs/ui/controls.gd" id="1_qhv1l"]
|
[ext_resource type="Script" uid="uid://cuk0e8hibj3ag" path="res://prefabs/ui/controls.gd" id="1_qhv1l"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cisd4grq8kxqn" path="res://prefabs/tiles/turns/up_turn.tscn" id="2_eu1vu"]
|
[ext_resource type="PackedScene" uid="uid://cisd4grq8kxqn" path="res://prefabs/tiles/turns/up_turn.tscn" id="2_eu1vu"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://b83rx8vg6w5g2" path="res://prefabs/ui/player_display.tscn" id="2_x41uu"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ce25rk1nl0pqn" path="res://prefabs/tiles/turns/right_turn.tscn" id="3_7r4kk"]
|
[ext_resource type="PackedScene" uid="uid://ce25rk1nl0pqn" path="res://prefabs/tiles/turns/right_turn.tscn" id="3_7r4kk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://2qudi2d82y73" path="res://prefabs/tiles/turns/down_turn.tscn" id="4_c56vf"]
|
[ext_resource type="PackedScene" uid="uid://2qudi2d82y73" path="res://prefabs/tiles/turns/down_turn.tscn" id="4_c56vf"]
|
||||||
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="5_dxd6m"]
|
[ext_resource type="PackedScene" uid="uid://7jht5hlggey1" path="res://prefabs/tiles/turns/left_turn.tscn" id="5_dxd6m"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cpmlj6muvdwix" path="res://prefabs/ui/building_selector.tscn" id="6_7r4kk"]
|
[ext_resource type="PackedScene" uid="uid://cpmlj6muvdwix" path="res://prefabs/ui/building_selector.tscn" id="6_7r4kk"]
|
||||||
[ext_resource type="PackedScene" uid="uid://mixrqf035krk" path="res://prefabs/tiles/buildings/office.tscn" id="7_c56vf"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bto4vblqk2inb" path="res://prefabs/tiles/buildings/home.tscn" id="7_dxd6m"]
|
[ext_resource type="PackedScene" uid="uid://bto4vblqk2inb" path="res://prefabs/tiles/buildings/home.tscn" id="7_dxd6m"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bytldu3y1jak3" path="res://prefabs/tiles/buildings/hospital.tscn" id="9_j4kb6"]
|
[ext_resource type="Script" uid="uid://s7x0q87dps5d" path="res://prefabs/ui/hand.gd" id="17_r0188"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c06fsqdixer1c" path="res://prefabs/tiles/buildings/bank.tscn" id="10_wxj2g"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cfk268flnsbhb" path="res://prefabs/tiles/buildings/bar.tscn" id="11_sttyi"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dbn63mv0peqf" path="res://prefabs/tiles/buildings/shop.tscn" id="12_w3n6g"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bgtw051fiveeo" path="res://prefabs/tiles/buildings/cafe.tscn" id="13_di23u"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://c1kyedmrep0tu" path="res://prefabs/tiles/buildings/gun_shop.tscn" id="14_hlhh6"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cphy0vtj14ob0" path="res://prefabs/tiles/buildings/fork.tscn" id="15_j8v8t"]
|
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_qhv1l"]
|
[sub_resource type="LabelSettings" id="LabelSettings_qhv1l"]
|
||||||
font_size = 24
|
font_size = 24
|
||||||
@ -39,55 +33,28 @@ font_size = 24
|
|||||||
[sub_resource type="LabelSettings" id="LabelSettings_7r4kk"]
|
[sub_resource type="LabelSettings" id="LabelSettings_7r4kk"]
|
||||||
font_size = 32
|
font_size = 32
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j8v8t"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j4kb6"]
|
||||||
resource_local_to_scene = true
|
resource_local_to_scene = true
|
||||||
bg_color = Color(0, 0, 0, 0)
|
bg_color = Color(0, 0, 0, 0)
|
||||||
border_color = Color(1, 1, 1, 1)
|
border_color = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_c56vf"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wxj2g"]
|
||||||
font_size = 32
|
content_margin_left = 10.0
|
||||||
|
content_margin_top = 10.0
|
||||||
|
content_margin_right = 10.0
|
||||||
|
content_margin_bottom = 10.0
|
||||||
|
bg_color = Color(0, 0, 0, 0.5)
|
||||||
|
corner_radius_top_left = 8
|
||||||
|
corner_radius_top_right = 8
|
||||||
|
expand_margin_bottom = 100.0
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_x41uu"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sttyi"]
|
||||||
resource_local_to_scene = true
|
bg_color = Color(0, 0, 0, 0.75000006)
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_r0188"]
|
[sub_resource type="Theme" id="Theme_w3n6g"]
|
||||||
resource_local_to_scene = true
|
LineEdit/font_sizes/font_size = 32
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5qo6s"]
|
[node name="Controls" type="Control" unique_id=1719205711]
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uprus"]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uqvfp"]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dp4q7"]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qqsac"]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_pc2vv"]
|
|
||||||
resource_local_to_scene = true
|
|
||||||
bg_color = Color(0, 0, 0, 0)
|
|
||||||
border_color = Color(1, 1, 1, 1)
|
|
||||||
|
|
||||||
[node name="Info" type="Control" unique_id=1719205711]
|
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
@ -112,11 +79,25 @@ layout_mode = 2
|
|||||||
size_flags_horizontal = 2
|
size_flags_horizontal = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="Submit" type="Button" parent="HBoxContainer/Controls" unique_id=1480835490]
|
[node name="Undo" type="Button" parent="HBoxContainer/Controls" unique_id=1480835490]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(100, 0)
|
custom_minimum_size = Vector2(100, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "End Turn"
|
disabled = true
|
||||||
|
text = "Undo"
|
||||||
|
|
||||||
|
[node name="Pass" type="Button" parent="HBoxContainer/Controls" unique_id=1183096687]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(100, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Pass"
|
||||||
|
|
||||||
|
[node name="Submit" type="Button" parent="HBoxContainer/Controls" unique_id=122864337]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
custom_minimum_size = Vector2(100, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
disabled = true
|
||||||
|
text = "Confirm"
|
||||||
|
|
||||||
[node name="Pause" type="Button" parent="HBoxContainer/Controls" unique_id=262580515]
|
[node name="Pause" type="Button" parent="HBoxContainer/Controls" unique_id=262580515]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
@ -181,72 +162,60 @@ layout_mode = 2
|
|||||||
text = "0"
|
text = "0"
|
||||||
label_settings = SubResource("LabelSettings_qhv1l")
|
label_settings = SubResource("LabelSettings_qhv1l")
|
||||||
|
|
||||||
[node name="PlayersContainer" type="HBoxContainer" parent="HBoxContainer/Info" unique_id=1863734551]
|
[node name="PlayerDisplay" parent="HBoxContainer/Info" unique_id=1256387228 instance=ExtResource("2_x41uu")]
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
size_flags_vertical = 4
|
|
||||||
theme_override_constants/separation = 10
|
|
||||||
|
|
||||||
[node name="Player1" type="HBoxContainer" parent="HBoxContainer/Info/PlayersContainer" unique_id=810506541]
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_horizontal = 4
|
|
||||||
size_flags_vertical = 4
|
|
||||||
theme_override_constants/separation = 10
|
|
||||||
|
|
||||||
[node name="Player1Label" type="Label" parent="HBoxContainer/Info/PlayersContainer/Player1" unique_id=227651304]
|
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
z_index = 1
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Player:"
|
|
||||||
label_settings = SubResource("LabelSettings_qhv1l")
|
|
||||||
|
|
||||||
[node name="Player1Money" type="Label" parent="HBoxContainer/Info/PlayersContainer/Player1" unique_id=1445460948]
|
|
||||||
unique_name_in_owner = true
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$0"
|
|
||||||
label_settings = SubResource("LabelSettings_qhv1l")
|
|
||||||
|
|
||||||
[node name="TechTree" type="HBoxContainer" parent="HBoxContainer" unique_id=190914575]
|
[node name="TechTree" type="HBoxContainer" parent="HBoxContainer" unique_id=190914575]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 10
|
size_flags_horizontal = 10
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="Blueprints" type="Button" parent="HBoxContainer/TechTree" unique_id=910784690]
|
[node name="RealEstateMarket" type="Button" parent="HBoxContainer/TechTree" unique_id=910784690]
|
||||||
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(150, 0)
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
disabled = true
|
||||||
text = "Real Estate Market"
|
text = "Real Estate Market"
|
||||||
|
|
||||||
[node name="BlueprintsContainer" type="PanelContainer" parent="." unique_id=203025650]
|
[node name="BlueprintsContainer" type="PanelContainer" parent="." unique_id=203025650]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
top_level = true
|
top_level = true
|
||||||
|
z_index = 1
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 10
|
anchors_preset = -1
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
offset_top = -450.0
|
|
||||||
offset_bottom = -3.0
|
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 0
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_qhv1l")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_qhv1l")
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="BlueprintsContainer" unique_id=760987938]
|
[node name="VBoxContainer" type="VBoxContainer" parent="BlueprintsContainer" unique_id=2121800615]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 40
|
|
||||||
|
|
||||||
[node name="Button" type="Button" parent="BlueprintsContainer/HBoxContainer" unique_id=1945532062]
|
[node name="HBoxContainer" type="HBoxContainer" parent="BlueprintsContainer/VBoxContainer" unique_id=760987938]
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_constants/separation = 50
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="CancelPlacement" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=1945532062]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
text = "Cancel Placement"
|
text = "Cancel Placement"
|
||||||
|
|
||||||
[node name="Walls" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer" unique_id=412374904]
|
[node name="Walls" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=412374904]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/Walls" unique_id=1668814316]
|
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls" unique_id=1668814316]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Walls - $1"
|
text = "Walls - $1"
|
||||||
label_settings = SubResource("LabelSettings_eu1vu")
|
label_settings = SubResource("LabelSettings_eu1vu")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="StartWalls" type="Button" parent="BlueprintsContainer/HBoxContainer/Walls" unique_id=645460925]
|
[node name="StartWalls" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls" unique_id=645460925]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(150, 150)
|
custom_minimum_size = Vector2(150, 150)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@ -254,7 +223,7 @@ size_flags_vertical = 6
|
|||||||
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
||||||
text = "Place Walls"
|
text = "Place Walls"
|
||||||
|
|
||||||
[node name="StopWalls" type="Button" parent="BlueprintsContainer/HBoxContainer/Walls" unique_id=2066303633]
|
[node name="StopWalls" type="Button" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls" unique_id=2066303633]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
custom_minimum_size = Vector2(150, 150)
|
custom_minimum_size = Vector2(150, 150)
|
||||||
@ -264,209 +233,145 @@ theme_override_colors/font_color = Color(1, 0, 0, 1)
|
|||||||
text = "Stop Placing
|
text = "Stop Placing
|
||||||
Walls"
|
Walls"
|
||||||
|
|
||||||
[node name="BasicTiles" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer" unique_id=1403203958]
|
[node name="BasicTiles" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=1403203958]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_constants/separation = 16
|
theme_override_constants/separation = 16
|
||||||
alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/BasicTiles" unique_id=1978827830]
|
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles" unique_id=1978827830]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Basic Tiles - $1"
|
text = "Basic Tiles - $1"
|
||||||
label_settings = SubResource("LabelSettings_j4kb6")
|
label_settings = SubResource("LabelSettings_j4kb6")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
[node name="GridContainer" type="GridContainer" parent="BlueprintsContainer/HBoxContainer/BasicTiles" unique_id=219963427]
|
[node name="GridContainer" type="GridContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles" unique_id=219963427]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 6
|
size_flags_vertical = 6
|
||||||
theme_override_constants/h_separation = 10
|
theme_override_constants/h_separation = 10
|
||||||
theme_override_constants/v_separation = 10
|
theme_override_constants/v_separation = 10
|
||||||
columns = 2
|
columns = 4
|
||||||
|
|
||||||
[node name="UpTurn" parent="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=1363157270 instance=ExtResource("2_eu1vu")]
|
[node name="Up" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=748424964]
|
||||||
|
custom_minimum_size = Vector2(110, 110)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="RightTurn" parent="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=1688209745 instance=ExtResource("3_7r4kk")]
|
[node name="UpTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Up" unique_id=1363157270 instance=ExtResource("2_eu1vu")]
|
||||||
|
position = Vector2(55, 55)
|
||||||
|
cost = 1
|
||||||
|
|
||||||
|
[node name="Right" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=1274279814]
|
||||||
|
custom_minimum_size = Vector2(110, 110)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="DownTurn" parent="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=269046840 instance=ExtResource("4_c56vf")]
|
[node name="RightTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Right" unique_id=1688209745 instance=ExtResource("3_7r4kk")]
|
||||||
|
position = Vector2(55, 55)
|
||||||
|
cost = 1
|
||||||
|
|
||||||
|
[node name="Down" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=871055726]
|
||||||
|
custom_minimum_size = Vector2(110, 110)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="LeftTurn" parent="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=1788133401 instance=ExtResource("5_dxd6m")]
|
[node name="DownTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Down" unique_id=269046840 instance=ExtResource("4_c56vf")]
|
||||||
|
position = Vector2(55, 55)
|
||||||
|
cost = 1
|
||||||
|
|
||||||
|
[node name="Left" type="Control" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer" unique_id=496620027]
|
||||||
|
custom_minimum_size = Vector2(110, 110)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Home" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer" unique_id=85382159]
|
[node name="LeftTurn" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Left" unique_id=1788133401 instance=ExtResource("5_dxd6m")]
|
||||||
|
position = Vector2(55, 55)
|
||||||
|
cost = 1
|
||||||
|
|
||||||
|
[node name="Home" type="VBoxContainer" parent="BlueprintsContainer/VBoxContainer/HBoxContainer" unique_id=85382159]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/Home" unique_id=70473481]
|
[node name="Label" type="Label" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home" unique_id=70473481]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "Home - $2"
|
text = "Home - $2"
|
||||||
label_settings = SubResource("LabelSettings_7r4kk")
|
label_settings = SubResource("LabelSettings_7r4kk")
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/Home" unique_id=133308872 instance=ExtResource("6_7r4kk")]
|
[node name="BuildingSelector" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home" unique_id=133308872 instance=ExtResource("6_7r4kk")]
|
||||||
custom_minimum_size = Vector2(110, 110)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
|
||||||
size_flags_vertical = 6
|
size_flags_vertical = 6
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j8v8t")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_j4kb6")
|
||||||
|
|
||||||
[node name="Home" parent="BlueprintsContainer/HBoxContainer/Home/BuildingSelector" unique_id=1701297833 instance=ExtResource("7_dxd6m")]
|
[node name="Home" parent="BlueprintsContainer/VBoxContainer/HBoxContainer/Home/BuildingSelector" unique_id=1701297833 instance=ExtResource("7_dxd6m")]
|
||||||
position = Vector2(55, 55)
|
cost = 2
|
||||||
|
|
||||||
[node name="ScrollContainer" type="ScrollContainer" parent="BlueprintsContainer/HBoxContainer" unique_id=2014532559]
|
[node name="ScrollContainer" type="ScrollContainer" parent="BlueprintsContainer/VBoxContainer" unique_id=2014532559]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
vertical_scroll_mode = 0
|
vertical_scroll_mode = 0
|
||||||
|
|
||||||
[node name="Buildings" type="HBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer" unique_id=86083788]
|
[node name="DraftContainer" type="HBoxContainer" parent="BlueprintsContainer/VBoxContainer/ScrollContainer" unique_id=86083788]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
theme_override_constants/separation = 40
|
theme_override_constants/separation = 40
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
[node name="Building 1" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=1903803082]
|
[node name="Hand" type="PanelContainer" parent="." unique_id=1020425982]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
top_level = true
|
||||||
|
z_index = 1
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = -1
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_wxj2g")
|
||||||
|
script = ExtResource("17_r0188")
|
||||||
|
|
||||||
|
[node name="ScrollContainer" type="ScrollContainer" parent="Hand" unique_id=1666098920]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
vertical_scroll_mode = 0
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 1" unique_id=1748038090]
|
[node name="BuildingsContainer" type="HBoxContainer" parent="Hand/ScrollContainer" unique_id=1415065108]
|
||||||
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
text = "$4"
|
size_flags_horizontal = 3
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
size_flags_vertical = 3
|
||||||
horizontal_alignment = 1
|
alignment = 1
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 1" unique_id=360195179 instance=ExtResource("6_7r4kk")]
|
[node name="DraftCost" type="PanelContainer" parent="." unique_id=598181961]
|
||||||
custom_minimum_size = Vector2(340, 230)
|
unique_name_in_owner = true
|
||||||
layout_mode = 2
|
visible = false
|
||||||
size_flags_vertical = 6
|
top_level = true
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_x41uu")
|
z_index = 1
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_sttyi")
|
||||||
|
|
||||||
[node name="Office" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 1/BuildingSelector" unique_id=746270571 instance=ExtResource("7_c56vf")]
|
[node name="VBoxContainer" type="VBoxContainer" parent="DraftCost" unique_id=1936528719]
|
||||||
position = Vector2(60, 170)
|
|
||||||
|
|
||||||
[node name="Building 2" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=627681188]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 2" unique_id=1716667180]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$6"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 2" unique_id=307256822 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(530, 265)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_r0188")
|
|
||||||
|
|
||||||
[node name="Hospital" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 2/BuildingSelector" unique_id=1503172438 instance=ExtResource("9_j4kb6")]
|
|
||||||
position = Vector2(100, 205)
|
|
||||||
|
|
||||||
[node name="Building 3" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=975407660]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 3" unique_id=795918073]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$4"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 3" unique_id=583706447 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(230, 270)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_5qo6s")
|
|
||||||
|
|
||||||
[node name="Bank" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 3/BuildingSelector" unique_id=973905773 instance=ExtResource("10_wxj2g")]
|
|
||||||
position = Vector2(60, 210)
|
|
||||||
|
|
||||||
[node name="Building 4" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=1457851442]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 4" unique_id=350026086]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$8"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 4" unique_id=136723991 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(120, 310)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_uprus")
|
|
||||||
|
|
||||||
[node name="Bar" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 4/BuildingSelector" unique_id=2099013183 instance=ExtResource("11_sttyi")]
|
|
||||||
position = Vector2(60, 210)
|
|
||||||
|
|
||||||
[node name="Building 5" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=547829632]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 5" unique_id=1524450412]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$8"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 5" unique_id=1337834576 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(270, 270)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_uqvfp")
|
|
||||||
|
|
||||||
[node name="Shop" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 5/BuildingSelector" unique_id=40225851 instance=ExtResource("12_w3n6g")]
|
|
||||||
position = Vector2(60, 170)
|
|
||||||
|
|
||||||
[node name="Building 6" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=399299260]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 6" unique_id=1107358043]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$4"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 6" unique_id=329766743 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(420, 230)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_dp4q7")
|
|
||||||
|
|
||||||
[node name="Cafe" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 6/BuildingSelector" unique_id=1788365156 instance=ExtResource("13_di23u")]
|
|
||||||
position = Vector2(100, 170)
|
|
||||||
|
|
||||||
[node name="Building 7" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=1881374967]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 7" unique_id=1332832346]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$4"
|
|
||||||
label_settings = SubResource("LabelSettings_c56vf")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 7" unique_id=1207846400 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(380, 380)
|
|
||||||
layout_mode = 2
|
|
||||||
size_flags_vertical = 6
|
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_qqsac")
|
|
||||||
|
|
||||||
[node name="GunShop" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 7/BuildingSelector" unique_id=1685600790 instance=ExtResource("14_hlhh6")]
|
|
||||||
position = Vector2(60, 280)
|
|
||||||
|
|
||||||
[node name="Building 8" type="VBoxContainer" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings" unique_id=1965375524]
|
|
||||||
layout_mode = 2
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 8" unique_id=2137971598]
|
|
||||||
layout_mode = 2
|
|
||||||
text = "$3"
|
|
||||||
label_settings = SubResource("LabelSettings_7r4kk")
|
|
||||||
horizontal_alignment = 1
|
|
||||||
|
|
||||||
[node name="BuildingSelector" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 8" unique_id=718642175 instance=ExtResource("6_7r4kk")]
|
|
||||||
custom_minimum_size = Vector2(200, 155)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 6
|
size_flags_vertical = 4
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_pc2vv")
|
alignment = 1
|
||||||
|
|
||||||
[node name="Fork" parent="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 8/BuildingSelector" unique_id=923842683 instance=ExtResource("15_j8v8t")]
|
[node name="BuildingDraftCost" type="SpinBox" parent="DraftCost/VBoxContainer" unique_id=253715570]
|
||||||
position = Vector2(100, 60)
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme = SubResource("Theme_w3n6g")
|
||||||
|
theme_override_constants/buttons_width = 32
|
||||||
|
rounded = true
|
||||||
|
alignment = 1
|
||||||
|
prefix = "$"
|
||||||
|
custom_arrow_step = 1.0
|
||||||
|
|
||||||
|
[node name="SetDraftCost" type="Button" parent="DraftCost/VBoxContainer" unique_id=1834900983]
|
||||||
|
custom_minimum_size = Vector2(250, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_font_sizes/font_size = 32
|
||||||
|
text = "Set Cost"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="HBoxContainer/Controls/Undo" to="." method="_on_undo_pressed"]
|
||||||
|
[connection signal="pressed" from="HBoxContainer/Controls/Pass" to="." method="_on_pass_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Controls/Submit" to="." method="_on_submit_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/Submit" to="." method="_on_submit_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Controls/Pause" to="." method="_on_pause_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/Pause" to="." method="_on_pause_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Controls/Play" to="." method="_on_play_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/Play" to="." method="_on_play_pressed"]
|
||||||
@ -474,19 +379,14 @@ position = Vector2(100, 60)
|
|||||||
[connection signal="pressed" from="HBoxContainer/Controls/FastForward2" to="." method="_on_fast_forward_2_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/FastForward2" to="." method="_on_fast_forward_2_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Controls/FastForward4" to="." method="_on_fast_forward_4_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/FastForward4" to="." method="_on_fast_forward_4_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/Controls/FastForward10" to="." method="_on_fast_forward_10_pressed"]
|
[connection signal="pressed" from="HBoxContainer/Controls/FastForward10" to="." method="_on_fast_forward_10_pressed"]
|
||||||
[connection signal="pressed" from="HBoxContainer/TechTree/Blueprints" to="." method="_on_blueprints_pressed"]
|
[connection signal="pressed" from="HBoxContainer/TechTree/RealEstateMarket" to="." method="_on_blueprints_pressed"]
|
||||||
[connection signal="pressed" from="BlueprintsContainer/HBoxContainer/Walls/StartWalls" to="." method="_on_walls_pressed"]
|
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/CancelPlacement" to="." method="_on_cancel_placement_pressed"]
|
||||||
[connection signal="pressed" from="BlueprintsContainer/HBoxContainer/Walls/StopWalls" to="." method="_on_walls_pressed"]
|
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls/StartWalls" to="." method="_on_walls_pressed"]
|
||||||
[connection signal="tile_selected" from="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer/UpTurn" to="." method="handle_tile_selected"]
|
[connection signal="pressed" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Walls/StopWalls" to="." method="_on_walls_pressed"]
|
||||||
[connection signal="tile_selected" from="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer/RightTurn" to="." method="handle_tile_selected"]
|
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Up/UpTurn" to="." method="handle_tile_selected"]
|
||||||
[connection signal="tile_selected" from="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer/DownTurn" to="." method="handle_tile_selected"]
|
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Right/RightTurn" to="." method="handle_tile_selected"]
|
||||||
[connection signal="tile_selected" from="BlueprintsContainer/HBoxContainer/BasicTiles/GridContainer/LeftTurn" to="." method="handle_tile_selected"]
|
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Down/DownTurn" to="." method="handle_tile_selected"]
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/Home/BuildingSelector" to="." method="handle_building_selected"]
|
[connection signal="tile_selected" from="BlueprintsContainer/VBoxContainer/HBoxContainer/BasicTiles/GridContainer/Left/LeftTurn" to="." method="handle_tile_selected"]
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 1/BuildingSelector" to="." method="handle_building_selected"]
|
[connection signal="select_building" from="BlueprintsContainer/VBoxContainer/HBoxContainer/Home/BuildingSelector" to="." method="handle_building_selected"]
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 2/BuildingSelector" to="." method="handle_building_selected"]
|
[connection signal="building_selected" from="Hand" to="." method="_on_hand_building_selected"]
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 3/BuildingSelector" to="." method="handle_building_selected"]
|
[connection signal="pressed" from="DraftCost/VBoxContainer/SetDraftCost" to="." method="_on_set_draft_cost_pressed"]
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 4/BuildingSelector" to="." method="handle_building_selected"]
|
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 5/BuildingSelector" to="." method="handle_building_selected"]
|
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 6/BuildingSelector" to="." method="handle_building_selected"]
|
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 7/BuildingSelector" to="." method="handle_building_selected"]
|
|
||||||
[connection signal="select_building" from="BlueprintsContainer/HBoxContainer/ScrollContainer/Buildings/Building 8/BuildingSelector" to="." method="handle_building_selected"]
|
|
||||||
|
|||||||
9
prefabs/ui/draft_building.gd
Normal file
9
prefabs/ui/draft_building.gd
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
class_name DraftBuilding extends VBoxContainer
|
||||||
|
|
||||||
|
@onready var cost_label: Label = %Cost
|
||||||
|
@onready var building_selector: BuildingSelector = %BuildingSelector
|
||||||
|
|
||||||
|
|
||||||
|
func set_building(building: Building) -> void:
|
||||||
|
cost_label.text = "$%d" % building.cost
|
||||||
|
building_selector.add_child(building)
|
||||||
1
prefabs/ui/draft_building.gd.uid
Normal file
1
prefabs/ui/draft_building.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://b55t6tsxfbslo
|
||||||
32
prefabs/ui/draft_building.tscn
Normal file
32
prefabs/ui/draft_building.tscn
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[gd_scene format=3 uid="uid://87u3upovcueb"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cpmlj6muvdwix" path="res://prefabs/ui/building_selector.tscn" id="1_4y2me"]
|
||||||
|
[ext_resource type="Script" uid="uid://b55t6tsxfbslo" path="res://prefabs/ui/draft_building.gd" id="1_k5a3v"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_k5a3v"]
|
||||||
|
font_size = 24
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_k5a3v"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
bg_color = Color(0, 0, 0, 0)
|
||||||
|
border_color = Color(1, 1, 1, 1)
|
||||||
|
|
||||||
|
[node name="DraftBuilding" type="VBoxContainer" unique_id=873203889]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_k5a3v")
|
||||||
|
|
||||||
|
[node name="Cost" type="Label" parent="." unique_id=935142686]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "$0"
|
||||||
|
label_settings = SubResource("LabelSettings_k5a3v")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="BuildingSelector" parent="." unique_id=133308872 instance=ExtResource("1_4y2me")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_k5a3v")
|
||||||
6
prefabs/ui/game_over.gd
Normal file
6
prefabs/ui/game_over.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
extends PanelContainer
|
||||||
|
|
||||||
|
|
||||||
|
func set_winning_player(player: Player) -> void:
|
||||||
|
get_child(0).get_child(0).text = player.name
|
||||||
|
show()
|
||||||
1
prefabs/ui/game_over.gd.uid
Normal file
1
prefabs/ui/game_over.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bye5rf7kk0qi7
|
||||||
22
prefabs/ui/hand.gd
Normal file
22
prefabs/ui/hand.gd
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
class_name Hand extends PanelContainer
|
||||||
|
|
||||||
|
signal building_selected(building: Building)
|
||||||
|
|
||||||
|
const BUILDING_SELECTOR_SCENE = preload("uid://cpmlj6muvdwix")
|
||||||
|
|
||||||
|
@onready var buildings_container: Container = %BuildingsContainer
|
||||||
|
|
||||||
|
|
||||||
|
func give_buildings(buildings: Array[Building]) -> void:
|
||||||
|
for child in buildings_container.get_children():
|
||||||
|
child.free()
|
||||||
|
for building in buildings:
|
||||||
|
var selector: BuildingSelector = BUILDING_SELECTOR_SCENE.instantiate()
|
||||||
|
selector.select_building.connect(building_selected.emit)
|
||||||
|
selector.call_deferred("add_child", building.duplicate())
|
||||||
|
buildings_container.call_deferred("add_child", selector)
|
||||||
|
|
||||||
|
|
||||||
|
func _handle_building_selected(_building: Building) -> void:
|
||||||
|
for child in buildings_container.get_children():
|
||||||
|
child.queue_free()
|
||||||
1
prefabs/ui/hand.gd.uid
Normal file
1
prefabs/ui/hand.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://s7x0q87dps5d
|
||||||
66
prefabs/ui/player_display.gd
Normal file
66
prefabs/ui/player_display.gd
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
class_name PlayerDisplay extends Control
|
||||||
|
|
||||||
|
const PLAYER_INFO_SCENE = preload("uid://8sd8fkx3hua0")
|
||||||
|
|
||||||
|
var reveal_tween: Tween
|
||||||
|
|
||||||
|
#func _ready() -> void:
|
||||||
|
#var player_1 = Player.new()
|
||||||
|
#player_1.name = "Duncan"
|
||||||
|
#player_1.color = Color.AQUA
|
||||||
|
#var player_2 = Player.new()
|
||||||
|
#player_2.name = "Tyler"
|
||||||
|
#player_2.color = Color.CHARTREUSE
|
||||||
|
#var player_3 = Player.new()
|
||||||
|
#player_3.name = "Rob"
|
||||||
|
#player_3.color = Color.DARK_MAGENTA
|
||||||
|
#var player_4 = Player.new()
|
||||||
|
#player_4.name = "Lucas"
|
||||||
|
#player_4.color = Color.YELLOW
|
||||||
|
#set_players([player_1, player_2, player_3, player_4])
|
||||||
|
|
||||||
|
|
||||||
|
func set_players(players: Array[Player]) -> void:
|
||||||
|
for child in get_children():
|
||||||
|
child.free()
|
||||||
|
for player in players:
|
||||||
|
var player_info: PlayerInfo = PLAYER_INFO_SCENE.instantiate()
|
||||||
|
add_child(player_info)
|
||||||
|
player_info.set_player(player)
|
||||||
|
player_info.modulate = Color(1, 1, 1, 0)
|
||||||
|
get_child(0).modulate = Color(1, 1, 1, 1)
|
||||||
|
await get_tree().process_frame
|
||||||
|
var max_child_size: float = 0
|
||||||
|
for i in range(get_child_count() - 1):
|
||||||
|
max_child_size = maxf(max_child_size, maxf(get_child(i).size.x, get_child(i + 1).size.x))
|
||||||
|
custom_minimum_size = Vector2(max_child_size, get_child(0).size.y)
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_entered():
|
||||||
|
_reveal_players()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_mouse_exited():
|
||||||
|
_hide_players()
|
||||||
|
|
||||||
|
|
||||||
|
func _reveal_players() -> void:
|
||||||
|
if get_child_count() <= 1:
|
||||||
|
return
|
||||||
|
if is_instance_valid(reveal_tween):
|
||||||
|
reveal_tween.kill()
|
||||||
|
reveal_tween = create_tween()
|
||||||
|
for i in range(1, get_child_count()):
|
||||||
|
reveal_tween.parallel().tween_property(get_child(i), "modulate", Color(1, 1, 1, 1), 0.25)
|
||||||
|
reveal_tween.parallel().tween_property(get_child(i), "position", Vector2(0, 40 * i), 0.25)
|
||||||
|
|
||||||
|
|
||||||
|
func _hide_players() -> void:
|
||||||
|
if get_child_count() <= 1:
|
||||||
|
return
|
||||||
|
if is_instance_valid(reveal_tween):
|
||||||
|
reveal_tween.kill()
|
||||||
|
reveal_tween = create_tween()
|
||||||
|
for i in range(1, get_child_count()):
|
||||||
|
reveal_tween.parallel().tween_property(get_child(i), "modulate", Color(1, 1, 1, 0), 0.25)
|
||||||
|
reveal_tween.parallel().tween_property(get_child(i), "position", Vector2(0, 0), 0.25)
|
||||||
1
prefabs/ui/player_display.gd.uid
Normal file
1
prefabs/ui/player_display.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bq8y83dlpxlv
|
||||||
12
prefabs/ui/player_display.tscn
Normal file
12
prefabs/ui/player_display.tscn
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene format=3 uid="uid://b83rx8vg6w5g2"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bq8y83dlpxlv" path="res://prefabs/ui/player_display.gd" id="1_kasli"]
|
||||||
|
|
||||||
|
[node name="PlayerDisplay" type="Control" unique_id=1256387228]
|
||||||
|
custom_minimum_size = Vector2(0, 40)
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 0
|
||||||
|
script = ExtResource("1_kasli")
|
||||||
|
|
||||||
|
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||||
15
prefabs/ui/player_info.gd
Normal file
15
prefabs/ui/player_info.gd
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
class_name PlayerInfo extends HBoxContainer
|
||||||
|
|
||||||
|
@onready var name_label: Label = %Name
|
||||||
|
@onready var money_label: Label = %Money
|
||||||
|
|
||||||
|
|
||||||
|
func set_player(player: Player) -> void:
|
||||||
|
player.changed.connect(_update_player_info)
|
||||||
|
name_label.text = player.name
|
||||||
|
name_label.label_settings.font_color = player.color
|
||||||
|
money_label.text = "$%s" % str(player.money)
|
||||||
|
|
||||||
|
|
||||||
|
func _update_player_info(player: Player) -> void:
|
||||||
|
money_label.text = "$%s" % str(player.money)
|
||||||
1
prefabs/ui/player_info.gd.uid
Normal file
1
prefabs/ui/player_info.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://ccx3jyc31veok
|
||||||
32
prefabs/ui/player_info.tscn
Normal file
32
prefabs/ui/player_info.tscn
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[gd_scene format=3 uid="uid://8sd8fkx3hua0"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://ccx3jyc31veok" path="res://prefabs/ui/player_info.gd" id="1_tautg"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_lpiko"]
|
||||||
|
resource_local_to_scene = true
|
||||||
|
font_size = 24
|
||||||
|
outline_size = 4
|
||||||
|
outline_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_tautg"]
|
||||||
|
font_size = 24
|
||||||
|
font_color = Color(0, 0, 0, 1)
|
||||||
|
outline_size = 4
|
||||||
|
|
||||||
|
[node name="PlayerInfo" type="HBoxContainer" unique_id=1335388560]
|
||||||
|
offset_right = 40.0
|
||||||
|
offset_bottom = 40.0
|
||||||
|
theme_override_constants/separation = 16
|
||||||
|
script = ExtResource("1_tautg")
|
||||||
|
|
||||||
|
[node name="Name" type="Label" parent="." unique_id=402118000]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Player"
|
||||||
|
label_settings = SubResource("LabelSettings_lpiko")
|
||||||
|
|
||||||
|
[node name="Money" type="Label" parent="." unique_id=303974868]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
layout_mode = 2
|
||||||
|
text = "$0"
|
||||||
|
label_settings = SubResource("LabelSettings_tautg")
|
||||||
@ -23,6 +23,12 @@ Globals="*uid://by6sqqjd2g0ct"
|
|||||||
|
|
||||||
enabled=PackedStringArray("res://addons/format_on_save/plugin.cfg", "res://addons/gdlint_plugin/plugin.cfg", "res://addons/tube/plugin.cfg")
|
enabled=PackedStringArray("res://addons/format_on_save/plugin.cfg", "res://addons/gdlint_plugin/plugin.cfg", "res://addons/tube/plugin.cfg")
|
||||||
|
|
||||||
|
[game]
|
||||||
|
|
||||||
|
config/use_web_tube_context=true
|
||||||
|
config/use_web_tube_context.editor_hint=false
|
||||||
|
config/use_web_tube_context.editor_runtime=false
|
||||||
|
|
||||||
[global_group]
|
[global_group]
|
||||||
|
|
||||||
Pausable="Only activates on turn end."
|
Pausable="Only activates on turn end."
|
||||||
@ -94,6 +100,12 @@ rotate_tile_down={
|
|||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(228, 11),"global_position":Vector2(237, 59),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":16,"position":Vector2(228, 11),"global_position":Vector2(237, 59),"factor":1.0,"button_index":5,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
camera_engage={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|||||||
56
resources/board_state.gd
Normal file
56
resources/board_state.gd
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
class_name BoardState
|
||||||
|
|
||||||
|
enum State { INITIAL_SETUP, DRAFT, PLAY }
|
||||||
|
|
||||||
|
var day: int = 0
|
||||||
|
var turn: int = 0
|
||||||
|
var state: State = State.INITIAL_SETUP
|
||||||
|
var current_player: Player
|
||||||
|
var players: Array[Player] = []
|
||||||
|
var tiles: Array[Tile] = []
|
||||||
|
var buildings: Array[Building] = []
|
||||||
|
var players_passed: int = 0
|
||||||
|
|
||||||
|
|
||||||
|
func get_this_player_index() -> int:
|
||||||
|
return players.find_custom(func(p: Player) -> bool: return p.id == Globals.game.this_player.id)
|
||||||
|
|
||||||
|
|
||||||
|
func get_current_player_index() -> int:
|
||||||
|
return players.find_custom(func(p: Player) -> bool: return p.id == current_player.id)
|
||||||
|
|
||||||
|
|
||||||
|
func serialize() -> Dictionary:
|
||||||
|
var result = {}
|
||||||
|
result["day"] = day
|
||||||
|
result["turn"] = turn
|
||||||
|
result["state"] = state
|
||||||
|
result["players_passed"] = players_passed
|
||||||
|
result["current_player"] = current_player.serialize()
|
||||||
|
result["players"] = []
|
||||||
|
for p in players:
|
||||||
|
result["players"].append(p.serialize())
|
||||||
|
result["tiles"] = []
|
||||||
|
for t in tiles:
|
||||||
|
if is_instance_valid(t):
|
||||||
|
result["tiles"].append(t.serialize())
|
||||||
|
result["buildings"] = []
|
||||||
|
for b in buildings:
|
||||||
|
result["buildings"].append(b.serialize())
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func deserialize(data: Dictionary) -> BoardState:
|
||||||
|
var result = BoardState.new()
|
||||||
|
result.day = data["day"]
|
||||||
|
result.turn = data["turn"]
|
||||||
|
result.state = data["state"]
|
||||||
|
result.players_passed = data["players_passed"]
|
||||||
|
result.current_player = Player.deserialize(data["current_player"])
|
||||||
|
for p in data["players"]:
|
||||||
|
result.players.append(Player.deserialize(p))
|
||||||
|
for t in data["tiles"]:
|
||||||
|
result.tiles.append(Tile.deserialize(t))
|
||||||
|
for b in data["buildings"]:
|
||||||
|
result.buildings.append(Building.deserialize(b))
|
||||||
|
return result
|
||||||
1
resources/board_state.gd.uid
Normal file
1
resources/board_state.gd.uid
Normal file
@ -0,0 +1 @@
|
|||||||
|
uid://bjr1m1p8m265o
|
||||||
@ -1,3 +1,5 @@
|
|||||||
class_name GlobalController extends Node
|
class_name GlobalController extends Node
|
||||||
|
|
||||||
var game: Game
|
var game: Game
|
||||||
|
var main_menu: MainMenu
|
||||||
|
var board_game: BoardGame
|
||||||
|
|||||||
8
resources/local_tube_context.tres
Normal file
8
resources/local_tube_context.tres
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="TubeContext" format=3 uid="uid://c4wgewmmuj74g"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://t4pe7yqc3pnt" path="res://addons/tube/tube_context.gd" id="1_h3gtd"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_h3gtd")
|
||||||
|
app_id = "g^o#isR0W!x|+?8"
|
||||||
|
metadata/_custom_type_script = "uid://t4pe7yqc3pnt"
|
||||||
@ -1,8 +1,27 @@
|
|||||||
class_name Player extends Resource
|
class_name Player extends Resource
|
||||||
|
|
||||||
|
var id: int = randi()
|
||||||
var name: String = "Player"
|
var name: String = "Player"
|
||||||
var money: int = 10:
|
var money: int = 10:
|
||||||
set(value):
|
set(value):
|
||||||
money = value
|
money = value
|
||||||
changed.emit(self)
|
changed.emit(self)
|
||||||
var color: Color = Color(0, 0, 1, 1)
|
var color: Color = Color(randf(), randf(), randf())
|
||||||
|
|
||||||
|
|
||||||
|
func serialize() -> Dictionary:
|
||||||
|
var result = {}
|
||||||
|
result["id"] = id
|
||||||
|
result["name"] = name
|
||||||
|
result["color"] = color
|
||||||
|
result["money"] = money
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
static func deserialize(data: Dictionary) -> Player:
|
||||||
|
var result = Player.new()
|
||||||
|
result.id = data["id"]
|
||||||
|
result.name = data["name"]
|
||||||
|
result.color = data["color"]
|
||||||
|
result.money = data["money"]
|
||||||
|
return result
|
||||||
|
|||||||
10
resources/web_tube_context.tres
Normal file
10
resources/web_tube_context.tres
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="TubeContext" format=3 uid="uid://berd4vlwkh1no"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://t4pe7yqc3pnt" path="res://addons/tube/tube_context.gd" id="1_612oo"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_612oo")
|
||||||
|
app_id = "g^o#isR0W!x|+?8"
|
||||||
|
trackers_urls = Array[String](["wss://tracker.openwebtorrent.com", "wss://tracker.files.fm:7073/announce", "wss://tracker.btorrent.xyz/", "wss://tracker.ghostchu-services.top:443/announce"])
|
||||||
|
stun_servers_urls = Array[String](["stun:stun.l.google.com:19302", "stun:stun.cloudflare.com:3478", "stun:stun.bethesda.net:3478"])
|
||||||
|
metadata/_custom_type_script = "uid://t4pe7yqc3pnt"
|
||||||
@ -1,67 +1,163 @@
|
|||||||
class_name BoardGame extends Control
|
class_name BoardGame extends Node
|
||||||
|
|
||||||
const DOWN_SPAWN_SCENE = preload("uid://d4ltd1geg7s2p")
|
const HOME_SCENE = preload("uid://bto4vblqk2inb")
|
||||||
|
#const DOWN_SPAWN_SCENE = preload("uid://d4ltd1geg7s2p")
|
||||||
|
|
||||||
|
const BANK_SCENE = preload("uid://c06fsqdixer1c")
|
||||||
|
const BAR_SCENE = preload("uid://cfk268flnsbhb")
|
||||||
|
const CAFE_SCENE = preload("uid://bgtw051fiveeo")
|
||||||
|
const FORK_SCENE = preload("uid://cphy0vtj14ob0")
|
||||||
|
const GUN_SHOP_SCENE = preload("uid://c1kyedmrep0tu")
|
||||||
|
const HOSPITAL_SCENE = preload("uid://bytldu3y1jak3")
|
||||||
|
const OFFICE_SCENE = preload("uid://mixrqf035krk")
|
||||||
|
const SHOP_SCENE = preload("uid://dbn63mv0peqf")
|
||||||
|
|
||||||
|
const BASE_DECK = [
|
||||||
|
BANK_SCENE,
|
||||||
|
BAR_SCENE,
|
||||||
|
CAFE_SCENE,
|
||||||
|
FORK_SCENE,
|
||||||
|
GUN_SHOP_SCENE,
|
||||||
|
HOSPITAL_SCENE,
|
||||||
|
OFFICE_SCENE,
|
||||||
|
SHOP_SCENE
|
||||||
|
]
|
||||||
|
|
||||||
var turn: int = 0:
|
|
||||||
set(value):
|
|
||||||
turn = value
|
|
||||||
controls.set_turn(turn)
|
|
||||||
var player: Player
|
|
||||||
var citizen_count: int = 0:
|
var citizen_count: int = 0:
|
||||||
set(value):
|
set(value):
|
||||||
print(value)
|
#print(value)
|
||||||
citizen_count = value
|
citizen_count = value
|
||||||
if citizen_count == 0:
|
if citizen_count == 0:
|
||||||
handle_turn_over()
|
handle_citizens_finished()
|
||||||
|
|
||||||
var spawn_placement_actions = 0
|
var buildings_added_to_draft: int = 0
|
||||||
|
var homes_placed: int = 0
|
||||||
|
var spawn_placement_actions: int = 0
|
||||||
|
var draft_index_to_be_deleted: int = -1
|
||||||
|
|
||||||
|
var current_board_state: BoardState:
|
||||||
|
set(value):
|
||||||
|
current_board_state = value
|
||||||
|
controls.check_controls_enabled()
|
||||||
|
controls.set_info()
|
||||||
|
|
||||||
|
var pending_board_state: BoardState:
|
||||||
|
set(value):
|
||||||
|
pending_board_state = value
|
||||||
|
controls.check_controls_enabled()
|
||||||
|
|
||||||
|
var deck: Array[Building] = []
|
||||||
|
|
||||||
@onready var board: Board = %Board
|
@onready var board: Board = %Board
|
||||||
@onready var controls: Controls = %Controls
|
@onready var controls: Controls = %Controls
|
||||||
|
@onready var game_over: Control = %GameOver
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
Globals.board_game = self
|
Globals.board_game = self
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
player = Player.new()
|
func setup_building_deck() -> void:
|
||||||
controls.set_players([player])
|
for i in range(current_board_state.players.size()):
|
||||||
start_turn()
|
for scene in BASE_DECK:
|
||||||
|
deck.append(scene.instantiate())
|
||||||
|
|
||||||
|
|
||||||
func start_turn() -> void:
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
turn += 1
|
func set_board_state(board_state: Dictionary) -> void:
|
||||||
if spawn_placement_actions > 0:
|
current_board_state = BoardState.deserialize(board_state)
|
||||||
board.set_active_tile(DOWN_SPAWN_SCENE.instantiate())
|
board.reset()
|
||||||
|
board.set_board_state(current_board_state)
|
||||||
|
if current_board_state.state == BoardState.State.INITIAL_SETUP:
|
||||||
|
if Globals.game.this_player.id == current_board_state.current_player.id:
|
||||||
|
board.set_active_building(HOME_SCENE.instantiate())
|
||||||
|
elif current_board_state.state == BoardState.State.DRAFT:
|
||||||
|
start_day()
|
||||||
|
if current_board_state.players_passed == Globals.game.players.size():
|
||||||
|
end_day()
|
||||||
|
|
||||||
|
|
||||||
func select_tile(tile: Tile):
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
board.set_active_tile(tile)
|
func add_building_to_draft() -> void:
|
||||||
|
buildings_added_to_draft += 1
|
||||||
|
if buildings_added_to_draft >= Globals.game.players.size():
|
||||||
|
current_board_state.state = BoardState.State.PLAY
|
||||||
|
controls.check_controls_enabled()
|
||||||
|
|
||||||
|
|
||||||
func select_building(building: Building) -> void:
|
func select_tile(tile: Tile) -> void:
|
||||||
if building is Home:
|
board.set_active_tile(tile.duplicate())
|
||||||
board.set_active_building(building, player)
|
|
||||||
|
|
||||||
|
func select_building(building: Building, delete_index: int = -1) -> void:
|
||||||
|
board.set_active_building(building.duplicate())
|
||||||
|
draft_index_to_be_deleted = delete_index
|
||||||
|
|
||||||
|
|
||||||
|
func start_day() -> void:
|
||||||
|
current_board_state.day += 1
|
||||||
|
current_board_state.turn = 1
|
||||||
|
seed(Globals.game.sum_player_ids())
|
||||||
|
deck.shuffle()
|
||||||
|
var turn_index := current_board_state.get_this_player_index()
|
||||||
|
controls.give_hand(deck.slice(0 + (3 * turn_index), 3 + (3 * turn_index)))
|
||||||
|
controls.set_info()
|
||||||
|
|
||||||
|
|
||||||
|
func end_day() -> void:
|
||||||
|
controls.end_day()
|
||||||
|
get_tree().call_group("Pausable", "unpause")
|
||||||
|
|
||||||
|
|
||||||
|
func handle_board_state_changed() -> void:
|
||||||
|
pending_board_state = BoardState.new()
|
||||||
|
pending_board_state.day = current_board_state.day
|
||||||
|
pending_board_state.turn = current_board_state.turn + 1
|
||||||
|
if pending_board_state.turn == 0:
|
||||||
|
pending_board_state.state = BoardState.State.DRAFT
|
||||||
else:
|
else:
|
||||||
board.set_active_building(building)
|
pending_board_state.state = current_board_state.state
|
||||||
|
pending_board_state.players = current_board_state.players
|
||||||
|
pending_board_state.players.push_back(pending_board_state.players.pop_front())
|
||||||
|
pending_board_state.current_player = current_board_state.players[0]
|
||||||
|
pending_board_state.tiles = board.tiles.values()
|
||||||
|
for building in board.buildings.values():
|
||||||
|
if !pending_board_state.buildings.has(building):
|
||||||
|
pending_board_state.buildings.append(building)
|
||||||
|
controls.check_controls_enabled()
|
||||||
|
|
||||||
|
|
||||||
func place_walls() -> void:
|
func handle_board_state_confirmed() -> void:
|
||||||
board.is_placing_walls = !board.is_placing_walls
|
current_board_state.players_passed = 0
|
||||||
|
set_board_state.rpc(pending_board_state.serialize())
|
||||||
|
pending_board_state = null
|
||||||
|
if draft_index_to_be_deleted != -1:
|
||||||
|
controls.remove_from_draft.rpc(draft_index_to_be_deleted)
|
||||||
|
draft_index_to_be_deleted = -1
|
||||||
|
|
||||||
|
|
||||||
func handle_turn_over() -> void:
|
func handle_pass() -> void:
|
||||||
get_tree().call_group("PostTurnActions", "handle_post_turn_actions")
|
current_board_state.players_passed += 1
|
||||||
|
current_board_state.turn += 1
|
||||||
|
current_board_state.players.push_back(current_board_state.players.pop_front())
|
||||||
|
current_board_state.current_player = current_board_state.players[0]
|
||||||
|
set_board_state.rpc(current_board_state.serialize())
|
||||||
|
|
||||||
|
|
||||||
|
func handle_citizens_finished() -> void:
|
||||||
|
for child in board.board_state.get_children():
|
||||||
|
if child.get_groups().has("PostTurnActions"):
|
||||||
|
child.handle_post_turn_actions()
|
||||||
controls.reset_turn()
|
controls.reset_turn()
|
||||||
start_turn()
|
var winning_player_idx = current_board_state.players.find_custom(
|
||||||
|
func(p: Player) -> bool: return p.money >= 100
|
||||||
|
)
|
||||||
|
if winning_player_idx != -1:
|
||||||
|
game_over.set_winning_player(current_board_state.players[winning_player_idx])
|
||||||
|
else:
|
||||||
|
start_day()
|
||||||
|
|
||||||
|
|
||||||
func queue_spawn_placement(num: int) -> void:
|
func queue_spawn_placement(_num_placements: int) -> void:
|
||||||
spawn_placement_actions += num
|
print("Handle queueing spawn placements")
|
||||||
|
|
||||||
|
|
||||||
func handle_spawn_placed() -> void:
|
|
||||||
spawn_placement_actions = maxi(spawn_placement_actions - 1, 0)
|
|
||||||
if spawn_placement_actions > 0:
|
|
||||||
board.set_active_tile(DOWN_SPAWN_SCENE.instantiate())
|
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
[gd_scene format=3 uid="uid://dmqvnr7uev0i6"]
|
[gd_scene format=3 uid="uid://dmqvnr7uev0i6"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://caq4f3l237i42" path="res://prefabs/ui/controls.tscn" id="1_8orke"]
|
[ext_resource type="PackedScene" uid="uid://caq4f3l237i42" path="res://prefabs/ui/controls.tscn" id="1_8orke"]
|
||||||
|
[ext_resource type="Script" uid="uid://p10j5v8tlyb" path="res://scenes/board_game.gd" id="1_v8odh"]
|
||||||
[ext_resource type="Script" uid="uid://c5vwubjdr23jr" path="res://prefabs/game_camera.gd" id="2_v8odh"]
|
[ext_resource type="Script" uid="uid://c5vwubjdr23jr" path="res://prefabs/game_camera.gd" id="2_v8odh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ct6tclctgdrkm" path="res://prefabs/board.tscn" id="3_02cv7"]
|
[ext_resource type="PackedScene" uid="uid://ct6tclctgdrkm" path="res://prefabs/board.tscn" id="3_02cv7"]
|
||||||
|
[ext_resource type="Script" uid="uid://bye5rf7kk0qi7" path="res://prefabs/ui/game_over.gd" id="5_02cv7"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fc0e3"]
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_fc0e3"]
|
||||||
content_margin_left = 10.0
|
content_margin_left = 10.0
|
||||||
@ -18,7 +20,10 @@ corner_radius_top_right = 16
|
|||||||
corner_radius_bottom_right = 16
|
corner_radius_bottom_right = 16
|
||||||
corner_radius_bottom_left = 16
|
corner_radius_bottom_left = 16
|
||||||
|
|
||||||
[node name="GameContainer" type="PanelContainer" unique_id=1427225690]
|
[node name="BoardGame" type="Node" unique_id=899693855]
|
||||||
|
script = ExtResource("1_v8odh")
|
||||||
|
|
||||||
|
[node name="GameContainer" type="PanelContainer" parent="." unique_id=1427225690]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
@ -26,38 +31,38 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_fc0e3")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_fc0e3")
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=348137536]
|
[node name="VBoxContainer" type="VBoxContainer" parent="GameContainer" unique_id=348137536]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="Controls" parent="VBoxContainer" unique_id=1719205711 instance=ExtResource("1_8orke")]
|
[node name="Controls" parent="GameContainer/VBoxContainer" unique_id=1719205711 instance=ExtResource("1_8orke")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
custom_minimum_size = Vector2(0, 50)
|
custom_minimum_size = Vector2(0, 50)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
|
||||||
[node name="PanelContainer" type="PanelContainer" parent="VBoxContainer" unique_id=511396372]
|
[node name="PanelContainer" type="PanelContainer" parent="GameContainer/VBoxContainer" unique_id=511396372]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme_override_styles/panel = SubResource("StyleBoxFlat_7jktm")
|
theme_override_styles/panel = SubResource("StyleBoxFlat_7jktm")
|
||||||
|
|
||||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="VBoxContainer/PanelContainer" unique_id=758297429]
|
[node name="SubViewportContainer" type="SubViewportContainer" parent="GameContainer/VBoxContainer/PanelContainer" unique_id=758297429]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
stretch = true
|
stretch = true
|
||||||
mouse_target = true
|
mouse_target = true
|
||||||
|
|
||||||
[node name="SubViewport" type="SubViewport" parent="VBoxContainer/PanelContainer/SubViewportContainer" unique_id=584942697]
|
[node name="SubViewport" type="SubViewport" parent="GameContainer/VBoxContainer/PanelContainer/SubViewportContainer" unique_id=584942697]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
disable_3d = true
|
disable_3d = true
|
||||||
transparent_bg = true
|
transparent_bg = true
|
||||||
handle_input_locally = false
|
handle_input_locally = false
|
||||||
physics_object_picking = true
|
physics_object_picking = true
|
||||||
size = Vector2i(2, 2)
|
size = Vector2i(1132, 574)
|
||||||
render_target_update_mode = 4
|
render_target_update_mode = 4
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=416785798]
|
[node name="Camera2D" type="Camera2D" parent="GameContainer/VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=416785798]
|
||||||
anchor_mode = 0
|
anchor_mode = 0
|
||||||
zoom = Vector2(0.94, 0.94)
|
zoom = Vector2(0.94, 0.94)
|
||||||
position_smoothing_enabled = true
|
position_smoothing_enabled = true
|
||||||
@ -65,5 +70,24 @@ drag_horizontal_enabled = true
|
|||||||
drag_vertical_enabled = true
|
drag_vertical_enabled = true
|
||||||
script = ExtResource("2_v8odh")
|
script = ExtResource("2_v8odh")
|
||||||
|
|
||||||
[node name="Board" parent="VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=752933545 instance=ExtResource("3_02cv7")]
|
[node name="Board" parent="GameContainer/VBoxContainer/PanelContainer/SubViewportContainer/SubViewport" unique_id=752933545 instance=ExtResource("3_02cv7")]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
||||||
|
[node name="GameOver" type="PanelContainer" parent="." unique_id=1729030106]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("5_02cv7")
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="GameOver" unique_id=1471561381]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="GameOver/CenterContainer" unique_id=620824359]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Player Wins"
|
||||||
|
|
||||||
|
[connection signal="board_state_changed" from="GameContainer/VBoxContainer/PanelContainer/SubViewportContainer/SubViewport/Board" to="." method="handle_board_state_changed"]
|
||||||
|
|||||||
@ -1,15 +1,100 @@
|
|||||||
class_name Game extends Node
|
class_name Game extends Node
|
||||||
|
|
||||||
|
signal players_changed(players: Array[Player])
|
||||||
|
|
||||||
|
const MAIN_MENU_SCENE = preload("uid://dpuwsqorot65h")
|
||||||
|
const BOARD_GAME_SCENE = preload("uid://dmqvnr7uev0i6")
|
||||||
|
|
||||||
|
const WEB_TUBE_CONTEXT = preload("uid://berd4vlwkh1no")
|
||||||
|
const LOCAL_TUBE_CONTEXT = preload("uid://c4wgewmmuj74g")
|
||||||
|
|
||||||
var this_player: Player
|
var this_player: Player
|
||||||
|
#var players: Dictionary[int, Player] = {}
|
||||||
var players: Array[Player] = []
|
var players: Array[Player] = []
|
||||||
|
|
||||||
@onready var tube_client: TubeClient = %TubeClient
|
@onready var tube_client: TubeClient = %TubeClient
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
if ProjectSettings.get_setting_with_override("game/config/use_web_tube_context"):
|
||||||
|
tube_client.context = WEB_TUBE_CONTEXT
|
||||||
|
else:
|
||||||
|
tube_client.context = LOCAL_TUBE_CONTEXT
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
Globals.game = self
|
Globals.game = self
|
||||||
|
|
||||||
|
|
||||||
@rpc("any_peer", "call_local", "reliable")
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
func add_player(player: Player) -> void:
|
func add_player(player_data: Dictionary) -> void:
|
||||||
players.push_back(player)
|
if !players.any(func(p: Player) -> bool: return p.name == player_data["name"]):
|
||||||
|
players.push_back(Player.deserialize(player_data))
|
||||||
|
players_changed.emit(players)
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_remote", "reliable")
|
||||||
|
func sync_players() -> void:
|
||||||
|
for player in players:
|
||||||
|
add_player.rpc(player.serialize())
|
||||||
|
|
||||||
|
|
||||||
|
@rpc("any_peer", "call_local", "reliable")
|
||||||
|
func add_player_money(player_id: int, money: int) -> void:
|
||||||
|
find_player_by_id(player_id).money += money
|
||||||
|
|
||||||
|
|
||||||
|
func find_player_by_id(id: int) -> Player:
|
||||||
|
var player_idx = players.find_custom(func(p: Player) -> bool: return p.id == id)
|
||||||
|
return players[player_idx]
|
||||||
|
|
||||||
|
|
||||||
|
func get_next_player(player: Player) -> Player:
|
||||||
|
var player_idx = players.find_custom(func(p: Player) -> bool: return p.id == player.id)
|
||||||
|
return players[(player_idx + 1) % players.size()]
|
||||||
|
|
||||||
|
|
||||||
|
func get_this_player_turn_index() -> int:
|
||||||
|
return players.find_custom(func(p: Player) -> bool: return p.id == this_player.id)
|
||||||
|
|
||||||
|
|
||||||
|
func get_player_turn_index(player: Player) -> int:
|
||||||
|
return players.find_custom(func(p: Player) -> bool: return p.id == player.id)
|
||||||
|
|
||||||
|
|
||||||
|
func start_game() -> void:
|
||||||
|
if is_instance_valid(Globals.main_menu):
|
||||||
|
Globals.main_menu.queue_free()
|
||||||
|
add_child(BOARD_GAME_SCENE.instantiate())
|
||||||
|
if Globals.game.tube_client.is_server:
|
||||||
|
Globals.game.create_initial_board_state()
|
||||||
|
|
||||||
|
|
||||||
|
func create_initial_board_state() -> void:
|
||||||
|
Globals.board_game.board.initialize()
|
||||||
|
var board_state := BoardState.new()
|
||||||
|
players.shuffle()
|
||||||
|
board_state.turn = -players.size()
|
||||||
|
board_state.players = players
|
||||||
|
board_state.current_player = players[0]
|
||||||
|
board_state.tiles = Globals.board_game.board.tiles.values()
|
||||||
|
Globals.board_game.set_board_state.rpc(board_state.serialize())
|
||||||
|
Globals.board_game.setup_building_deck.rpc()
|
||||||
|
|
||||||
|
|
||||||
|
func shuffle_turn_order() -> void:
|
||||||
|
var idx_arr: Array[int] = []
|
||||||
|
for i in range(players.size()):
|
||||||
|
idx_arr.push_back(i)
|
||||||
|
seed(sum_player_ids())
|
||||||
|
var new_order: Array[Player] = []
|
||||||
|
idx_arr.shuffle()
|
||||||
|
players.sort_custom(func(a: Player, b: Player) -> bool: return a.id > b.id)
|
||||||
|
for idx in idx_arr:
|
||||||
|
new_order.push_back(players[idx])
|
||||||
|
players = new_order
|
||||||
|
|
||||||
|
|
||||||
|
func sum_player_ids() -> int:
|
||||||
|
var ids: Array = players.map(func(p: Player) -> int: return p.id)
|
||||||
|
return ids.reduce(func(acc: int, id: int) -> int: return acc + id, 0)
|
||||||
|
|||||||
@ -2,8 +2,7 @@
|
|||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bg3v68a7qpt8t" path="res://scenes/game.gd" id="1_fc0e3"]
|
[ext_resource type="Script" uid="uid://bg3v68a7qpt8t" path="res://scenes/game.gd" id="1_fc0e3"]
|
||||||
[ext_resource type="Script" uid="uid://cy006uvidc4y" path="res://addons/tube/tube_client.gd" id="2_lnu2h"]
|
[ext_resource type="Script" uid="uid://cy006uvidc4y" path="res://addons/tube/tube_client.gd" id="2_lnu2h"]
|
||||||
[ext_resource type="Resource" uid="uid://c4wgewmmuj74g" path="res://resources/local_tube_context.tres" id="3_lbhrr"]
|
[ext_resource type="PackedScene" uid="uid://dpuwsqorot65h" path="res://scenes/main_menu.tscn" id="3_lnu2h"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dpuwsqorot65h" path="res://scenes/main_menu.tscn" id="4_lbhrr"]
|
|
||||||
|
|
||||||
[node name="Game" type="Node" unique_id=384379479]
|
[node name="Game" type="Node" unique_id=384379479]
|
||||||
script = ExtResource("1_fc0e3")
|
script = ExtResource("1_fc0e3")
|
||||||
@ -11,7 +10,6 @@ script = ExtResource("1_fc0e3")
|
|||||||
[node name="TubeClient" type="Node" parent="." unique_id=646833557]
|
[node name="TubeClient" type="Node" parent="." unique_id=646833557]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
script = ExtResource("2_lnu2h")
|
script = ExtResource("2_lnu2h")
|
||||||
context = ExtResource("3_lbhrr")
|
|
||||||
metadata/_custom_type_script = "uid://cy006uvidc4y"
|
metadata/_custom_type_script = "uid://cy006uvidc4y"
|
||||||
|
|
||||||
[node name="MainMenu" parent="." unique_id=459413586 instance=ExtResource("4_lbhrr")]
|
[node name="MainMenu" parent="." unique_id=459413586 instance=ExtResource("3_lnu2h")]
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
extends Node
|
class_name MainMenu extends Node
|
||||||
|
|
||||||
@onready var main_menu: Container = %MainMenu
|
@onready var main_menu: Container = %MainMenu
|
||||||
@onready var create_session: Container = %CreateSession
|
@onready var create_session: Container = %CreateSession
|
||||||
@ -6,37 +6,34 @@ extends Node
|
|||||||
@onready var lobby: Lobby = %Lobby
|
@onready var lobby: Lobby = %Lobby
|
||||||
|
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
Globals.main_menu = self
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
Globals.game.players_changed.connect(lobby.load_players)
|
||||||
|
|
||||||
|
|
||||||
func handle_create_session(player: Player) -> void:
|
func handle_create_session(player: Player) -> void:
|
||||||
Globals.game.tube_client.create_session()
|
|
||||||
Globals.game.this_player = player
|
Globals.game.this_player = player
|
||||||
Globals.game.add_player.rpc(player)
|
Globals.game.tube_client.create_session()
|
||||||
|
Globals.game.this_player.id = Globals.game.tube_client.peer_id
|
||||||
|
Globals.game.add_player.rpc(player.serialize())
|
||||||
create_session.hide()
|
create_session.hide()
|
||||||
lobby.show()
|
lobby.show()
|
||||||
lobby.set_session_id(Globals.game.tube_client.session_id)
|
lobby.set_session_id(Globals.game.tube_client.session_id)
|
||||||
lobby.add_player(player)
|
|
||||||
|
|
||||||
|
|
||||||
func handle_join_session(session_id: String, player: Player) -> void:
|
func handle_join_session(session_id: String, player: Player) -> void:
|
||||||
|
Globals.game.this_player = player
|
||||||
Globals.game.tube_client.join_session(session_id)
|
Globals.game.tube_client.join_session(session_id)
|
||||||
await Globals.game.tube_client.peer_connected
|
await Globals.game.tube_client.peer_connected
|
||||||
Globals.game.this_player = player
|
Globals.game.this_player.id = Globals.game.tube_client.peer_id
|
||||||
Globals.game.add_player.rpc(player)
|
Globals.game.add_player.rpc(player.serialize())
|
||||||
|
Globals.game.sync_players.rpc()
|
||||||
join_session.hide()
|
join_session.hide()
|
||||||
lobby.show()
|
lobby.show()
|
||||||
lobby.set_session_id(session_id)
|
lobby.set_session_id(session_id)
|
||||||
lobby.add_player(player)
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#func handle_chat_update(new_text):
|
|
||||||
#update_chat.rpc(new_text)
|
|
||||||
#chat_text_input.text = ""
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#@rpc("any_peer", "call_local", "reliable")
|
|
||||||
#func update_chat(text):
|
|
||||||
#chat_log.text += text + "\n"
|
|
||||||
|
|
||||||
|
|
||||||
func _on_create_session_pressed():
|
func _on_create_session_pressed():
|
||||||
@ -47,3 +44,20 @@ func _on_create_session_pressed():
|
|||||||
func _on_join_session_pressed():
|
func _on_join_session_pressed():
|
||||||
main_menu.hide()
|
main_menu.hide()
|
||||||
join_session.show()
|
join_session.show()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_single_player_pressed():
|
||||||
|
Globals.game.tube_client.create_session()
|
||||||
|
Globals.game.this_player = Player.new()
|
||||||
|
Globals.game.this_player.name = "one"
|
||||||
|
Globals.game.add_player(Globals.game.this_player.serialize())
|
||||||
|
#var two = Player.new()
|
||||||
|
#two.name = "two"
|
||||||
|
#var three = Player.new()
|
||||||
|
#three.name = "three"
|
||||||
|
#var four = Player.new()
|
||||||
|
#four.name = "four"
|
||||||
|
#Globals.game.add_player(two.serialize())
|
||||||
|
#Globals.game.add_player(three.serialize())
|
||||||
|
#Globals.game.add_player(four.serialize())
|
||||||
|
Globals.game.start_game()
|
||||||
|
|||||||
@ -27,12 +27,20 @@ text = "Clockwork City"
|
|||||||
label_settings = SubResource("LabelSettings_2wvic")
|
label_settings = SubResource("LabelSettings_2wvic")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="SinglePlayer" type="Button" parent="MainMenu" unique_id=1318380325]
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_horizontal = 4
|
||||||
|
text = "Single Player"
|
||||||
|
|
||||||
[node name="CreateSession" type="Button" parent="MainMenu" unique_id=1320477862]
|
[node name="CreateSession" type="Button" parent="MainMenu" unique_id=1320477862]
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
text = "Create Session"
|
text = "Create Session"
|
||||||
|
|
||||||
[node name="JoinSession" type="Button" parent="MainMenu" unique_id=897089302]
|
[node name="JoinSession" type="Button" parent="MainMenu" unique_id=897089302]
|
||||||
|
custom_minimum_size = Vector2(150, 0)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
text = "Join Session"
|
text = "Join Session"
|
||||||
@ -49,6 +57,7 @@ visible = false
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
[connection signal="pressed" from="MainMenu/SinglePlayer" to="." method="_on_single_player_pressed"]
|
||||||
[connection signal="pressed" from="MainMenu/CreateSession" to="." method="_on_create_session_pressed"]
|
[connection signal="pressed" from="MainMenu/CreateSession" to="." method="_on_create_session_pressed"]
|
||||||
[connection signal="pressed" from="MainMenu/JoinSession" to="." method="_on_join_session_pressed"]
|
[connection signal="pressed" from="MainMenu/JoinSession" to="." method="_on_join_session_pressed"]
|
||||||
[connection signal="create_session" from="CreateSession" to="." method="handle_create_session"]
|
[connection signal="create_session" from="CreateSession" to="." method="handle_create_session"]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user