mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 12:16:14 +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"]
|
[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"]
|
[ext_resource type="Script" path="res://scripts/Logic/Game.gd" id="1_iox18"]
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ signal ammo_pickup
|
|||||||
signal shoot
|
signal shoot
|
||||||
|
|
||||||
var t = 0.0
|
var t = 0.0
|
||||||
var CAN_ENGAGE = true
|
|
||||||
|
|
||||||
@onready var tween = create_tween() as Tween
|
@onready var tween = create_tween() as Tween
|
||||||
|
|
||||||
@@ -33,10 +32,8 @@ func _process(delta):
|
|||||||
speed_p1 = 5
|
speed_p1 = 5
|
||||||
start_tween()
|
start_tween()
|
||||||
|
|
||||||
if round(p1.position.distance_to(p2.position)) == 9 && CAN_ENGAGE:
|
if round(p1.position.distance_to(p2.position)) == 9:
|
||||||
CAN_ENGAGE = false
|
|
||||||
emit_signal("shoot")
|
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}
|
enum STATE {INACTIVE, RELOADING, SHOOTING}
|
||||||
|
|
||||||
|
var CAN_ENGAGE = true
|
||||||
|
|
||||||
#------------Methods-------------#
|
#------------Methods-------------#
|
||||||
func _ready():
|
func _ready():
|
||||||
var root = get_tree().root.get_child(0)
|
var root = get_tree().root.get_child(0)
|
||||||
@@ -23,10 +25,14 @@ func interact():
|
|||||||
return
|
return
|
||||||
|
|
||||||
func _on_signal_shooting():
|
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:
|
if currentStashValue >= 1 and currentState == STATE.INACTIVE:
|
||||||
currentState = STATE.SHOOTING
|
currentState = STATE.SHOOTING
|
||||||
currentStashValue -= 1
|
currentStashValue -= 1
|
||||||
#TODO: SHOOTING
|
print("hit")
|
||||||
currentState = STATE.INACTIVE
|
currentState = STATE.INACTIVE
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user