From e45e95b5ff4330dacf5329ef8c9f7657d5dfc4e0 Mon Sep 17 00:00:00 2001 From: Lukas Moungos Date: Sat, 10 Dec 2022 09:16:22 +0100 Subject: [PATCH] revert --- project.godot | 8 +------- scripts/Logic/Game.gd | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/project.godot b/project.godot index 0b88a90..243c082 100644 --- a/project.godot +++ b/project.godot @@ -48,11 +48,6 @@ _global_script_classes=[{ "class": &"TrainEngine", "language": &"GDScript", "path": "res://scripts/Modules/Engine.gd" -}, { -"base": "StraightMapNode", -"class": &"TurnMapNode", -"language": &"GDScript", -"path": "res://scripts/Logic/TurnMapNode.gd" }] _global_script_class_icons={ "Cannon": "", @@ -62,8 +57,7 @@ _global_script_class_icons={ "Storage": "", "StraightMapNode": "", "Train": "", -"TrainEngine": "", -"TurnMapNode": "" +"TrainEngine": "" } [application] diff --git a/scripts/Logic/Game.gd b/scripts/Logic/Game.gd index 5db9c6b..0f68480 100644 --- a/scripts/Logic/Game.gd +++ b/scripts/Logic/Game.gd @@ -1,10 +1,16 @@ extends Node class_name Game +const CHILL = 0 +const FIGHTING = 1 + + #Signals signal ammo_pickup signal shoot +var fight_state = CHILL + var t = 0.0 @onready var p1_train = $Player1 as Train @@ -19,6 +25,7 @@ func _ready(): p2_node = StartNode p2_train.get_node("CharacterBody3D").is_player1 = false p2_train.is_P1 = false + p1_train.current_speed = 10 p1_train.hit.connect(_on_hit_player) p2_train.hit.connect(_on_hit_player) @@ -43,6 +50,20 @@ func _process(delta): p2_node = p2_node._on_train_exit(p2_train) p2_train.current_distance = distance_delta - + if(p1_node == p2_node && p1_train.current_distance - p2_train.current_distance < 2): + if(fight_state == CHILL): + var tween = create_tween() + tween.tween_property($Camera3D, "position", Vector3(0,10,0), 1) + fight_state = FIGHTING + else: + fight_state = CHILL + var tween = create_tween() + tween.tween_property($Camera3D, "position", Vector3(0,20,0), 1) + + if Input.is_action_pressed("test"): emit_signal("shoot") + + + +