Hi everyone,
So I've been learning AppGameKit since the release, and have been blown away by it. I've been lurking here in the forums and also reading the documentation, and even visited the chat room and coupled with this great language/tool it's got me more excited to learn and eventually master something than I've been in a long time. I just wanted to thank everyone at TGC and in the community before asking my question.
Anyhow, I know this is probably bonehead simple, so I beg your indulgence. Below is the code I've put together for the player sprite in my game. The game is a vertical shooter (maybe I should call it "Yet Another Shooter"?) and I've created 7 frames of animation for it. 3 frames to bank left, 3 frames to bank right, and a center frame. I have no trouble creating the sprite and locking it to the center frame... but I can't get it to animate correctly when it gets player input to move the sprite. Instead, with the current code I've got the plane stays locked to the center frame, only randomly choosing to animate before snapping back to the center frame.
Here's the code, any tips or pointers would be greatly appreciated, thanks in advance!
function Create_Player_Plane ( )
planex# = 247
planey# = 750
PlaneStart# = 4
PlaneEnd# = 4
CreateSprite ( 5, 0 )
setspritesize(5,146,186)
SetSpritePosition ( 5, planex#,planey#)
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_01.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_02.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_03.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_04.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_05.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_06.png" ) )
AddSpriteAnimationFrame ( 5, LoadImage ( "SuperSaber_07.png" ) )
PlaySprite ( 5, 10, 0, PlaneStart#, PlaneEnd#)
PlaySound (1,40,1)
endfunction
function Move_Player ( )
multiplyer# = 6
if (oldplaney# < GetDirectionY ( ))
multiplyer# = 3
endif
if (oldplanex# < GetDirectionX ( ))
PlaneStart# = 4
PlaneEnd# = 1
PlaySprite ( 5, 10, 0, PlaneStart#, PlaneEnd# )
endif
planex# = GetSpriteX(5)
planey# = GetSpriteY(5)
planex1# = GetDirectionX ( )
planey1# = GetDirectionY ( )
planex2# = planex# + planex1# * 6
planey2# = planey# + planey1# * multiplyer#
setspriteposition(5,planex2#,planey2#)
oldplaney# = planey2#
oldplanex# = planex2#
endfunction