Compare commits
2 Commits
dfdc2d059f
...
6bd4d302e0
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bd4d302e0 | |||
| 1d469f7462 |
|
|
@ -717,6 +717,11 @@ animations = [ {
|
|||
"name": "ledge-climb",
|
||||
"speed": 9.0
|
||||
}, {
|
||||
"frames": [ SubResource( 50 ), SubResource( 51 ) ],
|
||||
"loop": true,
|
||||
"name": "ledge-grab",
|
||||
"speed": 2.0
|
||||
}, {
|
||||
"frames": [ SubResource( 73 ), SubResource( 74 ), SubResource( 75 ), SubResource( 76 ), SubResource( 77 ), SubResource( 78 ) ],
|
||||
"loop": true,
|
||||
"name": "pull",
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ func move_actor_as_desired( x_move_direction_override: float = 0):
|
|||
var sim_move_speed = (MIN_SPEED + (sign(_move_speed_modifier) * -1 * momentum.x))
|
||||
|
||||
# if move_component.momentum.x != 0:
|
||||
if true:
|
||||
if debug_component == true:
|
||||
UiManager.debug_text = ( "Mod(" + str(sign(_move_speed_modifier)) + ") Dir(" + str(move_direction) + ") Vel(" + str(sign(current_x_velocity)) + ") Mov(" + str(sign(desired_movement_vector.x)) +
|
||||
")\nNS:" + str(round(sim_move_speed)) + #" Z:" + str(sign(_move_speed_modifier) * -1 * move_component.momentum.x) +
|
||||
"\nS:" + str(round(_move_speed + _move_speed_modifier)) + ",M" + str(round(momentum.x)) +
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ func _on_state_change_fall():
|
|||
change_animation(2)
|
||||
stop()
|
||||
|
||||
#func _on_state_change_ledge_grab():
|
||||
# change_animation(1)
|
||||
# stop()
|
||||
|
||||
func _on_state_exited_attack_sword():
|
||||
print("you just swung your sword, you should get a modifier.")
|
||||
#attack_sword.timeout.start()
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ func _state_process_physics_roll():
|
|||
|
||||
|
||||
func _state_process_physics_land():
|
||||
$"../LedgeDetector".set_enabled(true)
|
||||
if current_state.animation_finished == true:
|
||||
request_state_change.call_func('idle')
|
||||
|
||||
|
|
@ -189,6 +190,11 @@ func _state_process_physics_hurt():
|
|||
func _state_process_physics_fall():
|
||||
flip_sprite_to_movement_direction()
|
||||
|
||||
if $"../LedgeDetector".is_colliding() and !$"../WallDetector".is_colliding():
|
||||
#print("it touched me!")
|
||||
UiManager.debug_text = (str($"../LedgeDetector".get_collision_point()))
|
||||
request_state_change.call_func('ledge_grab')
|
||||
|
||||
if parent.is_on_floor():
|
||||
#modifier.reference()
|
||||
#idle_state.modifier = landing_modifier
|
||||
|
|
@ -197,16 +203,17 @@ func _state_process_physics_fall():
|
|||
move_actor_as_desired()
|
||||
|
||||
func _state_process_physics_jump():
|
||||
if desired_movement_vector.x != 0.0:
|
||||
parent.transform.x.x = desired_movement_vector.x
|
||||
#UiManager.debug_text = (str(velocity))
|
||||
|
||||
flip_sprite_to_movement_direction()
|
||||
|
||||
#Apparently we're instantly landing
|
||||
# if parent.is_on_floor():
|
||||
# #modifier.reference()
|
||||
# #idle_state.modifier = landing_modifier
|
||||
# request_state_change.call_func('idle')
|
||||
if velocity.y > 0:
|
||||
request_state_change.call_func('fall')
|
||||
|
||||
if parent.is_on_floor():
|
||||
#modifier.reference()
|
||||
#idle_state.modifier = landing_modifier
|
||||
request_state_change.call_func('idle')
|
||||
|
||||
move_actor_as_desired()
|
||||
|
||||
func _state_process_physics_move():
|
||||
|
|
@ -224,6 +231,42 @@ func _state_process_physics_move():
|
|||
|
||||
move_actor_as_desired()
|
||||
|
||||
func _state_process_physics_ledge_grab():
|
||||
UiManager.debug_text = (str(velocity))
|
||||
$"../LedgeDetector".set_enabled(false)
|
||||
|
||||
if _wants_jump:
|
||||
request_state_change.call_func('ledge_climb')
|
||||
|
||||
if _wants_crouch:
|
||||
request_state_change.call_func('fall')
|
||||
|
||||
func _state_process_physics_ledge_climb():
|
||||
# UiManager.debug_text = (str(velocity))
|
||||
# $"../LedgeDetector".set_enabled(false)
|
||||
|
||||
UiManager.debug_text = (str(parent.is_on_floor()) +
|
||||
str(parent.is_on_wall()) + ")\nV:" + str(velocity))
|
||||
|
||||
if current_state.animation_finished == true:
|
||||
request_state_change.call_func('land')
|
||||
return
|
||||
|
||||
if parent.is_on_wall() == true:
|
||||
#velocity = parent.move_and_slide(Vector2(10.0,-60.0),Vector2.UP)
|
||||
parent.move_and_slide(Vector2(10.0,-100.0),Vector2.UP)
|
||||
else: #parent.is_on_floor() == true:
|
||||
#velocity = parent.move_and_slide(Vector2(10.0,10.0),Vector2.UP)
|
||||
parent.move_and_slide(Vector2(60.0,10.0),Vector2.UP)
|
||||
|
||||
#velocity = parent.move_and_slide(Vector2(60.0,-60.0),Vector2.UP)
|
||||
# if parent.is_on_wall() != true:
|
||||
# #modifier.reference()
|
||||
# #idle_state.modifier = landing_modifier
|
||||
# request_state_change.call_func('land')
|
||||
# return
|
||||
|
||||
|
||||
func _state_process_physics_crouch():
|
||||
# flip sprite in direction
|
||||
flip_sprite_to_movement_direction()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=22 format=2]
|
||||
[gd_scene load_steps=24 format=2]
|
||||
|
||||
[ext_resource path="res://lib/templates/Actor/ActorTemplate.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://assets/actors/players/playerE/PlayerE_SpriteFrames.tres" type="SpriteFrames" id=2]
|
||||
|
|
@ -18,6 +18,8 @@
|
|||
[ext_resource path="res://lib/components/Hurtbox_Component.tscn" type="PackedScene" id=16]
|
||||
[ext_resource path="res://lib/components/Health_Component.tscn" type="PackedScene" id=17]
|
||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=18]
|
||||
[ext_resource path="res://src/actors/players/playerE/states/ledge_grab.tres" type="Resource" id=19]
|
||||
[ext_resource path="res://src/actors/players/playerE/states/ledge_climb.tres" type="Resource" id=20]
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_local_to_scene = true
|
||||
|
|
@ -44,11 +46,13 @@ script = ExtResource( 3 )
|
|||
actor_type = "Player"
|
||||
|
||||
[node name="Movement_StateMachine" parent="." index="0"]
|
||||
debug_state_machine = true
|
||||
starting_state_name = "idle"
|
||||
states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 12 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), SubResource( 3 ) ]
|
||||
states = [ ExtResource( 4 ), ExtResource( 9 ), ExtResource( 7 ), ExtResource( 8 ), ExtResource( 12 ), ExtResource( 11 ), ExtResource( 10 ), ExtResource( 13 ), ExtResource( 14 ), ExtResource( 15 ), SubResource( 3 ), ExtResource( 19 ), ExtResource( 20 ) ]
|
||||
|
||||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||
frames = ExtResource( 2 )
|
||||
animation = "ledge-grab"
|
||||
script = ExtResource( 5 )
|
||||
__meta__ = {
|
||||
"_aseprite_wizard_config_": {
|
||||
|
|
@ -67,14 +71,26 @@ __meta__ = {
|
|||
[node name="Movement_StateReceiver" parent="." index="2"]
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"]
|
||||
[node name="LedgeDetector" type="RayCast2D" parent="." index="3"]
|
||||
modulate = Color( 0, 1, 0, 1 )
|
||||
position = Vector2( 8, 5 )
|
||||
enabled = true
|
||||
cast_to = Vector2( 1.36422e-12, 1 )
|
||||
|
||||
[node name="WallDetector" type="RayCast2D" parent="." index="4"]
|
||||
modulate = Color( 0, 1, 0, 1 )
|
||||
position = Vector2( 6, 10 )
|
||||
enabled = true
|
||||
cast_to = Vector2( 4, -4 )
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="6"]
|
||||
position = Vector2( 0, 2 )
|
||||
shape = SubResource( 1 )
|
||||
|
||||
[node name="Health_Component" parent="." index="5" instance=ExtResource( 17 )]
|
||||
[node name="Health_Component" parent="." index="7" instance=ExtResource( 17 )]
|
||||
max_health = 100
|
||||
|
||||
[node name="Hurtbox_Component" parent="." index="6" instance=ExtResource( 16 )]
|
||||
[node name="Hurtbox_Component" parent="." index="8" instance=ExtResource( 16 )]
|
||||
collision_layer = 16
|
||||
collision_mask = 128
|
||||
hurtbox_entered_function = "hit_Receiver"
|
||||
|
|
|
|||
17
src/actors/players/playerE/states/ledge_climb.tres
Normal file
17
src/actors/players/playerE/states/ledge_climb.tres
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "ledge_climb"
|
||||
script = ExtResource( 1 )
|
||||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "ledge_climb"
|
||||
horizontal_speed = 1.36422e-12
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "ledge-climb" ]
|
||||
17
src/actors/players/playerE/states/ledge_grab.tres
Normal file
17
src/actors/players/playerE/states/ledge_grab.tres
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_resource type="Resource" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "ledge_grab"
|
||||
script = ExtResource( 1 )
|
||||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "ledge_grab"
|
||||
horizontal_speed = 1.36422e-12
|
||||
horizontal_acceleration = 0.0
|
||||
horizontal_speed_offset = 0.0
|
||||
horizontal_speed_offset_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "ledge-grab" ]
|
||||
Loading…
Reference in New Issue
Block a user