Yosh Everyone! Good Day
This is my first time posting in a forum cause i feel shy asking.
Me and my partner is creating a simple game. And we just started using DBPro. We are going to move the sprite using the arrow keys. The problem is it doesn't execute the other movements except for the last movement we added. Example, we are going to use the rightkey() and it will move to the right showing the sprite which moves to the right. But when we try to add another movement it will not execute all other movements.
here is the sample code we made:
Do
Anim = 0
gosub playerSprites
gosub playerMovement // player movement
gosub playerAnim // animation
gosub playerBoundaryChk
Sync
Loop
Vars:
x# = 0
y# = 330
Anim = 0
fRight = 1
Frame = 0
imgNum = 1
set image colorkey 252, 4, 244
Return
loadImages:
load image "media\Yoriko_Stance.png", 1, 1
load image "media\Yoriko_Forward.png", 2, 1
load image "media\Yoriko_Jump.png", 3, 1
load image "media\Yoriko_Down", 4, 1
load image "media\Yoriko_Backward.png", 5, 1
Return
playerSprites:
Sprite 1, x#, y#, imgNum
Return
playerMovement:
rem walking Right
if rightkey() = 1
x# = x# + 5
Anim = 1
EndIf
rem walking left
if leftkey() = 1
x# = x# - 5
Anim = 2
EndIf
rem jump
if upkey() = 1
y# = y# - 5
Anim = 3
endif
rem down
if downkey() = 1
y# = y# + 5
Anim = 4
endif
Return
playerAnim:
rem Walking Right
if Anim = 1
imgNum = 2
else
imgNum = 1
endif
rem Walking Left
if Anim = 2
imgNum = 5
else
imgNum = 1
endif
rem Jumping
if Anim = 3
imgNum = 3
else
imgNum = 1
endif
rem Down
if Anim = 4
imgNum = 4
else
imgNum = 1
endif
Return
playerBoundaryChk:
rem horizontal boundary
if x# < 0
x# = 0
endif
if x# > screen width() - sprite width(1)
x# = screen width() - sprite width(1)
endif
rem vertical boundary
if y# < 0
y# = 0
endif
if y# > screen width() - sprite width(1)
y# = screen width() - sprite width(1)
endif
Return
In this code, only the Jump Movement will be seen when the program is compiled. Thanks in advance for any help

God Bless!