mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-21 23:34:18 +00:00
Add cheat spawners and fix again the ghost issue thing
This commit is contained in:
parent
099f95f374
commit
7da5138148
6 changed files with 122 additions and 29 deletions
12
game/action_timer.gd
Normal file
12
game/action_timer.gd
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
extends Timer
|
||||||
|
class_name ActionTimer
|
||||||
|
|
||||||
|
## A timer which keeps repeating as long as an action is held.
|
||||||
|
|
||||||
|
## The name of the action to check.
|
||||||
|
@export var action: String
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(_delta):
|
||||||
|
if is_stopped() and Input.is_action_pressed(action):
|
||||||
|
start()
|
8
game/action_timer.tscn
Normal file
8
game/action_timer.tscn
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dudb8wdjdenn3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://game/action_timer.gd" id="1_uw2x8"]
|
||||||
|
|
||||||
|
[node name="ActionTimer" type="Timer"]
|
||||||
|
wait_time = 0.05
|
||||||
|
one_shot = true
|
||||||
|
script = ExtResource("1_uw2x8")
|
|
@ -117,3 +117,7 @@ func _on_shop_ui_delete_cancel():
|
||||||
var item_converters = find_children("*", "ItemConverter", true, false)
|
var item_converters = find_children("*", "ItemConverter", true, false)
|
||||||
for converter in item_converters:
|
for converter in item_converters:
|
||||||
converter.ending_deletion()
|
converter.ending_deletion()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_action_timer_timeout():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
100
game/game.tscn
100
game/game.tscn
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=22 format=3 uid="uid://c3rxmcwa5nqng"]
|
[gd_scene load_steps=25 format=3 uid="uid://c3rxmcwa5nqng"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"]
|
[ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"]
|
[ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"]
|
||||||
|
@ -14,8 +14,11 @@
|
||||||
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"]
|
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
|
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"]
|
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="13_4j8om"]
|
||||||
[ext_resource type="Script" path="res://game/DebugTimer.gd" id="13_mwigi"]
|
[ext_resource type="PackedScene" uid="uid://dudb8wdjdenn3" path="res://game/action_timer.tscn" id="13_y2562"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="14_yjsue"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="15_trrh7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost/ghost.tscn" id="16_8vhx6"]
|
[ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost/ghost.tscn" id="16_8vhx6"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bawprh8kluilq" path="res://entity/gem/gem.tscn" id="16_20aff"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
|
||||||
size = Vector2(240, 384)
|
size = Vector2(240, 384)
|
||||||
|
@ -42,11 +45,12 @@ upgrade_gem_texture = ExtResource("5_y725k")
|
||||||
|
|
||||||
[node name="GravityFromGyro" parent="." instance=ExtResource("2_h2pfr")]
|
[node name="GravityFromGyro" parent="." instance=ExtResource("2_h2pfr")]
|
||||||
|
|
||||||
[node name="Ghost" parent="." node_paths=PackedStringArray("container") instance=ExtResource("16_8vhx6")]
|
[node name="Ghost" parent="." instance=ExtResource("16_8vhx6")]
|
||||||
process_mode = 4
|
|
||||||
visible = false
|
visible = false
|
||||||
position = Vector2(253, 109)
|
position = Vector2(253, 109)
|
||||||
container = NodePath("..")
|
|
||||||
|
[node name="Instantiator" parent="Ghost" index="2" node_paths=PackedStringArray("container")]
|
||||||
|
container = NodePath("../..")
|
||||||
|
|
||||||
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
|
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
@ -60,47 +64,94 @@ position = Vector2(136, 272)
|
||||||
shape = SubResource("RectangleShape2D_rh35r")
|
shape = SubResource("RectangleShape2D_rh35r")
|
||||||
debug_color = Color(0, 0.6, 0.701961, 0)
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
[node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
[node name="Spawners" type="Node2D" parent="."]
|
||||||
position = Vector2(136, 0)
|
position = Vector2(136, 0)
|
||||||
target = NodePath("..")
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="TimeSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
|
target = NodePath("../..")
|
||||||
buffer_cap = 1
|
buffer_cap = 1
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
overlapping_body_count_limit = 16
|
overlapping_body_count_limit = 16
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/TimeSpawner"]
|
||||||
shape = SubResource("RectangleShape2D_4uksi")
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
debug_color = Color(0, 0.6, 0.701961, 0)
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="TimeSpawner"]
|
[node name="Timer" type="Timer" parent="Spawners/TimeSpawner"]
|
||||||
|
|
||||||
[node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
[node name="ButtonSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
position = Vector2(136, 0)
|
|
||||||
scene = ExtResource("13_4j8om")
|
scene = ExtResource("13_4j8om")
|
||||||
target = NodePath("..")
|
target = NodePath("../..")
|
||||||
buffer_cap = 10
|
buffer_cap = 10
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
overlapping_body_count_limit = 16
|
overlapping_body_count_limit = 16
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"]
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/ButtonSpawner"]
|
||||||
shape = SubResource("RectangleShape2D_4uksi")
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
debug_color = Color(0, 0.6, 0.701961, 0)
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
[node name="DebugSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
[node name="CheatCopperSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
position = Vector2(136, 0)
|
scene = ExtResource("13_4j8om")
|
||||||
target = NodePath("..")
|
target = NodePath("../..")
|
||||||
buffer_cap = 1
|
buffer_cap = 10
|
||||||
spawn_rect = Rect2(-20, 0, 40, 0)
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
overlapping_body_count_limit = 16
|
overlapping_body_count_limit = 16
|
||||||
metadata/_edit_lock_ = true
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
[node name="NeckShape" type="CollisionShape2D" parent="DebugSpawner"]
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/CheatCopperSpawner"]
|
||||||
shape = SubResource("RectangleShape2D_4uksi")
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
debug_color = Color(0, 0.6, 0.701961, 0)
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
[node name="DebugTimer" type="Timer" parent="DebugSpawner"]
|
[node name="ActionTimer" parent="Spawners/CheatCopperSpawner" instance=ExtResource("13_y2562")]
|
||||||
script = ExtResource("13_mwigi")
|
action = "cheat_spawn_copper"
|
||||||
|
|
||||||
|
[node name="CheatSilverSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
|
scene = ExtResource("14_yjsue")
|
||||||
|
target = NodePath("../..")
|
||||||
|
buffer_cap = 10
|
||||||
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
|
overlapping_body_count_limit = 16
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/CheatSilverSpawner"]
|
||||||
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
|
[node name="ActionTimer" parent="Spawners/CheatSilverSpawner" instance=ExtResource("13_y2562")]
|
||||||
|
action = "cheat_spawn_silver"
|
||||||
|
|
||||||
|
[node name="CheatGoldSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
|
scene = ExtResource("15_trrh7")
|
||||||
|
target = NodePath("../..")
|
||||||
|
buffer_cap = 10
|
||||||
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
|
overlapping_body_count_limit = 16
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/CheatGoldSpawner"]
|
||||||
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
|
[node name="ActionTimer" parent="Spawners/CheatGoldSpawner" instance=ExtResource("13_y2562")]
|
||||||
|
action = "cheat_spawn_gold"
|
||||||
|
|
||||||
|
[node name="CheatGemSpawner" parent="Spawners" node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
|
scene = ExtResource("16_20aff")
|
||||||
|
target = NodePath("../..")
|
||||||
|
buffer_cap = 10
|
||||||
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
|
overlapping_body_count_limit = 16
|
||||||
|
metadata/_edit_lock_ = true
|
||||||
|
|
||||||
|
[node name="NeckShape" type="CollisionShape2D" parent="Spawners/CheatGemSpawner"]
|
||||||
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
|
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||||
|
|
||||||
|
[node name="ActionTimer" parent="Spawners/CheatGemSpawner" instance=ExtResource("13_y2562")]
|
||||||
|
action = "cheat_spawn_gem"
|
||||||
|
|
||||||
[node name="StoreCollector" parent="." instance=ExtResource("9_evdhb")]
|
[node name="StoreCollector" parent="." instance=ExtResource("9_evdhb")]
|
||||||
position = Vector2(135, 0)
|
position = Vector2(135, 0)
|
||||||
|
@ -182,6 +233,11 @@ shape = SubResource("RectangleShape2D_jed57")
|
||||||
debug_color = Color(0, 0, 0, 0.419608)
|
debug_color = Color(0, 0, 0, 0.419608)
|
||||||
|
|
||||||
[connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"]
|
[connection signal="changed" from="Bottle/Evaluator" to="." method="_on_score_changed"]
|
||||||
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
|
[connection signal="timeout" from="Spawners/TimeSpawner/Timer" to="Spawners/TimeSpawner" method="spawn"]
|
||||||
[connection signal="timeout" from="DebugSpawner/DebugTimer" to="DebugSpawner" method="spawn"]
|
[connection signal="timeout" from="Spawners/CheatCopperSpawner/ActionTimer" to="Spawners/CheatCopperSpawner" method="spawn"]
|
||||||
|
[connection signal="timeout" from="Spawners/CheatSilverSpawner/ActionTimer" to="Spawners/CheatSilverSpawner" method="spawn"]
|
||||||
|
[connection signal="timeout" from="Spawners/CheatGoldSpawner/ActionTimer" to="Spawners/CheatGoldSpawner" method="spawn"]
|
||||||
|
[connection signal="timeout" from="Spawners/CheatGemSpawner/ActionTimer" to="Spawners/CheatGemSpawner" method="spawn"]
|
||||||
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]
|
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]
|
||||||
|
|
||||||
|
[editable path="Ghost"]
|
||||||
|
|
|
@ -13,13 +13,6 @@ class_name Ghost
|
||||||
## The [Instantiator] to use to spawn the ghosted item.
|
## The [Instantiator] to use to spawn the ghosted item.
|
||||||
@onready var instantiator: Instantiator = $Instantiator
|
@onready var instantiator: Instantiator = $Instantiator
|
||||||
|
|
||||||
## The node which materialized entities should be attached to.
|
|
||||||
@export var container: Node = null:
|
|
||||||
get:
|
|
||||||
return instantiator.container
|
|
||||||
set(value):
|
|
||||||
instantiator.container = value
|
|
||||||
|
|
||||||
## The [OverlapChecker] to use to see if a solid block is overlapping the ghost.
|
## The [OverlapChecker] to use to see if a solid block is overlapping the ghost.
|
||||||
@onready var overlap_checker: OverlapChecker = $OverlapChecker
|
@onready var overlap_checker: OverlapChecker = $OverlapChecker
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,26 @@ ghost_precise={
|
||||||
, 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,"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,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
cheat_spawn_copper={
|
||||||
|
"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,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
cheat_spawn_silver={
|
||||||
|
"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,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
cheat_spawn_gold={
|
||||||
|
"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,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
cheat_spawn_gem={
|
||||||
|
"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":52,"key_label":0,"unicode":52,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue