Main menu, ZX Spectrum-like font, Death screen, Fixed typo, Game Manager
This commit is contained in:
parent
602df1ed1d
commit
b0caf99373
24 changed files with 497 additions and 17 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
- crank sound - https://freesound.org/people/tosha73/sounds/546859/
|
||||
- watcher sigh - https://freesound.org/people/AbrahamMast/sounds/501339/
|
||||
- thunderclap - https://freesound.org/people/Rie-chanThirty/sounds/691960/
|
||||
- zx spectrum font - Sizenko Alexander from [Style-7](http://www.styleseven.com)
|
||||
|
||||
## Tools
|
||||
|
||||
|
|
145
export_presets.cfg
Normal file
145
export_presets.cfg
Normal file
|
@ -0,0 +1,145 @@
|
|||
[preset.0]
|
||||
|
||||
name="Web"
|
||||
platform="Web"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
variant/extensions_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/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)
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=true
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/bptc=true
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=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=true
|
||||
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=""
|
||||
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}'"
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=true
|
||||
|
||||
[preset.2]
|
||||
|
||||
name="Linux/X11"
|
||||
platform="Linux/X11"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path=""
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
|
||||
[preset.2.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/bptc=true
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=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}\""
|
||||
dotnet/include_scripts_content=false
|
||||
dotnet/include_debug_symbols=true
|
BIN
fonts/ZxSpectrum7-nROZ0.ttf
Normal file
BIN
fonts/ZxSpectrum7-nROZ0.ttf
Normal file
Binary file not shown.
38
fonts/ZxSpectrum7-nROZ0.ttf.import
Normal file
38
fonts/ZxSpectrum7-nROZ0.ttf.import
Normal file
|
@ -0,0 +1,38 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dwn20pw40jpxm"
|
||||
path="res://.godot/imported/ZxSpectrum7-nROZ0.ttf-7a86c6132238c7414185578e0f5656e5.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/ZxSpectrum7-nROZ0.ttf"
|
||||
dest_files=["res://.godot/imported/ZxSpectrum7-nROZ0.ttf-7a86c6132238c7414185578e0f5656e5.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=0
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=false
|
||||
force_autohinter=false
|
||||
hinting=0
|
||||
subpixel_positioning=0
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[{
|
||||
"chars": [],
|
||||
"glyphs": [],
|
||||
"name": "Новая конфигурация",
|
||||
"size": Vector2i(16, 0)
|
||||
}]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
BIN
fonts/ZxSpectrum7Bold-1GpEB.ttf
Normal file
BIN
fonts/ZxSpectrum7Bold-1GpEB.ttf
Normal file
Binary file not shown.
33
fonts/ZxSpectrum7Bold-1GpEB.ttf.import
Normal file
33
fonts/ZxSpectrum7Bold-1GpEB.ttf.import
Normal file
|
@ -0,0 +1,33 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://blrrssv7yvot2"
|
||||
path="res://.godot/imported/ZxSpectrum7Bold-1GpEB.ttf-90e16e9694eef89eadb4ded82bfb64ea.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://fonts/ZxSpectrum7Bold-1GpEB.ttf"
|
||||
dest_files=["res://.godot/imported/ZxSpectrum7Bold-1GpEB.ttf-90e16e9694eef89eadb4ded82bfb64ea.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=0
|
||||
generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=false
|
||||
force_autohinter=false
|
||||
hinting=0
|
||||
subpixel_positioning=0
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
6
prefabs/play_zone.tscn
Normal file
6
prefabs/play_zone.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bdtjnmjopi5h2"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/PlayZone.cs" id="1_k3xi5"]
|
||||
|
||||
[node name="PlayZone" type="Node2D"]
|
||||
script = ExtResource("1_k3xi5")
|
|
@ -11,7 +11,7 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="1bit-game-jam"
|
||||
run/main_scene="res://scenes/main_scene.tscn"
|
||||
run/main_scene="res://scenes/menu.tscn"
|
||||
config/features=PackedStringArray("4.1", "C#", "Mobile")
|
||||
boot_splash/bg_color=Color(0.141176, 0.141176, 0.141176, 1)
|
||||
config/icon="res://icon.svg"
|
||||
|
@ -65,6 +65,12 @@ flashlight_charge={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
ui_confirm={
|
||||
"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":4194309,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=22 format=3 uid="uid://dhn7yt46fyac8"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://dhn7yt46fyac8"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bhulqhxesd5gc" path="res://prefabs/player.tscn" id="1_65a7v"]
|
||||
[ext_resource type="AudioStream" uid="uid://bsy2d0bl3lgg0" path="res://sounds/crank.ogg" id="1_cweq4"]
|
||||
[ext_resource type="Script" path="res://scripts/GameManager.cs" id="1_ij566"]
|
||||
[ext_resource type="Texture2D" uid="uid://py6qiu3rm7cu" path="res://sprites/brickwall.png" id="2_edqdh"]
|
||||
[ext_resource type="Texture2D" uid="uid://dlbl6d4yghvht" path="res://sprites/mask.png" id="3_8o315"]
|
||||
[ext_resource type="Script" path="res://scripts/Flashlight.cs" id="3_cylxo"]
|
||||
|
@ -10,9 +11,10 @@
|
|||
[ext_resource type="Script" path="res://scripts/GameCamera.cs" id="6_quua3"]
|
||||
[ext_resource type="Script" path="res://scripts/PointLight2DWorkaround.cs" id="6_slohe"]
|
||||
[ext_resource type="PackedScene" uid="uid://ccg3n7sobsvdw" path="res://prefabs/enemies/watcher.tscn" id="10_fsiss"]
|
||||
[ext_resource type="PackedScene" uid="uid://bpusphyhhg074" path="res://prefabs/enemies/living_armor.tscn" id="11_x3ep3"]
|
||||
[ext_resource type="PackedScene" path="res://prefabs/enemies/living_armor.tscn" id="11_x3ep3"]
|
||||
[ext_resource type="PackedScene" uid="uid://bj1ixwjdpnooo" path="res://prefabs/entities/pressure_plate.tscn" id="12_ynt5e"]
|
||||
[ext_resource type="PackedScene" uid="uid://dqx43vr727ft8" path="res://prefabs/entities/spikes.tscn" id="13_w1hk1"]
|
||||
[ext_resource type="Script" path="res://scripts/DeathScreen.cs" id="15_12mhe"]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_o5byr"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.0824742, 0.273684), -10.2105, 0.0, 0, 0, Vector2(0.242268, 0.494737), -5.10526, 0.0, 0, 0, Vector2(0.396907, 0.736842), -7.6579, 0.0, 0, 0, Vector2(0.737113, 1), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
|
@ -24,7 +26,7 @@ light_mode = 2
|
|||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_m680d"]
|
||||
shader = ExtResource("5_64d71")
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_y74yf"]
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_psi2l"]
|
||||
viewport_path = NodePath("FlashlightViewport")
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_prnh4"]
|
||||
|
@ -35,12 +37,25 @@ radius = 16.0
|
|||
[sub_resource type="ViewportTexture" id="ViewportTexture_nnmvo"]
|
||||
viewport_path = NodePath("FlashlightViewport")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_cy0nu"]
|
||||
interpolation_mode = 1
|
||||
offsets = PackedFloat32Array(0)
|
||||
colors = PackedColorArray(0, 0, 0, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_2sbp3"]
|
||||
gradient = SubResource("Gradient_cy0nu")
|
||||
width = 256
|
||||
height = 192
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_au1d0"]
|
||||
light_mode = 2
|
||||
|
||||
[node name="Root" type="Node2D"]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="GameManager" type="Node" parent="."]
|
||||
script = ExtResource("1_ij566")
|
||||
|
||||
[node name="Sounds" type="Node" parent="."]
|
||||
|
||||
[node name="CrankSound" type="AudioStreamPlayer" parent="Sounds"]
|
||||
|
@ -107,7 +122,7 @@ CameraBounds = Vector2(30, 20)
|
|||
[node name="PointLight2D" type="PointLight2D" parent="PlayerCamera" node_paths=PackedStringArray("LightViewport")]
|
||||
blend_mode = 2
|
||||
range_item_cull_mask = 2
|
||||
texture = SubResource("ViewportTexture_y74yf")
|
||||
texture = SubResource("ViewportTexture_psi2l")
|
||||
script = ExtResource("6_slohe")
|
||||
LightViewport = NodePath("../../FlashlightViewport")
|
||||
|
||||
|
@ -146,6 +161,27 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="DeathScreen" type="TextureRect" parent="CanvasLayer" node_paths=PackedStringArray("Camera")]
|
||||
visible = false
|
||||
z_index = 10
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = SubResource("GradientTexture2D_2sbp3")
|
||||
script = ExtResource("15_12mhe")
|
||||
Camera = NodePath("../../PlayerCamera")
|
||||
|
||||
[node name="Timer" type="Timer" parent="CanvasLayer/DeathScreen"]
|
||||
wait_time = 3.0
|
||||
|
||||
[node name="PlayerSprite" type="TextureRect" parent="CanvasLayer/DeathScreen"]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="MonsterSprite" type="TextureRect" parent="CanvasLayer/DeathScreen"]
|
||||
layout_mode = 0
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
light_mask = 2
|
||||
y_sort_enabled = true
|
||||
|
@ -191,8 +227,4 @@ Enabled = true
|
|||
SpikesTimeout = 0.5
|
||||
StartOffset = 0.5
|
||||
|
||||
[connection signal="ButtonPressed" from="pressure_plate" to="spikes" method="Off"]
|
||||
[connection signal="ButtonPressed" from="pressure_plate" to="spikes2" method="Off"]
|
||||
[connection signal="ButtonPressed" from="pressure_plate" to="spikes3" method="Off"]
|
||||
[connection signal="ButtonUnpressed" from="pressure_plate" to="spikes" method="On"]
|
||||
[connection signal="ButtonUnpressed" from="pressure_plate" to="spikes3" method="On"]
|
||||
[connection signal="timeout" from="CanvasLayer/DeathScreen/Timer" to="CanvasLayer/DeathScreen" method="Timeout"]
|
||||
|
|
48
scenes/menu.tscn
Normal file
48
scenes/menu.tscn
Normal file
|
@ -0,0 +1,48 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://c7w8oqlobjae0"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/Menu.cs" id="1_dlrmp"]
|
||||
[ext_resource type="AudioStream" uid="uid://ilvpdkvibr7c" path="res://sounds/thunderclap.ogg" id="2_nviw8"]
|
||||
[ext_resource type="Theme" uid="uid://daxgxg7c8v0ih" path="res://themes/zx_theme.tres" id="3_d3ur4"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6kcty"]
|
||||
resource_name = "intro_animation"
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_mjata"]
|
||||
_data = {
|
||||
"intro_animation": SubResource("Animation_6kcty")
|
||||
}
|
||||
|
||||
[node name="Menu" type="Node2D"]
|
||||
script = ExtResource("1_dlrmp")
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_mjata")
|
||||
}
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 2.0
|
||||
one_shot = true
|
||||
|
||||
[node name="Thunderclap" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("2_nviw8")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer"]
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -26.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
rotation = -0.001216
|
||||
theme = ExtResource("3_d3ur4")
|
||||
text = "Press Start or Enter"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="ChangeScene"]
|
|
@ -10,5 +10,5 @@ public static class Constants
|
|||
public const float MaxFlashlightDistance = 96;
|
||||
public const float MinFlashlightDistance = 16;
|
||||
public const float MaxFlashlightEnergy = 100;
|
||||
public const float FlashlightEneregyPerCharge = 5;
|
||||
public const float FlashlightEnergyPerCharge = 5;
|
||||
}
|
||||
|
|
59
scripts/DeathScreen.cs
Normal file
59
scripts/DeathScreen.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using Godot;
|
||||
|
||||
public partial class DeathScreen : TextureRect
|
||||
{
|
||||
public static DeathScreen Instance { get; private set; }
|
||||
|
||||
[Export] public GameCamera Camera;
|
||||
|
||||
private Timer _timer;
|
||||
private TextureRect _playerSprite;
|
||||
private TextureRect _monsterSprite;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
Visible = false;
|
||||
|
||||
_timer = (Timer)FindChild("Timer");
|
||||
_playerSprite = (TextureRect)FindChild("PlayerSprite");
|
||||
_monsterSprite = (TextureRect)FindChild("MonsterSprite");
|
||||
}
|
||||
|
||||
public void Timeout()
|
||||
{
|
||||
GD.Print("Timer end");
|
||||
|
||||
GetTree().ReloadCurrentScene();
|
||||
}
|
||||
|
||||
public void Killed(Node2D killer)
|
||||
{
|
||||
GD.Print($"DeathScreen {killer is null}");
|
||||
|
||||
_playerSprite.Position = Player.Instance.Position - Camera.Position + Constants.HalfScreenSize;
|
||||
_monsterSprite.Position = killer.Position - Camera.Position + Constants.HalfScreenSize;
|
||||
|
||||
if (Player.Instance.FindChild("AnimatedSprite2D") is AnimatedSprite2D animatedSprite2D)
|
||||
{
|
||||
GD.Print("Found AnimatedSprite2D for Player");
|
||||
_playerSprite.Texture =
|
||||
animatedSprite2D.SpriteFrames.GetFrameTexture(animatedSprite2D.Animation, animatedSprite2D.Frame);
|
||||
_playerSprite.Position -= _playerSprite.Texture.GetSize() / 2;
|
||||
}
|
||||
|
||||
if (killer.FindChild("AnimatedSprite2D") is AnimatedSprite2D killerAnimatedSprite2D)
|
||||
{
|
||||
GD.Print("Found AnimatedSprite2D for Monster");
|
||||
_monsterSprite.Texture =
|
||||
killerAnimatedSprite2D.SpriteFrames.GetFrameTexture(killerAnimatedSprite2D.Animation, killerAnimatedSprite2D.Frame);
|
||||
_monsterSprite.Position -= _monsterSprite.Texture.GetSize() / 2;
|
||||
}
|
||||
|
||||
Visible = true;
|
||||
_timer.Start();
|
||||
|
||||
GD.Print("Timer start");
|
||||
}
|
||||
}
|
|
@ -80,7 +80,7 @@ public partial class Flashlight : Node
|
|||
if (Input.IsActionJustPressed("flashlight_charge") && FlashlightChargeTimeout <= 0)
|
||||
{
|
||||
FlashlightChargeTimeout = 1;
|
||||
FlashlightEnergy += Constants.FlashlightEneregyPerCharge;
|
||||
FlashlightEnergy += Constants.FlashlightEnergyPerCharge;
|
||||
var rng = new RandomNumberGenerator();
|
||||
CrankSoundPlayer.PitchScale = rng.RandfRange(1f, 1.15f);
|
||||
CrankSoundPlayer.Play();
|
||||
|
|
|
@ -21,7 +21,6 @@ public partial class GameCamera : Camera2D
|
|||
var halfCameraFollowBounds = CameraFollowBounds / 2;
|
||||
var hardLimit = relativePlayerPosition.Clamp(-halfCameraBounds, halfCameraBounds);
|
||||
difference = relativePlayerPosition - hardLimit;
|
||||
//GD.Print($"HardDiff {difference}");
|
||||
if (difference.IsZeroApprox())
|
||||
{
|
||||
float x = 0, y = 0;
|
||||
|
@ -36,7 +35,6 @@ public partial class GameCamera : Camera2D
|
|||
}
|
||||
|
||||
difference = new Vector2(x, y);
|
||||
//GD.Print($"SmoothDiff {difference}");
|
||||
}
|
||||
|
||||
Position = (Position + difference).Round();
|
||||
|
|
38
scripts/GameManager.cs
Normal file
38
scripts/GameManager.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using Godot;
|
||||
|
||||
public partial class GameManager : Node
|
||||
{
|
||||
public static bool IsPlaying = true;
|
||||
|
||||
public ulong GameStart = 0;
|
||||
public ulong GameEnd = 0;
|
||||
public int Attempts = 0;
|
||||
public Node2D Checkpoint = null;
|
||||
|
||||
[Signal]
|
||||
public delegate void GameOverEventHandler();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
if (!IsPlaying)
|
||||
{
|
||||
IsPlaying = true;
|
||||
}
|
||||
|
||||
StartGame();
|
||||
}
|
||||
|
||||
public void StartGame() => GameStart = Time.GetTicksMsec();
|
||||
|
||||
public void EndGame()
|
||||
{
|
||||
GameEnd = Time.GetTicksMsec();
|
||||
|
||||
EmitSignal(SignalName.GameOver);
|
||||
}
|
||||
|
||||
public string GetFormattedTimeElapsed() => TimeSpan.FromMilliseconds(GameEnd - GameStart).ToString(@"hh\:mm\:ss.fff");
|
||||
|
||||
public void OnPlayerDied() => Attempts++;
|
||||
}
|
29
scripts/Menu.cs
Normal file
29
scripts/Menu.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using Godot;
|
||||
|
||||
public partial class Menu : Node2D
|
||||
{
|
||||
private Timer _timer;
|
||||
private AudioStreamPlayer2D _thunderclap;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_timer = (Timer)FindChild("Timer");
|
||||
_thunderclap = (AudioStreamPlayer2D)FindChild("Thunderclap");
|
||||
|
||||
GameManager.IsPlaying = false;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed("ui_confirm") && _timer.IsStopped())
|
||||
{
|
||||
_thunderclap.Play();
|
||||
_timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangeScene()
|
||||
{
|
||||
GetTree().ChangeSceneToFile("res://scenes/main_scene.tscn");
|
||||
}
|
||||
}
|
16
scripts/PlayZone.cs
Normal file
16
scripts/PlayZone.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class PlayZone : Node2D
|
||||
{
|
||||
[Export] public Node2D TopLeftCorner;
|
||||
[Export] public Node2D BottomRightCorner;
|
||||
|
||||
public Rect2I Bounds = new Rect2I(0, 0, 0, 0);
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var size = BottomRightCorner.Position - TopLeftCorner.Position;
|
||||
Bounds = new Rect2I((int)TopLeftCorner.Position.X, (int)TopLeftCorner.Position.Y, (int)size.X, (int)size.Y);
|
||||
}
|
||||
}
|
|
@ -22,6 +22,9 @@ public partial class Player : CharacterBody2D
|
|||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (!Alive)
|
||||
return;
|
||||
|
||||
Vector2 velocity = Velocity;
|
||||
|
||||
// Get the input direction and handle the movement/deceleration.
|
||||
|
@ -63,5 +66,7 @@ public partial class Player : CharacterBody2D
|
|||
GD.Print($"Killed by {killer.Name}");
|
||||
Alive = false;
|
||||
EmitSignal(SignalName.Killed);
|
||||
|
||||
DeathScreen.Instance.Killed(killer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Watcher : Node2D
|
||||
{
|
||||
|
|
BIN
sounds/thunderclap.ogg
Normal file
BIN
sounds/thunderclap.ogg
Normal file
Binary file not shown.
19
sounds/thunderclap.ogg.import
Normal file
19
sounds/thunderclap.ogg.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="oggvorbisstr"
|
||||
type="AudioStreamOggVorbis"
|
||||
uid="uid://ilvpdkvibr7c"
|
||||
path="res://.godot/imported/thunderclap.ogg-9dae3fe549e2cc5f445c495f439ee221.oggvorbisstr"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://sounds/thunderclap.ogg"
|
||||
dest_files=["res://.godot/imported/thunderclap.ogg-9dae3fe549e2cc5f445c495f439ee221.oggvorbisstr"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=4 format=3 uid="uid://chfnxa71xs3ww"]
|
||||
[gd_resource type="SpriteFrames" load_steps=4 format=3 uid="uid://8qygv4lq4pjf"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://duv3fbjw53vtw" path="res://sprites/tiles/floor/pressure_plate.png" id="1_j71no"]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=5 format=3 uid="uid://0xgmr60v1vxg"]
|
||||
[gd_resource type="SpriteFrames" load_steps=5 format=3 uid="uid://uith5rxps4s"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://l3v1hs32uxfp" path="res://sprites/tiles/floor/spikes/spikes_0001-sheet.png" id="1_xhodh"]
|
||||
|
||||
|
|
7
themes/zx_theme.tres
Normal file
7
themes/zx_theme.tres
Normal file
|
@ -0,0 +1,7 @@
|
|||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://daxgxg7c8v0ih"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dwn20pw40jpxm" path="res://fonts/ZxSpectrum7-nROZ0.ttf" id="1_rr8l8"]
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_rr8l8")
|
||||
default_font_size = 10
|
Loading…
Add table
Reference in a new issue