Compare commits

...

3 Commits

5 changed files with 17 additions and 6 deletions

View File

@ -35,9 +35,9 @@ game_settings = ExtResource( 6 )
[node name="ViewportContainer" type="ViewportContainer" parent="."] [node name="ViewportContainer" type="ViewportContainer" parent="."]
material = SubResource( 3 ) material = SubResource( 3 )
margin_right = 322.0 margin_right = 320.0
margin_bottom = 182.0 margin_bottom = 180.0
rect_scale = Vector2( 2, 2 ) rect_scale = Vector2( 4, 4 )
[node name="Viewport" type="Viewport" parent="ViewportContainer"] [node name="Viewport" type="Viewport" parent="ViewportContainer"]
unique_name_in_owner = true unique_name_in_owner = true

View File

@ -1,6 +1,8 @@
class_name AnimatedSprite_StateReceiver class_name AnimatedSprite_StateReceiver
extends AnimatedSprite extends AnimatedSprite
export var debug_component: bool = false
export var callable_state_machine :NodePath export var callable_state_machine :NodePath
onready var current_state = StateAnimatedActor.new() onready var current_state = StateAnimatedActor.new()
@ -55,6 +57,8 @@ func _process(delta):
call('_state_process_' + current_state.name) call('_state_process_' + current_state.name)
func _on_animation_finished(): func _on_animation_finished():
if debug_component:
var foo = 2+2
if frames.get_animation_loop(animation) == false: if frames.get_animation_loop(animation) == false:
#print("Stop!!!!!", current_state.animation_sequence.size(), " - ", current_state.animation_index) #print("Stop!!!!!", current_state.animation_sequence.size(), " - ", current_state.animation_index)
if current_state.animation_sequence.size() > 0: if current_state.animation_sequence.size() > 0:
@ -63,6 +67,8 @@ func _on_animation_finished():
if animation_index >= current_state.animation_sequence.size(): if animation_index >= current_state.animation_sequence.size():
#print("Stop!!!!!") #print("Stop!!!!!")
current_state.animation_finished = true current_state.animation_finished = true
else:
change_animation(0,animation_index)
##TODO: Allow a way to stop animation even if in a looped sequence ##TODO: Allow a way to stop animation even if in a looped sequence
# If called, this will attempt to make the most appropriate animation change # If called, this will attempt to make the most appropriate animation change

View File

@ -250,8 +250,8 @@ shapes/collision/shape_color=Color( 1, 1, 1, 0.419608 )
[display] [display]
window/size/width=640 window/size/width=1280
window/size/height=360 window/size/height=720
window/size/resizable=false window/size/resizable=false
window/stretch/mode="2d" window/stretch/mode="2d"
window/stretch/aspect="keep" window/stretch/aspect="keep"

View File

@ -27,6 +27,7 @@ states = [ ExtResource( 3 ), ExtResource( 6 ) ]
[node name="AnimatedSprite_StateReceiver" parent="." index="1"] [node name="AnimatedSprite_StateReceiver" parent="." index="1"]
frames = ExtResource( 2 ) frames = ExtResource( 2 )
playing = true playing = true
debug_component = true
[node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"] [node name="CollisionShape2D" type="CollisionShape2D" parent="." index="4"]
position = Vector2( -5, 6 ) position = Vector2( -5, 6 )

View File

@ -477,7 +477,11 @@ func _state_process_physics_climb():
# if animation_index > 0: # if animation_index > 0:
# animations.stop() # animations.stop()
else: else:
return request_state_change.call_func('idle') ## Force downward to the floor, can't do a new floor check without first moving
parent.move_and_collide(Vector2(0,100.0))
if parent.is_on_floor():
#parent.move_and_slide(Vector2(0,100.0),Vector2.UP)
return request_state_change.call_func('land')
if _wants_jump: if _wants_jump: