bomb defusal prototype

This commit is contained in:
Tabby 2025-05-11 21:04:36 +10:00
parent cef1d348d4
commit 29e48dd5af
5 changed files with 193 additions and 8 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://ct8axfbvd2wn4"]
[gd_scene load_steps=8 format=3 uid="uid://ct8axfbvd2wn4"]
[ext_resource type="PackedScene" uid="uid://63rik2noj8id" path="res://base modules/test_channel.tscn" id="1_mlf6e"]
[ext_resource type="PackedScene" uid="uid://ch1x8pfdu2b1g" path="res://test_game.tscn" id="2_mixcd"]
@ -6,6 +6,7 @@
[ext_resource type="PackedScene" uid="uid://bw1hhx7lyfonr" path="res://games/asteroids/asteroids.tscn" id="3_mj2jn"]
[ext_resource type="PackedScene" uid="uid://ckbyiwy0dxbsd" path="res://games/platformer/platformer.tscn" id="4_mj2jn"]
[ext_resource type="PackedScene" uid="uid://cnpyrh4c6a7cg" path="res://games/bullet_hell/bullet_hell.tscn" id="6_kdryc"]
[ext_resource type="PackedScene" uid="uid://d0qteaieltywg" path="res://games/bomb defusal/bomb_defusal.tscn" id="7_6e45b"]
[node name="GameScene" type="Control"]
layout_mode = 3
@ -66,6 +67,11 @@ layout_mode = 2
channel_name = "Bullet Hell"
channel_scene = ExtResource("6_kdryc")
[node name="Control5" parent="GridContainer" instance=ExtResource("1_mlf6e")]
layout_mode = 2
channel_name = "Bomb Defusal"
channel_scene = ExtResource("7_6e45b")
[node name="ColorRect3" type="TextureRect" parent="GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
@ -80,12 +86,5 @@ size_flags_vertical = 3
texture = ExtResource("2_po0ka")
expand_mode = 1
[node name="ColorRect5" type="TextureRect" parent="GridContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource("2_po0ka")
expand_mode = 1
[node name="Camera2D" type="Camera2D" parent="."]
offset = Vector2(320, 180)

View file

@ -0,0 +1,55 @@
extends Node
@export var code_length : int = 8
@export_group("Node References")
@export var progress1 : ProgressBar
@export var progress2 : ProgressBar
@export var prompt : Label
var numbers_typed : int = 0
var current_number : int
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
progress1.value = numbers_typed
progress2.value = numbers_typed
prompt.text = str(current_number)
#TODO Surely theres a better way
if Input.is_action_just_pressed("bomb_0"):
enter_number(0)
elif Input.is_action_just_pressed("bomb_1"):
enter_number(1)
elif Input.is_action_just_pressed("bomb_2"):
enter_number(2)
elif Input.is_action_just_pressed("bomb_3"):
enter_number(3)
elif Input.is_action_just_pressed("bomb_4"):
enter_number(4)
elif Input.is_action_just_pressed("bomb_5"):
enter_number(5)
elif Input.is_action_just_pressed("bomb_6"):
enter_number(6)
elif Input.is_action_just_pressed("bomb_7"):
enter_number(7)
elif Input.is_action_just_pressed("bomb_8"):
enter_number(8)
elif Input.is_action_just_pressed("bomb_9"):
enter_number(9)
func enter_number(number : int):
if(number == current_number):
numbers_typed += 1
pick_new_number()
else:
#womp womp (lose channel)
pass
func pick_new_number():
current_number = randi_range(0,9)

View file

@ -0,0 +1 @@
uid://c7xvq23usjvax

View file

@ -0,0 +1,70 @@
[gd_scene load_steps=5 format=3 uid="uid://d0qteaieltywg"]
[ext_resource type="Script" uid="uid://c7xvq23usjvax" path="res://games/bomb defusal/bomb_defusal.gd" id="1_kwp46"]
[sub_resource type="Gradient" id="Gradient_yym1j"]
colors = PackedColorArray(0.947327, 0.000737363, 0.000402951, 1, 0, 0, 0, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_kwp46"]
gradient = SubResource("Gradient_yym1j")
fill = 1
fill_from = Vector2(0.495726, 0.452991)
[sub_resource type="LabelSettings" id="LabelSettings_yym1j"]
font_size = 226
[node name="BombDefusal" type="Node" node_paths=PackedStringArray("progress1", "progress2", "prompt")]
script = ExtResource("1_kwp46")
progress1 = NodePath("MarginContainer/PanelContainer/HBoxContainer/ProgressBar")
progress2 = NodePath("MarginContainer/PanelContainer/HBoxContainer/ProgressBar2")
prompt = NodePath("MarginContainer/PanelContainer/HBoxContainer/Label")
[node name="TextureRect" type="TextureRect" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
texture = SubResource("GradientTexture2D_kwp46")
[node name="MarginContainer" type="MarginContainer" parent="."]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 100
theme_override_constants/margin_top = 20
theme_override_constants/margin_right = 100
theme_override_constants/margin_bottom = 20
[node name="PanelContainer" type="PanelContainer" parent="MarginContainer"]
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/PanelContainer"]
layout_mode = 2
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
max_value = 8.0
step = 1.0
fill_mode = 3
show_percentage = false
[node name="Label" type="Label" parent="MarginContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "8"
label_settings = SubResource("LabelSettings_yym1j")
horizontal_alignment = 1
[node name="ProgressBar2" type="ProgressBar" parent="MarginContainer/PanelContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 1
max_value = 8.0
step = 1.0
fill_mode = 3
show_percentage = false

View file

@ -73,6 +73,66 @@ hell_down={
"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":75,"key_label":0,"unicode":107,"location":0,"echo":false,"script":null)
]
}
bomb_0={
"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":4194438,"key_label":0,"unicode":48,"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":48,"key_label":0,"unicode":48,"location":0,"echo":false,"script":null)
]
}
bomb_1={
"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":49,"key_label":0,"unicode":49,"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":4194439,"key_label":0,"unicode":49,"location":0,"echo":false,"script":null)
]
}
bomb_2={
"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":50,"key_label":0,"unicode":50,"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":4194440,"key_label":0,"unicode":50,"location":0,"echo":false,"script":null)
]
}
bomb_3={
"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":51,"key_label":0,"unicode":51,"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":4194441,"key_label":0,"unicode":51,"location":0,"echo":false,"script":null)
]
}
bomb_4={
"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":52,"key_label":0,"unicode":52,"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":4194442,"key_label":0,"unicode":52,"location":0,"echo":false,"script":null)
]
}
bomb_5={
"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":53,"key_label":0,"unicode":53,"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":4194443,"key_label":0,"unicode":53,"location":0,"echo":false,"script":null)
]
}
bomb_6={
"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":54,"key_label":0,"unicode":54,"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":4194444,"key_label":0,"unicode":54,"location":0,"echo":false,"script":null)
]
}
bomb_7={
"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":55,"key_label":0,"unicode":55,"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":4194445,"key_label":0,"unicode":55,"location":0,"echo":false,"script":null)
]
}
bomb_8={
"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":56,"key_label":0,"unicode":56,"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":4194446,"key_label":0,"unicode":56,"location":0,"echo":false,"script":null)
]
}
bomb_9={
"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":57,"key_label":0,"unicode":57,"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":4194447,"key_label":0,"unicode":57,"location":0,"echo":false,"script":null)
]
}
[rendering]