Included Turn Animations for Idle Walk and Duck
This commit is contained in:
parent
0a7e2a045b
commit
36c51b07fb
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=68 format=2]
|
[gd_scene load_steps=76 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/Actors/Blobby/BlobbyCam.gd" type="Script" id=2]
|
[ext_resource path="res://src/Actors/Blobby/BlobbyCam.gd" type="Script" id=2]
|
||||||
[ext_resource path="res://src/Actors/Blobby/BlobbyStateMachine.gd" type="Script" id=3]
|
[ext_resource path="res://src/Actors/Blobby/BlobbyStateMachine.gd" type="Script" id=3]
|
||||||
@ -11,12 +11,18 @@ extents = Vector2( 13, 9 )
|
|||||||
[sub_resource type="StreamTexture" id=62]
|
[sub_resource type="StreamTexture" id=62]
|
||||||
load_path = "res://.import/Blobby.png-42eed5028ccb56a7415a0793b79ec61e.stex"
|
load_path = "res://.import/Blobby.png-42eed5028ccb56a7415a0793b79ec61e.stex"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id=83]
|
||||||
|
animation = "duckTurn"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id=18]
|
[sub_resource type="AnimationNodeAnimation" id=18]
|
||||||
animation = "ducking"
|
animation = "ducking"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id=19]
|
[sub_resource type="AnimationNodeAnimation" id=19]
|
||||||
animation = "falling"
|
animation = "falling"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id=84]
|
||||||
|
animation = "idleTurn"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id=21]
|
[sub_resource type="AnimationNodeAnimation" id=21]
|
||||||
animation = "idling"
|
animation = "idling"
|
||||||
|
|
||||||
@ -26,6 +32,9 @@ animation = "jumpToFall"
|
|||||||
[sub_resource type="AnimationNodeAnimation" id=22]
|
[sub_resource type="AnimationNodeAnimation" id=22]
|
||||||
animation = "jumping"
|
animation = "jumping"
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeAnimation" id=89]
|
||||||
|
animation = "runToJump"
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeAnimation" id=23]
|
[sub_resource type="AnimationNodeAnimation" id=23]
|
||||||
animation = "running"
|
animation = "running"
|
||||||
|
|
||||||
@ -47,8 +56,6 @@ animation = "wallsliding"
|
|||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=31]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=31]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=32]
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=33]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=33]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=34]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=34]
|
||||||
@ -58,6 +65,7 @@ animation = "wallsliding"
|
|||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=36]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=36]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=37]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=37]
|
||||||
|
priority = 2
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=38]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=38]
|
||||||
|
|
||||||
@ -76,6 +84,7 @@ animation = "wallsliding"
|
|||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=50]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=50]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=51]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=51]
|
||||||
|
priority = 2
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=52]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=52]
|
||||||
|
|
||||||
@ -88,6 +97,7 @@ auto_advance = true
|
|||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=57]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=57]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=59]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=59]
|
||||||
|
priority = 2
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=60]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=60]
|
||||||
switch_mode = 2
|
switch_mode = 2
|
||||||
@ -105,8 +115,6 @@ auto_advance = true
|
|||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=76]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=76]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=77]
|
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=78]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=78]
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachineTransition" id=79]
|
[sub_resource type="AnimationNodeStateMachineTransition" id=79]
|
||||||
@ -117,17 +125,43 @@ auto_advance = true
|
|||||||
switch_mode = 2
|
switch_mode = 2
|
||||||
auto_advance = true
|
auto_advance = true
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=85]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=87]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=88]
|
||||||
|
switch_mode = 2
|
||||||
|
auto_advance = true
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=90]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=91]
|
||||||
|
switch_mode = 2
|
||||||
|
auto_advance = true
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=92]
|
||||||
|
|
||||||
|
[sub_resource type="AnimationNodeStateMachineTransition" id=93]
|
||||||
|
switch_mode = 2
|
||||||
|
auto_advance = true
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachine" id=47]
|
[sub_resource type="AnimationNodeStateMachine" id=47]
|
||||||
|
states/duckTurn/node = SubResource( 83 )
|
||||||
|
states/duckTurn/position = Vector2( 680, 347.009 )
|
||||||
states/ducking/node = SubResource( 18 )
|
states/ducking/node = SubResource( 18 )
|
||||||
states/ducking/position = Vector2( 680, 399 )
|
states/ducking/position = Vector2( 680, 241 )
|
||||||
states/falling/node = SubResource( 19 )
|
states/falling/node = SubResource( 19 )
|
||||||
states/falling/position = Vector2( 1097, 241 )
|
states/falling/position = Vector2( 1097, 241 )
|
||||||
|
states/idleTurn/node = SubResource( 84 )
|
||||||
|
states/idleTurn/position = Vector2( 228.329, -183.991 )
|
||||||
states/idling/node = SubResource( 21 )
|
states/idling/node = SubResource( 21 )
|
||||||
states/idling/position = Vector2( 356, 38 )
|
states/idling/position = Vector2( 215.329, 27 )
|
||||||
states/jumpToFall/node = SubResource( 63 )
|
states/jumpToFall/node = SubResource( 63 )
|
||||||
states/jumpToFall/position = Vector2( 680, 493.088 )
|
states/jumpToFall/position = Vector2( 680, 416.088 )
|
||||||
states/jumping/node = SubResource( 22 )
|
states/jumping/node = SubResource( 22 )
|
||||||
states/jumping/position = Vector2( 203, 265 )
|
states/jumping/position = Vector2( 203, 265 )
|
||||||
|
states/runToJump/node = SubResource( 89 )
|
||||||
|
states/runToJump/position = Vector2( 97.329, 129.009 )
|
||||||
states/running/node = SubResource( 23 )
|
states/running/node = SubResource( 23 )
|
||||||
states/running/position = Vector2( 1028, 8 )
|
states/running/position = Vector2( 1028, 8 )
|
||||||
states/turnToRun/node = SubResource( 54 )
|
states/turnToRun/node = SubResource( 54 )
|
||||||
@ -135,12 +169,12 @@ states/turnToRun/position = Vector2( 685, -219.378 )
|
|||||||
states/walking/node = SubResource( 24 )
|
states/walking/node = SubResource( 24 )
|
||||||
states/walking/position = Vector2( 685, -54 )
|
states/walking/position = Vector2( 685, -54 )
|
||||||
states/wallslideToJump/node = SubResource( 80 )
|
states/wallslideToJump/node = SubResource( 80 )
|
||||||
states/wallslideToJump/position = Vector2( 227.329, 552.088 )
|
states/wallslideToJump/position = Vector2( 208, 612.088 )
|
||||||
states/wallsliding/node = SubResource( 64 )
|
states/wallsliding/node = SubResource( 64 )
|
||||||
states/wallsliding/position = Vector2( 685, 686.088 )
|
states/wallsliding/position = Vector2( 572, 612.088 )
|
||||||
transitions = [ "idling", "walking", SubResource( 25 ), "walking", "idling", SubResource( 26 ), "idling", "jumping", SubResource( 31 ), "running", "jumping", SubResource( 32 ), "walking", "jumping", SubResource( 33 ), "ducking", "idling", SubResource( 34 ), "idling", "ducking", SubResource( 35 ), "ducking", "running", SubResource( 36 ), "running", "ducking", SubResource( 37 ), "walking", "ducking", SubResource( 38 ), "ducking", "walking", SubResource( 39 ), "falling", "running", SubResource( 40 ), "falling", "ducking", SubResource( 41 ), "falling", "idling", SubResource( 42 ), "falling", "walking", SubResource( 43 ), "ducking", "jumping", SubResource( 44 ), "walking", "falling", SubResource( 50 ), "running", "falling", SubResource( 51 ), "ducking", "falling", SubResource( 52 ), "idling", "turnToRun", SubResource( 55 ), "turnToRun", "running", SubResource( 56 ), "walking", "turnToRun", SubResource( 57 ), "running", "turnToRun", SubResource( 59 ), "turnToRun", "walking", SubResource( 60 ), "turnToRun", "idling", SubResource( 61 ), "jumping", "jumpToFall", SubResource( 65 ), "jumpToFall", "falling", SubResource( 66 ), "falling", "wallsliding", SubResource( 76 ), "wallsliding", "jumping", SubResource( 77 ), "wallsliding", "falling", SubResource( 78 ), "wallsliding", "idling", SubResource( 79 ), "wallsliding", "wallslideToJump", SubResource( 81 ), "wallslideToJump", "jumping", SubResource( 82 ) ]
|
transitions = [ "idling", "walking", SubResource( 25 ), "walking", "idling", SubResource( 26 ), "idling", "jumping", SubResource( 31 ), "walking", "jumping", SubResource( 33 ), "ducking", "idling", SubResource( 34 ), "idling", "ducking", SubResource( 35 ), "ducking", "running", SubResource( 36 ), "running", "ducking", SubResource( 37 ), "walking", "ducking", SubResource( 38 ), "ducking", "walking", SubResource( 39 ), "falling", "running", SubResource( 40 ), "falling", "ducking", SubResource( 41 ), "falling", "idling", SubResource( 42 ), "falling", "walking", SubResource( 43 ), "ducking", "jumping", SubResource( 44 ), "walking", "falling", SubResource( 50 ), "running", "falling", SubResource( 51 ), "ducking", "falling", SubResource( 52 ), "idling", "turnToRun", SubResource( 55 ), "turnToRun", "running", SubResource( 56 ), "walking", "turnToRun", SubResource( 57 ), "running", "turnToRun", SubResource( 59 ), "turnToRun", "walking", SubResource( 60 ), "turnToRun", "idling", SubResource( 61 ), "jumping", "jumpToFall", SubResource( 65 ), "jumpToFall", "falling", SubResource( 66 ), "falling", "wallsliding", SubResource( 76 ), "wallsliding", "falling", SubResource( 78 ), "wallsliding", "idling", SubResource( 79 ), "wallsliding", "wallslideToJump", SubResource( 81 ), "wallslideToJump", "jumping", SubResource( 82 ), "idling", "idleTurn", SubResource( 85 ), "ducking", "duckTurn", SubResource( 87 ), "duckTurn", "ducking", SubResource( 88 ), "running", "runToJump", SubResource( 90 ), "runToJump", "jumping", SubResource( 91 ), "walking", "idleTurn", SubResource( 92 ), "idleTurn", "walking", SubResource( 93 ) ]
|
||||||
start_node = "idling"
|
start_node = "idling"
|
||||||
graph_offset = Vector2( -241.671, 220.009 )
|
graph_offset = Vector2( -192.671, -315.991 )
|
||||||
|
|
||||||
[sub_resource type="AnimationNodeStateMachinePlayback" id=48]
|
[sub_resource type="AnimationNodeStateMachinePlayback" id=48]
|
||||||
|
|
||||||
@ -414,6 +448,7 @@ __meta__ = {
|
|||||||
[node name="AnimationTree" type="AnimationTree" parent="BlobbySprite"]
|
[node name="AnimationTree" type="AnimationTree" parent="BlobbySprite"]
|
||||||
tree_root = SubResource( 47 )
|
tree_root = SubResource( 47 )
|
||||||
anim_player = NodePath("../BlobbymationPlayer")
|
anim_player = NodePath("../BlobbymationPlayer")
|
||||||
|
active = true
|
||||||
root_motion_track = NodePath(".:frame")
|
root_motion_track = NodePath(".:frame")
|
||||||
parameters/playback = SubResource( 48 )
|
parameters/playback = SubResource( 48 )
|
||||||
|
|
||||||
|
|||||||
@ -36,9 +36,9 @@ func _set_boundaries():
|
|||||||
if screen_size.end.x * original_x_zoom - h_pixels > 0:
|
if screen_size.end.x * original_x_zoom - h_pixels > 0:
|
||||||
zoom.x = h_pixels / screen_size.end.x
|
zoom.x = h_pixels / screen_size.end.x
|
||||||
zoom.y = zoom.x
|
zoom.y = zoom.x
|
||||||
# if screen_size.end.y * original_y_zoom - v_pixels > 0:
|
if screen_size.end.y * original_y_zoom - v_pixels > 0:
|
||||||
# zoom.y = v_pixels / screen_size.end.y
|
zoom.y = v_pixels / screen_size.end.y
|
||||||
# zoom.x = zoom.y
|
zoom.x = zoom.y
|
||||||
|
|
||||||
# TODO Smoothing the camera limits in godot ruins this still?
|
# TODO Smoothing the camera limits in godot ruins this still?
|
||||||
func _adapt_to_movement():
|
func _adapt_to_movement():
|
||||||
|
|||||||
@ -11,6 +11,7 @@ onready var anim_player = parent.get_node("BlobbySprite/BlobbymationPlayer")
|
|||||||
onready var anim_statemachine = parent.get_node("BlobbySprite/AnimationTree").get("parameters/playback")
|
onready var anim_statemachine = parent.get_node("BlobbySprite/AnimationTree").get("parameters/playback")
|
||||||
onready var sprite = parent.get_node("BlobbySprite")
|
onready var sprite = parent.get_node("BlobbySprite")
|
||||||
|
|
||||||
|
var didTurn: bool
|
||||||
|
|
||||||
# Adds the intial states
|
# Adds the intial states
|
||||||
func _ready():
|
func _ready():
|
||||||
@ -58,10 +59,15 @@ func _state_logic(delta):
|
|||||||
|
|
||||||
var direction = get_horizontal_direction()
|
var direction = get_horizontal_direction()
|
||||||
|
|
||||||
|
didTurn = sprite.flip_h
|
||||||
if direction.x < 0:
|
if direction.x < 0:
|
||||||
sprite.flip_h = true
|
sprite.flip_h = true
|
||||||
elif direction.x > 0:
|
elif direction.x > 0:
|
||||||
sprite.flip_h = false
|
sprite.flip_h = false
|
||||||
|
didTurn = sprite.flip_h != didTurn
|
||||||
|
|
||||||
|
if didTurn:
|
||||||
|
_trigger_turn_animation()
|
||||||
|
|
||||||
parent.velocity = handle_input_ref.call_func(delta, direction)
|
parent.velocity = handle_input_ref.call_func(delta, direction)
|
||||||
|
|
||||||
@ -178,6 +184,9 @@ func _enter_state(new_state, old_state):
|
|||||||
|
|
||||||
match new_state:
|
match new_state:
|
||||||
states.walk:
|
states.walk:
|
||||||
|
if old_state == states.idle && didTurn:
|
||||||
|
anim_statemachine.travel("idleTurn")
|
||||||
|
else:
|
||||||
anim_statemachine.travel("walking")
|
anim_statemachine.travel("walking")
|
||||||
states.idle:
|
states.idle:
|
||||||
anim_statemachine.travel("idling")
|
anim_statemachine.travel("idling")
|
||||||
@ -191,10 +200,19 @@ func _enter_state(new_state, old_state):
|
|||||||
states.run:
|
states.run:
|
||||||
anim_statemachine.travel("running")
|
anim_statemachine.travel("running")
|
||||||
states.wallslide:
|
states.wallslide:
|
||||||
|
|
||||||
anim_statemachine.travel("wallsliding")
|
anim_statemachine.travel("wallsliding")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _exit_state(old_state, new_state):
|
func _exit_state(old_state, new_state):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
func _trigger_turn_animation():
|
||||||
|
match self.state:
|
||||||
|
states.duck:
|
||||||
|
anim_statemachine.travel("duckTurn")
|
||||||
|
states.walk:
|
||||||
|
anim_statemachine.travel("idleTurn")
|
||||||
|
states.idle:
|
||||||
|
anim_statemachine.travel("idleTurn")
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user