Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | VBGames |
I create my own fan game MegaMan X
My AnimtedSprite Wall Jump run only the first frame but not all frames it have only 3 frames.
Here is my code:
func Animation_Update():
var RunFrame : int
var JumpFrame : int
var WallSlideFrame : int
var WallJumpFrame : int
var CrouchFrame : int
var DashFrame : int
#Frame
if AnimationType("Run"):
RunFrame = $AnimatedSprite.get_frame()
if AnimationType("Jump"):
JumpFrame = $AnimatedSprite.get_frame()
if AnimationType("WallSlide"):
WallSlideFrame = $AnimatedSprite.get_frame()
if AnimationType("WallJump"):
WallJumpFrame = $AnimatedSprite.get_frame()
if AnimationType("Crouch"):
CrouchFrame = $AnimatedSprite.get_frame()
if AnimationType("Dash"):
DashFrame = $AnimatedSprite.get_frame()
var MoveVector = get_moveVecotr()
if is_on_floor():
if MoveVector != 0 and not AnimationType("Crouch") and not isDashing:
PlayAnimation("Run")
if AnimationType("Run"):
$AnimatedSprite.frame = RunFrame
elif AnimationType("Jump"):
if AnimationType("Dash"):
isDashing = false
elif Input.is_action_pressed("down"):
PlayAnimation("Crouch")
if AnimationType("Crouch"):
$AnimatedSprite.frame = CrouchFrame
elif Input.is_action_just_released("down"):
PlayAnimation("Crouch",true)
if AnimationType("Crouch"):
$AnimatedSprite.frame = CrouchFrame
elif isDashing:
PlayAnimation("Dash")
if AnimationType("Dash"):
$AnimatedSprite.frame = DashFrame
if CurrentDash > 1:
$AnimatedSprite.frame = 1
elif IsFullCharge:
$AnimatedSprite.play("FullCharge")
else:
PlayAnimation("Idle")
else:
if IsTouchWall():
PlayAnimation("WallSlide")
if AnimationType("WallSlide"):
$AnimatedSprite.frame = WallSlideFrame
if Input.is_action_just_pressed("JumpKey"):
PlayAnimation("WallJump")
if AnimationType("WallJump"):
$AnimatedSprite.frame = WallJumpFrame
elif velucity.y < 0:
PlayAnimation("Jump")
if AnimationType("Jump"):
$AnimatedSprite.frame = JumpFrame
if $AnimatedSprite.frame > 3:
$AnimatedSprite.frame = 3
elif velucity.y > 0 or (AnimationType("Jump") and velucity.y > 0):
PlayAnimation("Jump")
if AnimationType("Jump"):
$AnimatedSprite.frame = JumpFrame
if $AnimatedSprite.frame < 4:
$AnimatedSprite.frame = 4
if $AnimatedSprite.frame > 4:
$AnimatedSprite.frame = 4