This commit is contained in:
PfandBoss
2022-12-10 04:13:00 +01:00
6 changed files with 38 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=2 format=3 uid="uid://kupfq75m0v37"]
[gd_scene load_steps=2 format=3 uid="uid://byo1m0n20yl45"]
[ext_resource type="Script" path="res://scripts/Modules/Cannon.gd" id="1_vdn0s"]

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=5 format=3 uid="uid://bl1yrgr7g06db"]
[gd_scene load_steps=5 format=3 uid="uid://n7w0ff7u25yc"]
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"]

View File

@@ -41,3 +41,11 @@ _global_script_class_icons={
config/name="Semester Game Jam 2022"
config/features=PackedStringArray("4.0", "Forward Plus")
config/icon="res://icon.svg"
[input]
test={
"deadzone": 0.5,
"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":70,"unicode":0,"echo":false,"script":null)
]
}

View File

@@ -5,21 +5,33 @@ signal ammo_pickup
signal shoot
var t = 0.0
@onready var tween = create_tween() as Tween
@export var p1 : PathFollow3D
@export var p2 : PathFollow3D
@onready var tween = create_tween() as Tween
@onready var p1 = $Player1Path/PathFollow3D
@onready var p2 = $Player2Path/PathFollow3D
var speed_p1 = 10
var speed_p2 = 10
func _ready():
start_tween()
func start_tween():
tween.stop()
tween = create_tween()
tween.set_parallel()
tween.set_trans(Tween.TRANS_LINEAR)
tween.set_parallel(true)
tween.tween_property(p1, "progress_ratio", 1, 20)
tween.tween_property(p2, "progress_ratio", -1, 20)
tween.tween_property(p1, "progress_ratio", 1, speed_p1)
tween.tween_property(p2, "progress_ratio", -1, speed_p2)
func _process(delta):
if Input.is_action_pressed("test"):
speed_p1 = 5
start_tween()
if round(p1.position.distance_to(p2.position)) == 9:
emit_signal("shoot")

View File

@@ -4,6 +4,8 @@ class_name Cannon
enum STATE {INACTIVE, RELOADING, SHOOTING}
var CAN_ENGAGE = true
#------------Methods-------------#
func _ready():
var root = get_tree().root.get_child(0)
@@ -23,10 +25,14 @@ func interact():
return
func _on_signal_shooting():
print("hit")
if not CAN_ENGAGE:
return
CAN_ENGAGE = false
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
currentState = STATE.SHOOTING
currentStashValue -= 1
#TODO: SHOOTING
print("hit")
currentState = STATE.INACTIVE
return

View File

@@ -14,10 +14,10 @@ func _ready():
currentStashValue = 0
func interact():
if currentStashValue >= 1:
--currentStashValue
currentStashValue -= 1
return
func _on_signal_storing():
if currentStashValue < maxStashValue:
++currentStashValue
currentStashValue += 1
return