This commit is contained in:
karl 2020-02-02 11:34:29 +01:00
commit f7cc3b8ddf
9 changed files with 96 additions and 26 deletions

View File

@ -11,10 +11,14 @@ var current_angle : float
func on_ingame():
ground = get_parent().get_node("Arena").get_node("ground")
ingame = true
axis_lock_linear_x = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if ingame:
current_angle = translation.angle_to(ground.translation)
print(current_angle)
current_angle = ((-transform.basis.z).angle_to(ground.transform.basis.y))
var rot_vector = (-transform.basis.z).cross(ground.transform.basis.y)
if current_angle > 0.2:
apply_torque_impulse(rot_vector * current_angle * 14)

View File

@ -12,6 +12,8 @@ height = 1.48749
"Player",
]]
transform = Transform( 1, 0, 0, 0, -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0 )
mass = 1.5
gravity_scale = 1.5
script = ExtResource( 1 )
[node name="TorsoCollider" type="CollisionShape" parent="."]

View File

@ -22,7 +22,7 @@ func action():
func push(body):
# We multiply by 0.1 because we only want it to spin slightly, it should mostly go up
var offset = transform.basis.xform(Vector3.ZERO) #transform.basis.xform(touch_area.global_transform.origin - base.global_transform.origin) * 0.5
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 5.0
var direction = (base.transform.basis.y - base.transform.basis.z).normalized() * 10.0
base.apply_impulse(offset, direction)

View File

@ -1,12 +1,15 @@
extends Node
const _main_menu_path = "res://UI/MainMenu.tscn"
const _body_build_path = "res://BodyConfig/bodyBuilderMenu.tscn"
const _fighting_path = "res://Ingame/Testing.tscn"
const _win_screen_path = "res://UI/WinScreen.tscn"
var _main_menu_scene
var _body_build_scene
var _fighting_scene
var _win_screen_scene
var _bodies : Array
var _body_count = 0
var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15, 0), Vector3(30, 15, 0)]
@ -14,15 +17,17 @@ var _body_positions = [Vector3(0, 15, -30), Vector3(0, 15, 30), Vector3(-30, 15,
func _ready():
InGameState.player_count = 2
_prep_scene("body_build")
_prep_scene("fight_scene")
_prep_scene("win_screen")
_prep_scene("main_menu")
_switch_scene(_body_build_scene, "body_build")
_switch_scene(_main_menu_scene, "main_menu")
func _prep_scene(scene_name) -> Node:
if scene_name == "body_build":
if scene_name == "main_menu":
_main_menu_scene = preload(_main_menu_path).instance()
_main_menu_scene.connect("body_build", self, "_switch_to_body_build")
return _main_menu_scene
elif 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
@ -86,3 +91,4 @@ func _switch_to_fighting(torso):
func _switch_to_body_build():
_switch_scene(_body_build_scene, "body_build")
_body_build_scene.change_count_ui()

View File

@ -58,7 +58,7 @@ rotation_mode = 4
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="PathFollow3" type="PathFollow" parent="Path"]
transform = Transform( 0.0525302, 0, 0.998617, 0, 1, 0, -0.998619, 0, 0.0525301, 1.77306, 0, -55.9514 )
transform = Transform( 0.0525302, 0, 0.998617, 0, 1, 0, -0.998619, 0, 0.05253, 1.77306, 0, -55.9514 )
offset = 57.5
rotation_mode = 4
@ -66,7 +66,7 @@ rotation_mode = 4
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="PathFollow4" type="PathFollow" parent="Path"]
transform = Transform( 0.412628, 0, 0.910899, 0, 1, 0, -0.9109, 0, 0.412628, 25.6454, 0, -49.4766 )
transform = Transform( 0.412629, 0, 0.910899, 0, 1, 0, -0.9109, 0, 0.412628, 25.6454, 0, -49.4766 )
offset = 82.37
rotation_mode = 4
@ -106,7 +106,7 @@ rotation_mode = 4
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="PathFollow9" type="PathFollow" parent="Path"]
transform = Transform( 0.760079, -6.86382e-07, -0.64983, 7.11586e-07, 1, -2.23934e-07, 0.649831, -2.92203e-07, 0.760078, 48.2851, 2.0276e-05, 59.2494 )
transform = Transform( 0.760079, -6.86382e-07, -0.64983, 7.11587e-07, 1, -2.23935e-07, 0.649831, -2.92203e-07, 0.760078, 48.2851, 2.0276e-05, 59.2494 )
offset = 206.72
rotation_mode = 4
@ -170,7 +170,7 @@ rotation_mode = 4
transform = Transform( -1, 0, -3.25841e-07, 0, 1, 0, 3.25841e-07, 0, -1, 0, 0, 0 )
[node name="PathFollow17" type="PathFollow" parent="Path"]
transform = Transform( -0.817611, 3.47972e-07, 0.57577, 4.25596e-07, 1, 0, -0.575771, 2.45046e-07, -0.817609, -57.8267, 0, -24.3573 )
transform = Transform( -0.817611, 3.47972e-07, 0.57577, 4.25597e-07, 1, 0, -0.575771, 2.45046e-07, -0.817609, -57.8267, 0, -24.3573 )
offset = 405.68
rotation_mode = 4

