Almost made fall happen.
This commit is contained in:
parent
27de78f02a
commit
1b7715746e
|
|
@ -4,6 +4,9 @@ func _ready():
|
|||
# Lets see if this nutty thing works
|
||||
var state_ref :State = get_node(callable_state_machine).get_state_reference('idle')
|
||||
state_ref.connect("state_entered", self, "_on_state_entered_idle")
|
||||
|
||||
state_ref = get_node(callable_state_machine).get_state_reference('fall')
|
||||
state_ref.connect("state_entered", self, "_on_state_entered_fall")
|
||||
# It works but node order really mattered.
|
||||
# State machine needed to be processed first probably for ready function.
|
||||
# good to know!
|
||||
|
|
@ -12,5 +15,13 @@ func _ready():
|
|||
#func _state_process_idle():
|
||||
# print("I got called!")
|
||||
|
||||
#func _state_process_fall():
|
||||
# print("I got called!")
|
||||
|
||||
func _on_state_entered_idle():
|
||||
print("Anim Knows Idle State Entered!")
|
||||
|
||||
func _on_state_entered_fall():
|
||||
print("Anim Knows Fall State Entered!")
|
||||
frame = 2
|
||||
stop()
|
||||
|
|
|
|||
|
|
@ -8,15 +8,21 @@ func _ready():
|
|||
# State machine needed to be processed first probably for ready function.
|
||||
# good to know!
|
||||
|
||||
var fire_a_note:bool = false
|
||||
# I don't need this right now but I proved it can be done!
|
||||
func _state_process_physics_idle():
|
||||
if fire_a_note == true:
|
||||
print("I got called! (MC)")
|
||||
fire_a_note = false
|
||||
if !parent.is_on_floor():
|
||||
#return fall_state
|
||||
request_state_change.call_func('fall')
|
||||
|
||||
func _on_state_entered_idle():
|
||||
print("Movement State Idle State Entered!")
|
||||
fire_a_note = true
|
||||
func _state_process_physics_fall():
|
||||
if get_movement_direction() != 0.0:
|
||||
parent.transform.x.x = get_movement_direction()
|
||||
|
||||
if parent.is_on_floor():
|
||||
#modifier.reference()
|
||||
#idle_state.modifier = landing_modifier
|
||||
request_state_change.call_func('idle')
|
||||
|
||||
#func _on_state_entered_idle():
|
||||
# print("Movement State Idle State Entered!")
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=8 format=2]
|
||||
[gd_scene load_steps=11 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]
|
||||
|
|
@ -6,6 +6,38 @@
|
|||
[ext_resource path="res://src/actors/players/playerE/states/idle.tres" type="Resource" id=4]
|
||||
[ext_resource path="res://src/actors/players/playerE/PlayerE-AnimatedSprite_StateReceiver.gd" type="Script" id=5]
|
||||
[ext_resource path="res://src/actors/players/playerE/PlayerE-Movement_StateReceiver.gd" type="Script" id=6]
|
||||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="Resource" id=2]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "fall"
|
||||
script = ExtResource( 7 )
|
||||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "fall"
|
||||
move_speed = 90.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "jump" ]
|
||||
emitter_frame_subscriptions = {
|
||||
}
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
resource_name = "move"
|
||||
script = ExtResource( 7 )
|
||||
debug_state = false
|
||||
timeout_seconds = 0.0
|
||||
name = "move"
|
||||
move_speed = 90.0
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
jerk_factor = 0.0
|
||||
animation_sequence = [ "run" ]
|
||||
emitter_frame_subscriptions = {
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id=1]
|
||||
extents = Vector2( 7, 14 )
|
||||
|
|
@ -16,7 +48,7 @@ actor_type = "Player"
|
|||
|
||||
[node name="Movement_StateMachine" parent="." index="0"]
|
||||
starting_state_name = "idle"
|
||||
states = [ ExtResource( 4 ) ]
|
||||
states = [ ExtResource( 4 ), SubResource( 2 ), SubResource( 3 ) ]
|
||||
|
||||
[node name="AnimatedSprite_StateReceiver" parent="." index="1"]
|
||||
frames = ExtResource( 2 )
|
||||
|
|
|
|||
|
|
@ -3,12 +3,13 @@
|
|||
[ext_resource path="res://lib/classes/state_animated_actor.gd" type="Script" id=1]
|
||||
|
||||
[resource]
|
||||
resource_local_to_scene = true
|
||||
resource_name = "idle"
|
||||
script = ExtResource( 1 )
|
||||
debug_state = false
|
||||
timeout_seconds = 2.0
|
||||
timeout_seconds = 0.0
|
||||
name = "idle"
|
||||
move_speed = 60.0
|
||||
move_speed = 1.36422e-12
|
||||
move_acceleration = 0.0
|
||||
move_speed_modifier = 0.0
|
||||
move_modifier_move_acceleration = 0.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user