unlimited games
This commit is contained in:
parent
29e48dd5af
commit
119f7f9625
11 changed files with 359 additions and 1 deletions
|
|
@ -52,4 +52,7 @@ func enter_number(number : int):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func pick_new_number():
|
func pick_new_number():
|
||||||
current_number = randi_range(0,9)
|
var new_number = current_number
|
||||||
|
while(new_number == current_number):
|
||||||
|
new_number = randi_range(0,9)
|
||||||
|
current_number = new_number
|
||||||
|
|
|
||||||
76
games/crafting/crafting.gd
Normal file
76
games/crafting/crafting.gd
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
extends Node
|
||||||
|
@export var keys : Array[String]
|
||||||
|
@export var time_limit : float = 25
|
||||||
|
|
||||||
|
@export_group("Node References")
|
||||||
|
@export var pixel_grid : GridContainer
|
||||||
|
@export var timer_progress : ProgressBar
|
||||||
|
var pixels : Array[Control]
|
||||||
|
var current_time : float = 25
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
create_pixels()
|
||||||
|
current_time = time_limit
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
func create_pixels():
|
||||||
|
for i in range(25):
|
||||||
|
var newPixel = load("res://games/crafting/pixel.tscn").instantiate()
|
||||||
|
var randomKey = randi_range(0,keys.size()-1)
|
||||||
|
newPixel.key = keys[randomKey]
|
||||||
|
pixels.append(newPixel)
|
||||||
|
pixel_grid.add_child(newPixel)
|
||||||
|
|
||||||
|
func enter_letter(letter : String):
|
||||||
|
var found : bool = false
|
||||||
|
var options : Array[Control]
|
||||||
|
for pixel in pixels:
|
||||||
|
if (pixel.key == letter and !pixel.activated):
|
||||||
|
found = true
|
||||||
|
options.append(pixel)
|
||||||
|
if(found):
|
||||||
|
var randomPixel : int = randi_range(0, options.size()-1)
|
||||||
|
options[randomPixel].activate()
|
||||||
|
else:
|
||||||
|
for i in range(3):
|
||||||
|
var randomPixel : int = randi_range(0,pixels.size()-1)
|
||||||
|
pixels[randomPixel].deactivate()
|
||||||
|
if count_activated():
|
||||||
|
pass
|
||||||
|
#winner
|
||||||
|
|
||||||
|
func count_activated() -> bool:
|
||||||
|
var count : int = 0
|
||||||
|
for pixel in pixels:
|
||||||
|
if pixel.activated:
|
||||||
|
count += 1
|
||||||
|
if count == 25:
|
||||||
|
return true
|
||||||
|
else:
|
||||||
|
return false
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
current_time -= delta
|
||||||
|
timer_progress.value = current_time/time_limit
|
||||||
|
if current_time <= 0:
|
||||||
|
pass
|
||||||
|
#loser
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("crafting_e"):
|
||||||
|
enter_letter("E")
|
||||||
|
elif Input.is_action_just_pressed("crafting_q"):
|
||||||
|
enter_letter("Q")
|
||||||
|
elif Input.is_action_just_pressed("crafting_r"):
|
||||||
|
enter_letter("R")
|
||||||
|
elif Input.is_action_just_pressed("crafting_t"):
|
||||||
|
enter_letter("T")
|
||||||
|
elif Input.is_action_just_pressed("crafting_y"):
|
||||||
|
enter_letter("Y")
|
||||||
|
elif Input.is_action_just_pressed("crafting_u"):
|
||||||
|
enter_letter("U")
|
||||||
|
elif Input.is_action_just_pressed("crafting_f"):
|
||||||
|
enter_letter("F")
|
||||||
|
elif Input.is_action_just_pressed("crafting_m"):
|
||||||
|
enter_letter("M")
|
||||||
1
games/crafting/crafting.gd.uid
Normal file
1
games/crafting/crafting.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://b4ps00o1tpuft
|
||||||
49
games/crafting/crafting.tscn
Normal file
49
games/crafting/crafting.tscn
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
[gd_scene load_steps=5 format=3 uid="uid://drk2fwkv816qv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b4ps00o1tpuft" path="res://games/crafting/crafting.gd" id="1_51qhm"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_51qhm"]
|
||||||
|
colors = PackedColorArray(0.774014, 0.581042, 1, 1, 1, 0.595754, 0.986362, 1)
|
||||||
|
|
||||||
|
[sub_resource type="FastNoiseLite" id="FastNoiseLite_8e2i7"]
|
||||||
|
noise_type = 0
|
||||||
|
fractal_type = 3
|
||||||
|
|
||||||
|
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_26tlc"]
|
||||||
|
width = 360
|
||||||
|
height = 180
|
||||||
|
color_ramp = SubResource("Gradient_51qhm")
|
||||||
|
noise = SubResource("FastNoiseLite_8e2i7")
|
||||||
|
|
||||||
|
[node name="Crafting" type="Node" node_paths=PackedStringArray("pixel_grid", "timer_progress")]
|
||||||
|
script = ExtResource("1_51qhm")
|
||||||
|
keys = Array[String](["Q", "E", "R", "T", "Y", "U", "F", "M"])
|
||||||
|
pixel_grid = NodePath("CenterContainer/VBoxContainer/GridContainer")
|
||||||
|
timer_progress = NodePath("CenterContainer/VBoxContainer/Timer")
|
||||||
|
|
||||||
|
[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("NoiseTexture2D_26tlc")
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="GridContainer" type="GridContainer" parent="CenterContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
columns = 5
|
||||||
|
|
||||||
|
[node name="Timer" type="ProgressBar" parent="CenterContainer/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
max_value = 1.0
|
||||||
|
step = 0.0
|
||||||
28
games/crafting/pixel.gd
Normal file
28
games/crafting/pixel.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
extends ColorRect
|
||||||
|
|
||||||
|
|
||||||
|
@export var end_color : Color = Color.PURPLE
|
||||||
|
@export_group("Node References")
|
||||||
|
@export var key_label : Label
|
||||||
|
var key : String = "Q"
|
||||||
|
var activated : bool = false
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
key_label.visible = !activated
|
||||||
|
key_label.text = key
|
||||||
|
if(activated):
|
||||||
|
color = end_color
|
||||||
|
else:
|
||||||
|
color = Color.WHITE
|
||||||
|
|
||||||
|
func activate():
|
||||||
|
activated = true
|
||||||
|
|
||||||
|
func deactivate():
|
||||||
|
activated = false
|
||||||
1
games/crafting/pixel.gd.uid
Normal file
1
games/crafting/pixel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bs11jp8pmu8uv
|
||||||
24
games/crafting/pixel.tscn
Normal file
24
games/crafting/pixel.tscn
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://b7fjw13eg65gh"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bs11jp8pmu8uv" path="res://games/crafting/pixel.gd" id="1_gwgos"]
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_8qltj"]
|
||||||
|
font_size = 56
|
||||||
|
font_color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
|
[node name="ColorRect" type="ColorRect" node_paths=PackedStringArray("key_label")]
|
||||||
|
custom_minimum_size = Vector2(60, 60)
|
||||||
|
script = ExtResource("1_gwgos")
|
||||||
|
key_label = NodePath("Label")
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="."]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
text = "A"
|
||||||
|
label_settings = SubResource("LabelSettings_8qltj")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
vertical_alignment = 1
|
||||||
31
games/reaction/reaction.gd
Normal file
31
games/reaction/reaction.gd
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
@export var reaction_window : float = 1
|
||||||
|
@export_group("Node References")
|
||||||
|
@export var prepare_node : Control
|
||||||
|
@export var press_node : Control
|
||||||
|
var time_remaining : float
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
time_remaining = randf_range(5,15)
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
time_remaining -= delta
|
||||||
|
prepare_node.visible = time_remaining > 0
|
||||||
|
press_node.visible = time_remaining <= 0
|
||||||
|
if(time_remaining <= 0):
|
||||||
|
reaction_window -= delta
|
||||||
|
if(Input.is_action_just_pressed("reaction_press")):
|
||||||
|
if(time_remaining<=0 and reaction_window > 0):
|
||||||
|
pass
|
||||||
|
#winner
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
#loser
|
||||||
|
pass
|
||||||
1
games/reaction/reaction.gd.uid
Normal file
1
games/reaction/reaction.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cs3ipvky7dk6c
|
||||||
99
games/reaction/reaction.tscn
Normal file
99
games/reaction/reaction.tscn
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
[gd_scene load_steps=7 format=3 uid="uid://bcu5svl5gjd4r"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cs3ipvky7dk6c" path="res://games/reaction/reaction.gd" id="1_fqqjl"]
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_nlvo0"]
|
||||||
|
colors = PackedColorArray(0, 0.730016, 0, 1, 0.0627451, 1, 1, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture2D" id="GradientTexture2D_fqqjl"]
|
||||||
|
gradient = SubResource("Gradient_nlvo0")
|
||||||
|
fill_from = Vector2(0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="LabelSettings" id="LabelSettings_npxhc"]
|
||||||
|
font_size = 80
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_6p5vi"]
|
||||||
|
colors = PackedColorArray(1, 0, 0.141176, 1, 1, 1, 0, 1)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture2D" id="GradientTexture2D_wmmsg"]
|
||||||
|
gradient = SubResource("Gradient_6p5vi")
|
||||||
|
fill_to = Vector2(1, 1)
|
||||||
|
|
||||||
|
[node name="Reaction" type="Node"]
|
||||||
|
script = ExtResource("1_fqqjl")
|
||||||
|
|
||||||
|
[node name="Prepare" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="Prepare"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("GradientTexture2D_fqqjl")
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="Prepare"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 30
|
||||||
|
theme_override_constants/margin_right = 30
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="Prepare/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Prepare/MarginContainer/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Get Ready to press Space"
|
||||||
|
label_settings = SubResource("LabelSettings_npxhc")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
autowrap_mode = 2
|
||||||
|
|
||||||
|
[node name="Press" type="Control" parent="."]
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="TextureRect" type="TextureRect" parent="Press"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
texture = SubResource("GradientTexture2D_wmmsg")
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="Press"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_constants/margin_left = 30
|
||||||
|
theme_override_constants/margin_right = 30
|
||||||
|
|
||||||
|
[node name="PanelContainer" type="PanelContainer" parent="Press/MarginContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 4
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Press/MarginContainer/PanelContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Press Space Now!!!"
|
||||||
|
label_settings = SubResource("LabelSettings_npxhc")
|
||||||
|
horizontal_alignment = 1
|
||||||
|
autowrap_mode = 2
|
||||||
|
|
@ -133,6 +133,51 @@ bomb_9={
|
||||||
, 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)
|
, 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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
reaction_press={
|
||||||
|
"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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_q={
|
||||||
|
"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":81,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_e={
|
||||||
|
"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":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_r={
|
||||||
|
"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":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_t={
|
||||||
|
"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":84,"key_label":0,"unicode":116,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_y={
|
||||||
|
"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":89,"key_label":0,"unicode":121,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_u={
|
||||||
|
"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":85,"key_label":0,"unicode":117,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_f={
|
||||||
|
"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":70,"key_label":0,"unicode":102,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
crafting_m={
|
||||||
|
"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":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue