Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
8803c46a96 | |||
2a597676e6 | |||
d9aff4fdc4 |
3
UI/construct.gd
Normal file
3
UI/construct.gd
Normal file
@ -0,0 +1,3 @@
|
||||
extends Button
|
||||
|
||||
# Called when the node enters the
|
32
UI/control.tscn
Normal file
32
UI/control.tscn
Normal file
@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://ceju5kxboqm1r"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/construct.gd" id="1_g0ew0"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Construct" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_right = 8.0
|
||||
offset_bottom = 8.0
|
||||
text = "Конструкция"
|
||||
script = ExtResource("1_g0ew0")
|
||||
|
||||
[node name="Destroy" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_top = 40.0
|
||||
offset_right = 92.0
|
||||
offset_bottom = 71.0
|
||||
text = "Демонтаж"
|
||||
|
||||
[node name="Road" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_top = 80.0
|
||||
offset_right = 66.0
|
||||
offset_bottom = 111.0
|
||||
text = "Дорога"
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 398 B |
@ -0,0 +1,146 @@
|
||||
[preset.0]
|
||||
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../export/windows/game.exe"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=0
|
||||
binary_format/embed_pck=false
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
codesign/enable=false
|
||||
codesign/timestamp=true
|
||||
codesign/timestamp_server_url=""
|
||||
codesign/digest_algorithm=1
|
||||
codesign/description=""
|
||||
codesign/custom_options=PackedStringArray()
|
||||
application/modify_resources=false
|
||||
application/icon=""
|
||||
application/console_wrapper_icon=""
|
||||
application/icon_interpolation=4
|
||||
application/file_version=""
|
||||
application/product_version=""
|
||||
application/company_name=""
|
||||
application/product_name=""
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
application/export_angle=0
|
||||
application/export_d3d12=0
|
||||
application/d3d12_agility_sdk_multiarch=true
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||
$settings = New-ScheduledTaskSettingsSet
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||
Start-ScheduledTask -TaskName godot_remote_debug
|
||||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Web"
|
||||
platform="Web"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../export/web/game.html"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/extensions_support=false
|
||||
variant/thread_support=false
|
||||
vram_texture_compression/for_desktop=true
|
||||
vram_texture_compression/for_mobile=false
|
||||
html/export_icon=true
|
||||
html/custom_html_shell=""
|
||||
html/head_include=""
|
||||
html/canvas_resize_policy=2
|
||||
html/focus_canvas_on_start=true
|
||||
html/experimental_virtual_keyboard=false
|
||||
progressive_web_app/enabled=false
|
||||
progressive_web_app/ensure_cross_origin_isolation_headers=true
|
||||
progressive_web_app/offline_page=""
|
||||
progressive_web_app/display=1
|
||||
progressive_web_app/orientation=0
|
||||
progressive_web_app/icon_144x144=""
|
||||
progressive_web_app/icon_180x180=""
|
||||
progressive_web_app/icon_512x512=""
|
||||
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||
|
||||
[preset.2]
|
||||
|
||||
name="Linux"
|
||||
platform="Linux"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../export/linux/game.x86_64"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.2.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
30
npc/npc.gd
30
npc/npc.gd
@ -2,6 +2,10 @@ class_name NPC
|
||||
extends Node2D
|
||||
|
||||
var id_path: Array[Vector2i]
|
||||
var target: Vector2i
|
||||
var speed: float = 1
|
||||
var oxygen: float = 100
|
||||
|
||||
|
||||
func is_walking() -> bool:
|
||||
return not id_path.is_empty()
|
||||
@ -10,7 +14,6 @@ func is_walking() -> bool:
|
||||
func _ready() -> void:
|
||||
randomize()
|
||||
$Sprite2D.set_nation(randi()%$Sprite2D.Nations.max)
|
||||
set_spacesuit(false)
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
@ -20,11 +23,34 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
var target_pos = Vector2(id_path.front()*World.tile_size)
|
||||
|
||||
global_position = global_position.move_toward(target_pos, 1)
|
||||
global_position = global_position.move_toward(target_pos, speed)
|
||||
|
||||
if global_position.x < target_pos.x: $Sprite2D.flip_h = true
|
||||
elif global_position.x > target_pos.x: $Sprite2D.flip_h = false
|
||||
|
||||
if global_position == target_pos:
|
||||
id_path.pop_front()
|
||||
set_target(target)
|
||||
|
||||
if $"../../TileMap".check_indoors(global_position/16):
|
||||
set_spacesuit(false)
|
||||
else:
|
||||
set_spacesuit(true)
|
||||
|
||||
func set_spacesuit(suit: bool) -> void:
|
||||
$Sprite2D.set_spacesuit(suit)
|
||||
if suit: speed = 0.2
|
||||
else: speed = 1
|
||||
|
||||
func set_target(pos: Vector2i):
|
||||
var new_id_path = $"../../TileMap".astar_grid.get_id_path(
|
||||
$"../../TileMap/ground".local_to_map(global_position+$"../../TileMap/ground".global_position),
|
||||
target
|
||||
).slice(1)
|
||||
|
||||
if not new_id_path.is_empty():
|
||||
id_path = new_id_path
|
||||
target = pos
|
||||
else:
|
||||
id_path = []
|
||||
target = pos
|
||||
|
@ -5,6 +5,7 @@
|
||||
[ext_resource type="Script" path="res://npc/sprite_2d.gd" id="2_jtl2q"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_2v0ml"]
|
||||
resource_local_to_scene = true
|
||||
atlas = ExtResource("1_vgeae")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
@ -14,6 +15,7 @@ z_as_relative = false
|
||||
script = ExtResource("1_m82ir")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture_filter = 1
|
||||
texture = SubResource("AtlasTexture_2v0ml")
|
||||
centered = false
|
||||
script = ExtResource("2_jtl2q")
|
||||
|
@ -17,10 +17,11 @@ config/icon="res://assets/icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1024
|
||||
window/size/viewport_height=1024
|
||||
window/size/viewport_width=640
|
||||
window/size/viewport_height=480
|
||||
window/size/mode=2
|
||||
window/stretch/mode="canvas_items"
|
||||
window/stretch/aspect="keep_width"
|
||||
window/stretch/aspect="keep_height"
|
||||
|
||||
[dotnet]
|
||||
|
||||
@ -47,6 +48,31 @@ right_mouse={
|
||||
"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":2,"position":Vector2(277, 13),"global_position":Vector2(286, 59),"factor":1.0,"button_index":2,"canceled":false,"pressed":true,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
zoom_in={
|
||||
"deadzone": 0.5,
|
||||
"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":0,"key_label":61,"unicode":61,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
zoom_out={
|
||||
"deadzone": 0.5,
|
||||
"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":0,"key_label":45,"unicode":45,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
1={
|
||||
"deadzone": 0.5,
|
||||
"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":49,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
2={
|
||||
"deadzone": 0.5,
|
||||
"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":50,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
3={
|
||||
"deadzone": 0.5,
|
||||
"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":51,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[rendering]
|
||||
|
||||
|
@ -22,13 +22,7 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func set_npc_target(npc: NPC, target: Vector2i):
|
||||
var id_path = $"../TileMap".astar_grid.get_id_path(
|
||||
$"../TileMap/ground".local_to_map(npc.global_position+$"../TileMap/ground".global_position),
|
||||
target
|
||||
).slice(1)
|
||||
|
||||
if not id_path.is_empty():
|
||||
npc.id_path = id_path
|
||||
npc.set_target(target)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
@ -244,3 +244,9 @@ func weight(pos: Vector2i) -> int:
|
||||
func update_astar_tile(pos: Vector2i):
|
||||
astar_grid.set_point_solid(pos, not is_walkable(pos))
|
||||
astar_grid.set_point_weight_scale(pos, weight(pos))
|
||||
|
||||
func check_indoors(pos: Vector2i) -> bool:
|
||||
var layer = get_toplayer(pos)
|
||||
var tiledata: TileData = layer.get_cell_tile_data(pos)
|
||||
if tiledata != null: return tiledata.get_custom_data("indoors")
|
||||
else: return false
|
||||
|
@ -20,6 +20,7 @@ var lmb: bool
|
||||
var rmb: bool
|
||||
|
||||
func _ready():
|
||||
Engine.physics_ticks_per_second = 60
|
||||
selection = SELECTION_SCENE.instantiate()
|
||||
selection2 = SELECTION_SCENE.instantiate()
|
||||
add_child(selection)
|
||||
@ -60,10 +61,6 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
change_instrument(instruments.NULL)
|
||||
if Input.is_action_just_pressed("ui_right"):
|
||||
change_instrument(selected_instrument+1)
|
||||
if Input.is_action_just_pressed("ui_left"):
|
||||
change_instrument(selected_instrument-1)
|
||||
|
||||
match selected_instrument:
|
||||
instruments.NULL:
|
||||
@ -106,5 +103,21 @@ func change_instrument(new: instruments):
|
||||
lmb = false
|
||||
rmb = false
|
||||
|
||||
func _input(event):
|
||||
pass
|
||||
func _process(delta: float) -> void:
|
||||
if Input.is_action_pressed("ui_right"):
|
||||
$Camera2D.translate(Vector2.RIGHT*320*delta/$Camera2D.zoom)
|
||||
if Input.is_action_pressed("ui_left"):
|
||||
$Camera2D.translate(Vector2.LEFT*320*delta/$Camera2D.zoom)
|
||||
if Input.is_action_pressed("ui_up"):
|
||||
$Camera2D.translate(Vector2.UP*320*delta/$Camera2D.zoom)
|
||||
if Input.is_action_pressed("ui_down"):
|
||||
$Camera2D.translate(Vector2.DOWN*320*delta/$Camera2D.zoom)
|
||||
if Input.is_action_just_pressed("zoom_in"):
|
||||
$Camera2D.zoom+=Vector2.ONE*0.25
|
||||
if Input.is_action_just_pressed("zoom_out"):
|
||||
$Camera2D.zoom-=Vector2.ONE*0.25
|
||||
if Input.is_action_just_pressed("1"): change_instrument(instruments.CONSTRUCT)
|
||||
if Input.is_action_just_pressed("2"): change_instrument(instruments.DESTROY)
|
||||
if Input.is_action_just_pressed("3"): change_instrument(instruments.BUILD_ROAD)
|
||||
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user