Merge branch 'master' of https://gitlab.hexaquo.at/ggjg20/bodypartfighter
This commit is contained in:
commit
56f491f68e
@ -28,8 +28,6 @@ signal start_fight()
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
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
|
_torso = get_node(torsoPath) as RigidBody
|
||||||
_camera = get_node(cameraPath) as Camera
|
_camera = get_node(cameraPath) as Camera
|
||||||
_rayCast = get_node(rayCastPath) as RayCast
|
_rayCast = get_node(rayCastPath) as RayCast
|
||||||
@ -45,6 +43,9 @@ func change_count_ui():
|
|||||||
|
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
# TODO: Would be nicer to just disable gravity, but then it can't be re-enabled...
|
||||||
|
_torso.translation = Vector3.ZERO
|
||||||
|
|
||||||
if _viewRot:
|
if _viewRot:
|
||||||
var mouse_pos = get_viewport().get_mouse_position()
|
var mouse_pos = get_viewport().get_mouse_position()
|
||||||
|
|
||||||
@ -133,6 +134,4 @@ func delete_body_part():
|
|||||||
|
|
||||||
|
|
||||||
func _on_Start_pressed():
|
func _on_Start_pressed():
|
||||||
PhysicsServer.area_set_param(get_viewport().find_world().get_space(), PhysicsServer.AREA_PARAM_GRAVITY, _default_grav)
|
|
||||||
|
|
||||||
emit_signal("start_fight", _torso)
|
emit_signal("start_fight", _torso)
|
||||||
|
@ -12,7 +12,7 @@ var _body_count = 0
|
|||||||
var _body_positions = [Vector3(-30, 3, 0), Vector3(30, 3, 0), Vector3(0, 3, -30), Vector3(0, 3, 30)]
|
var _body_positions = [Vector3(-30, 3, 0), Vector3(30, 3, 0), Vector3(0, 3, -30), Vector3(0, 3, 30)]
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
InGameState.player_count = 4
|
InGameState.player_count = 2
|
||||||
|
|
||||||
_prep_scene("body_build")
|
_prep_scene("body_build")
|
||||||
_prep_scene("fight_scene")
|
_prep_scene("fight_scene")
|
||||||
@ -58,8 +58,10 @@ func _switch_to_win(player_id):
|
|||||||
|
|
||||||
func _switch_to_fighting(torso):
|
func _switch_to_fighting(torso):
|
||||||
_body_build_scene.remove_child(torso)
|
_body_build_scene.remove_child(torso)
|
||||||
torso.translation += _body_positions[_body_count]
|
|
||||||
torso.rotation = Vector3(0, 0, 0)
|
torso.global_transform.origin = Vector3.ZERO
|
||||||
|
torso.translation += Vector3(0, 4, 0)
|
||||||
|
torso.rotation = Vector3.ZERO
|
||||||
|
|
||||||
_body_count += 1
|
_body_count += 1
|
||||||
if _body_count < InGameState.player_count:
|
if _body_count < InGameState.player_count:
|
||||||
|
@ -4,5 +4,5 @@ var bodyparts : Dictionary
|
|||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
bodyparts["Arm"] = load("res://BodyParts/Arm.tscn")
|
bodyparts["Human Arm"] = load("res://BodyParts/HumanArm.tscn")
|
||||||
bodyparts["Humanleg"] = load("res://BodyParts/HumanLeg.tscn")
|
bodyparts["Human Leg"] = load("res://BodyParts/HumanLeg.tscn")
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
extends Spatial
|
extends Spatial
|
||||||
|
|
||||||
|
|
||||||
onready var player1 = get_parent().get_node("Torso")
|
|
||||||
onready var player2 = get_parent().get_node("Torso2")
|
|
||||||
|
|
||||||
onready var camera = get_node("Camera")
|
onready var camera = get_node("Camera")
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
|
var player1 = get_parent().get_child(3)
|
||||||
|
var player2 = get_parent().get_child(4)
|
||||||
|
|
||||||
|
if not player1 and player2: return
|
||||||
|
|
||||||
var center = player2.transform.origin + (player1.transform.origin - player2.transform.origin) / 2.0
|
var center = player2.transform.origin + (player1.transform.origin - player2.transform.origin) / 2.0
|
||||||
var distance = (player1.transform.origin - player2.transform.origin).length()
|
var distance = (player1.transform.origin - player2.transform.origin).length()
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://BodyParts/Arm.tscn" type="PackedScene" id=1]
|
|
||||||
[ext_resource path="res://UI/UI.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://UI/UI.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://BodyParts/BodyBase/BodyBase.tscn" type="PackedScene" id=3]
|
|
||||||
[ext_resource path="res://Ingame/Ingame.gd" type="Script" id=4]
|
[ext_resource path="res://Ingame/Ingame.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://Ingame/Arena.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://Ingame/CameraFocus.gd" type="Script" id=6]
|
[ext_resource path="res://Ingame/CameraFocus.gd" type="Script" id=6]
|
||||||
[ext_resource path="res://BodyParts/HumanLeg.tscn" type="PackedScene" id=7]
|
|
||||||
|
|
||||||
[node name="InGame" type="Spatial"]
|
[node name="InGame" type="Spatial"]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
@ -15,37 +12,8 @@ script = ExtResource( 4 )
|
|||||||
|
|
||||||
[node name="Arena" parent="." instance=ExtResource( 5 )]
|
[node name="Arena" parent="." instance=ExtResource( 5 )]
|
||||||
|
|
||||||
[node name="Torso" parent="." instance=ExtResource( 3 )]
|
|
||||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 17.8512, 2, 0 )
|
|
||||||
|
|
||||||
[node name="Torso2" parent="." instance=ExtResource( 3 )]
|
|
||||||
transform = Transform( -1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 2, -10 )
|
|
||||||
|
|
||||||
[node name="HumanLeg" parent="Torso2/DownFrontLeft/Limb" index="0" instance=ExtResource( 7 )]
|
|
||||||
|
|
||||||
[node name="Arm" parent="Torso2/DownFrontRight/Limb" index="0" instance=ExtResource( 1 )]
|
|
||||||
key = 83
|
|
||||||
|
|
||||||
[node name="Arm" parent="Torso2/DownBackRight/Limb" index="0" instance=ExtResource( 1 )]
|
|
||||||
key = 81
|
|
||||||
|
|
||||||
[node name="Arm" parent="Torso2/DownBackLeft/Limb" index="0" instance=ExtResource( 1 )]
|
|
||||||
key = 80
|
|
||||||
|
|
||||||
[node name="CameraFocus" type="Spatial" parent="."]
|
[node name="CameraFocus" type="Spatial" parent="."]
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="Camera" type="Camera" parent="CameraFocus"]
|
[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 )
|
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="Torso"]
|
|
||||||
|
|
||||||
[editable path="Torso2"]
|
|
||||||
|
|
||||||
[editable path="Torso2/DownFrontLeft"]
|
|
||||||
|
|
||||||
[editable path="Torso2/DownFrontRight"]
|
|
||||||
|
|
||||||
[editable path="Torso2/DownBackRight"]
|
|
||||||
|
|
||||||
[editable path="Torso2/DownBackLeft"]
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user