mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 04:16:12 +01:00
Changes on Cannon.gd
This commit is contained in:
@@ -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"]
|
||||
|
||||
|
||||
@@ -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"]
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ signal ammo_pickup
|
||||
signal shoot
|
||||
|
||||
var t = 0.0
|
||||
var CAN_ENGAGE = true
|
||||
|
||||
@onready var tween = create_tween() as Tween
|
||||
|
||||
@@ -33,10 +32,8 @@ func _process(delta):
|
||||
speed_p1 = 5
|
||||
start_tween()
|
||||
|
||||
if round(p1.position.distance_to(p2.position)) == 9 && CAN_ENGAGE:
|
||||
CAN_ENGAGE = false
|
||||
if round(p1.position.distance_to(p2.position)) == 9:
|
||||
emit_signal("shoot")
|
||||
create_tween().tween_callback(func(): CAN_ENGAGE = true).set_delay(2)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user