View File

@ -17,3 +17,5 @@ script = ExtResource( 6 )
[node name="Camera" type="Camera" parent="CameraFocus"]
transform = Transform( -4.2222e-08, -0.707107, 0.707107, -1.13133e-08, 0.707107, 0.707107, -1, 2.18557e-08, -3.78552e-08, 19, 17, -2 )
[editable path="Arena"]

19
UI/MainMenu.gd Normal file
View File

@ -0,0 +1,19 @@
extends Control
export(NodePath) var startPath
var _start_button
signal body_build()
func _ready():
_start_button = get_node(startPath) as Button
func _on_Start_pressed():
emit_signal("body_build")
func _on_Exit_pressed():
get_tree().quit()

View File

@ -1,5 +1,6 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=7 format=2]
[ext_resource path="res://UI/MainMenu.gd" type="Script" id=1]
[ext_resource path="res://Resources/Fonts/MenuHeader.tres" type="DynamicFont" id=2]
[ext_resource path="res://Resources/Fonts/MenuTextFont.tres" type="DynamicFont" id=3]
[ext_resource path="res://Resources/Styles/ButtonHoverStyle.tres" type="StyleBox" id=4]
@ -9,9 +10,11 @@
[node name="MainMenu" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
startPath = NodePath("MarginContainer2/VBoxContainer/Start")
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_left = 0.5
@ -32,15 +35,17 @@ margin_bottom = 600.0
[node name="GameName" type="Label" parent="MarginContainer/VBoxContainer"]
margin_right = 1024.0
margin_bottom = 250.0
margin_bottom = 298.0
rect_min_size = Vector2( 0, 250 )
size_flags_horizontal = 3
size_flags_vertical = 3
custom_fonts/font = ExtResource( 2 )
text = "Excrements!"
text = "D-d-d-d-d-duell"
align = 1
valign = 2
[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 254.0
margin_top = 302.0
margin_right = 1024.0
margin_bottom = 600.0
size_flags_horizontal = 3
@ -49,13 +54,25 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/CenterContainer"]
margin_left = 412.0
margin_top = 104.0
margin_right = 612.0
margin_bottom = 242.0
[node name="MarginContainer2" type="MarginContainer" parent="."]
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
margin_left = -100.0
margin_top = -201.0
margin_right = 100.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Start" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/VBoxContainer"]
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer2"]
margin_right = 200.0
margin_bottom = 201.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Start" type="Button" parent="MarginContainer2/VBoxContainer"]
margin_right = 200.0
margin_bottom = 67.0
rect_min_size = Vector2( 200, 25 )
@ -68,10 +85,19 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Exit" type="Button" parent="MarginContainer/VBoxContainer/CenterContainer/VBoxContainer"]
[node name="SpacerDots2" type="Control" parent="MarginContainer2/VBoxContainer"]
margin_top = 71.0
margin_right = 200.0
margin_bottom = 138.0
margin_bottom = 91.0
rect_min_size = Vector2( 0, 20 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Exit" type="Button" parent="MarginContainer2/VBoxContainer"]
margin_top = 95.0
margin_right = 200.0
margin_bottom = 162.0
rect_min_size = Vector2( 200, 25 )
custom_styles/hover = ExtResource( 4 )
custom_styles/pressed = ExtResource( 5 )
@ -81,3 +107,14 @@ text = "Disenjoy"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="SpacerDots" type="Control" parent="MarginContainer2/VBoxContainer"]
margin_top = 166.0
margin_right = 200.0
margin_bottom = 201.0
rect_min_size = Vector2( 0, 35 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="MarginContainer2/VBoxContainer/Start" to="." method="_on_Start_pressed"]
[connection signal="pressed" from="MarginContainer2/VBoxContainer/Exit" to="." method="_on_Exit_pressed"]

View File

@ -9,7 +9,7 @@
config_version=4
_global_script_classes=[ {
"base": "Spatial",
"base": "RigidBody",
"class": "BodyBase",
"language": "GDScript",
"path": "res://BodyParts/BodyBase/BodyBase.gd"