This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

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
Godot version 3.5.1
in Engine by (22 points)

1 Answer

0 votes

First ckeck var MoveVector = get_moveVecotr()

try to check floor jump and wall jump by adding isonfloor and isonwall

if Input.isactionjustpressed("JumpKey") and ison_wall :

by (59 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.