mirror of
https://github.com/PfandBoss/SemesterGameJam2022.git
synced 2025-11-12 12:16:14 +01:00
Initial Game Logic
This commit is contained in:
27
scripts/Logic/Game.gd
Normal file
27
scripts/Logic/Game.gd
Normal file
@@ -0,0 +1,27 @@
|
||||
extends Node
|
||||
|
||||
#Signals
|
||||
signal ammo_pickup
|
||||
signal shoot
|
||||
|
||||
var t = 0.0
|
||||
@onready var tween = create_tween() as Tween
|
||||
@onready var p1 = $Player1Path/PathFollow3D
|
||||
@onready var p2 = $Player2Path/PathFollow3D
|
||||
|
||||
|
||||
func _ready():
|
||||
start_tween()
|
||||
|
||||
func start_tween():
|
||||
tween.set_trans(Tween.TRANS_LINEAR)
|
||||
tween.set_parallel(true)
|
||||
tween.tween_property(p1, "progress_ratio", 1, 5)
|
||||
tween.tween_property(p2, "progress_ratio", -1, 5)
|
||||
|
||||
func _process(delta):
|
||||
if round(p1.position.distance_to(p2.position)) == 9:
|
||||
emit_signal("shoot")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user