This commit is contained in:
mathias 2020-02-01 19:18:06 +01:00
commit f0383109f4
14 changed files with 49 additions and 28 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
3D Input/handTextur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Binary file not shown.

View File

@ -66,6 +66,6 @@ collide_with_areas = true
collide_with_bodies = false
[node name="Torso" parent="." instance=ExtResource( 1 )]
[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Button2_pressed"]
[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Start_pressed"]
[editable path="Torso"]

View File

@ -17,12 +17,15 @@ var _viewport : Viewport
var _velx = 0
var _vely = 0
var _attachment_point : Spatial
var _default_grav
signal start_fight()
# Called when the node enters the scene tree for the first time.
func _ready():
_default_grav = PhysicsServer.area_get_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY)
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, 0)
_torso = get_node(torsoPath) as RigidBody
_camera = get_node(cameraPath) as Camera
@ -117,3 +120,8 @@ func delete_body_part():
if body_part != null:
body_part.queue_free()
func _on_Start_pressed():
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, _default_grav)
emit_signal("start_fight")

View File

@ -1,41 +1,59 @@
extends Node
var _win_screen_scene
var _fighting_scene_path = "res://Ingame/Testing.tscn"
var _fighting_scene
const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn"
const _fighting_path = "res://Ingame/Testing.tscn"
const _win_screen_path = "res://UI/WinScreen.tscn"
var _body_build_scene
var _fighting_scene
var _win_screen_scene
func _ready():
_win_screen_scene = preload("res://UI/WinScreen.tscn").instance()
_body_build_scene = preload("res://BodyConfig/bodyBuilderMenu.tscn").instance()
_fighting_scene = preload("res://Ingame/Testing.tscn").instance()
_prep_scene("body_build")
_prep_scene("fight_scene")
_prep_scene("win_screen")
InGameState.connect("player_win", self, "_switch_to_win")
_switch_scene(_body_build_scene, "body_build")
func _prep_scene(scene_name) -> Node:
if scene_name == "body_build":
_body_build_scene = preload(_body_build_path).instance()
_body_build_scene.connect("start_fight", self, "_switch_to_fighting")
return _body_build_scene
elif scene_name == "fight_scene":
_fighting_scene = preload(_fighting_path).instance()
InGameState.connect("player_win", self, "_switch_to_win")
return _fighting_scene
elif scene_name == "win_screen":
_win_screen_scene = preload(_win_screen_path).instance()
_win_screen_scene.connect("build_body", self, "_switch_to_body_build")
return _win_screen_scene
return null
func _switch_scene(scene):
func _switch_scene(scene, scene_name):
#delete children
for child in get_children():
child.queue_free()
#append win scene
add_child(scene)
var new_scene = _prep_scene(scene_name)
add_child(new_scene)
func _switch_to_win(player_id):
_switch_scene(_win_screen_scene)
print("test win")
_switch_scene(_win_screen_scene, "win_screen")
#call win message in win scene
_win_screen_scene.set_win_message(player_id)
func _switch_to_fighting():
print("oh fuck")
_switch_scene(_fighting_scene)
#get_tree().reload_current_scene()
_switch_scene(_fighting_scene, "fight_scene")
func _switch_to_body_build():
_switch_scene(_body_build_scene)
_switch_scene(_body_build_scene, "body_build")

View File

@ -1,9 +1,6 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Controllers/GameStateController.gd" type="Script" id=1]
[ext_resource path="res://BodyConfig/bodyBuilderMenu.tscn" type="PackedScene" id=2]
[node name="GameStateController" type="Node"]
script = ExtResource( 1 )
[node name="Body Builder Menu" parent="." instance=ExtResource( 2 )]

View File

@ -7,15 +7,15 @@
[ext_resource path="res://Resources/Styles/ButtonPressedStyle.tres" type="StyleBox" id=5]
[ext_resource path="res://Resources/Styles/ButtonNormalStyle.tres" type="StyleBox" id=6]
[node name="Spatial" type="Control"]
[node name="WinScreen" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
labelPath = NodePath("MarginContainer/VBoxContainer/PlayerWon")
continuePath = NodePath("MarginContainer/VBoxContainer/Control/Continue")
labelPath = NodePath("../WinScreen/MarginContainer/VBoxContainer/PlayerWon")
continuePath = NodePath("../WinScreen/MarginContainer/VBoxContainer/Control/Continue")
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0

View File

@ -18,6 +18,4 @@ func set_win_message(player_id):
func _on_Continue_pressed():
print("test2")
emit_signal("build_body")