diff --git a/src/Menus/DialogueBox/DialogueBox.gd b/src/Menus/DialogueBox/DialogueBox.gd index 8ff7afa..0542b47 100644 --- a/src/Menus/DialogueBox/DialogueBox.gd +++ b/src/Menus/DialogueBox/DialogueBox.gd @@ -31,7 +31,7 @@ func set_dialogue_identifier(val): func update_text(): - print(_dialogue[_dialogue_pos]) + #print(_dialogue[_dialogue_pos]) label.text = _dialogue[_dialogue_pos] animation_player.play("next_line") yield(animation_player, "animation_finished") diff --git a/src/Overlap/StateMachine/MotionState.gd b/src/Overlap/StateMachine/MotionState.gd index 8f252c7..7709c71 100644 --- a/src/Overlap/StateMachine/MotionState.gd +++ b/src/Overlap/StateMachine/MotionState.gd @@ -2,7 +2,12 @@ extends "res://Overlap/StateMachine/State.gd" func get_input_direction(): var input_direction = Vector2() - input_direction.x = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left")) - input_direction.y = int(Input.is_action_pressed("down")) - int(Input.is_action_pressed("up")) - input_direction = input_direction.normalized() - return input_direction + if(owner.debug==true): + input_direction.x = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left")) + input_direction.y = int(Input.is_action_pressed("down")) - int(Input.is_action_pressed("up")) + input_direction = input_direction.normalized() + if(input_direction==Vector2.ZERO): + return owner.rollvector + return input_direction + else: + return owner.rollvector diff --git a/src/Player/Player.gd b/src/Player/Player.gd index d3c7b0d..0cbc524 100644 --- a/src/Player/Player.gd +++ b/src/Player/Player.gd @@ -45,7 +45,7 @@ func _debug_update(): debug_label.text = str(player_stats.health) + "/" + str(player_stats.max_health) + " HP\n" + str(currency) + " €" func _ready(): - grid = get_tree().current_scene.get_child(3) + grid = get_tree().current_scene.get_node("Grid") func _physics_process(delta): totaldamage+=(damage_per_second - heal_per_second)*delta @@ -172,8 +172,6 @@ func roll_finished(): func _on_Hurtbox_area_entered(area): player_stats.health-=area.damage - print("enter") - if area.damage > 0: damage_per_second += area.damage else: diff --git a/src/Player/Player.tscn b/src/Player/Player.tscn index c6f1d0b..46fbacd 100644 --- a/src/Player/Player.tscn +++ b/src/Player/Player.tscn @@ -14,7 +14,7 @@ [ext_resource path="res://Player/PlayerStateMachine.gd" type="Script" id=15] [ext_resource path="res://Player/States/Roll.gd" type="Script" id=16] -[sub_resource type="CircleShape2D" id=50] +[sub_resource type="CircleShape2D" id=1] radius = 3.0 [sub_resource type="Animation" id=2] @@ -596,7 +596,7 @@ blend_mode = 1 states/hit/node = SubResource( 22 ) states/hit/position = Vector2( 511, 196 ) states/idle/node = SubResource( 27 ) -states/idle/position = Vector2( 203, 196 ) +states/idle/position = Vector2( 202, 196 ) states/roll/node = SubResource( 32 ) states/roll/position = Vector2( 511, 90 ) states/run/node = SubResource( 37 ) @@ -637,12 +637,12 @@ scale = Vector2( 0.5, 0.5 ) texture = ExtResource( 2 ) offset = Vector2( 0, -18 ) hframes = 60 -frame = 12 +frame = 7 [node name="Body" type="CollisionShape2D" parent="."] position = Vector2( 0.0107212, 0.0456073 ) rotation = 1.5708 -shape = SubResource( 50 ) +shape = SubResource( 1 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/HitDown = SubResource( 2 ) @@ -670,7 +670,7 @@ parameters/playback = SubResource( 45 ) parameters/hit/blend_position = Vector2( 0.032258, -0.777778 ) parameters/idle/blend_position = Vector2( -0.646202, 0.122222 ) parameters/roll/blend_position = Vector2( 0.0166494, -0.387619 ) -parameters/run/blend_position = Vector2( 0.0697191, -0.967302 ) +parameters/run/blend_position = Vector2( -0.0104058, -1.05259 ) [node name="Hitbox" parent="." instance=ExtResource( 4 )] position = Vector2( 0, 0.0375252 ) diff --git a/src/Player/States/Idle.gd b/src/Player/States/Idle.gd index 00d2b9b..538995b 100644 --- a/src/Player/States/Idle.gd +++ b/src/Player/States/Idle.gd @@ -4,5 +4,5 @@ func enter(): animation_playback.travel("idle") func update(delta): - var input_vector = get_input_direction() + var input_vector = owner.rollvector animation_tree.set("parameters/idle/blend_position", input_vector) diff --git a/src/World.tscn b/src/World.tscn index adf28fd..b63f362 100644 --- a/src/World.tscn +++ b/src/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=2] +[gd_scene load_steps=10 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://World.gd" type="Script" id=2] @@ -6,10 +6,7 @@ [ext_resource path="res://testSprites/dark.png" type="Texture" id=4] [ext_resource path="res://Menus/DragNDrop/DragNDropUI.tscn" type="PackedScene" id=5] [ext_resource path="res://Menus/DialogueBox/DialogueBox.tscn" type="PackedScene" id=6] -[ext_resource path="res://Boss/Boss_template.tscn" type="PackedScene" id=7] -[ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=8] -[ext_resource path="res://testSprites/bannane.png" type="Texture" id=5] -[ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=7] +[ext_resource path="res://Objects/Bonfire/Bonfire.tscn" type="PackedScene" id=10] [ext_resource path="res://Boss/Boss_template.tscn" type="PackedScene" id=17] [ext_resource path="res://Maps/Grid.tscn" type="PackedScene" id=18] @@ -36,31 +33,20 @@ __meta__ = { [node name="YSort" type="YSort" parent="."] position = Vector2( 152, 120 ) +[node name="Bonfire" parent="YSort" instance=ExtResource( 10 )] +position = Vector2( 264, -24 ) + [node name="Player" parent="YSort" instance=ExtResource( 1 )] position = Vector2( 240, 72 ) scale = Vector2( 2, 2 ) -ROLL_SPEED = 80 +ROLL_SPEED = 140 FRICTION = 200 [node name="Boss_template" parent="YSort" instance=ExtResource( 17 )] -position = Vector2( -104, 40 ) +position = Vector2( -67.0889, 2.27742 ) debug = true -[node name="Bonfire" parent="YSort" instance=ExtResource( 7 )] -position = Vector2( 264, -16 ) - -[node name="Body" parent="YSort/Bonfire" index="3"] -disabled = true - -[node name="bannane" type="Sprite" parent="YSort"] -position = Vector2( 104, -24 ) -texture = ExtResource( 5 ) - -[node name="Boss_template" parent="YSort" instance=ExtResource( 7 )] -position = Vector2( -67.0889, 2.27742 ) - -[node name="Bonfire" parent="YSort" instance=ExtResource( 8 )] -position = Vector2( 214.647, -24.9932 ) +[node name="Grid" parent="." instance=ExtResource( 18 )] [node name="CanvasLayer" type="CanvasLayer" parent="."] @@ -70,6 +56,4 @@ visible = false [node name="DragNDropUI" parent="CanvasLayer" instance=ExtResource( 5 )] ObjectParent = NodePath("../..") -[node name="Grid" parent="." instance=ExtResource( 18 )] - [editable path="YSort/Bonfire"]