Board Thread:Questions and Answers/@comment-71.136.229.29-20150729214723

I'm making a character sprite for an RPG game that only animates when it walks. The only problem is it has to stop animating when the d-pad buttons are released so if I turn to fast it stops animating. I know the reason I just need a way around it or a better way to control the animation. Code is below. Would like response before SmileBASIC release. Thanks! Feel free to use people, it's a very good model! AR: http://i.imgur.com/s8nIDFb.png?1

'character sprite movement animation engine

'created by stephen barrack

'give credit if you used this as a model please, there's no shame

GOSUB @RESET

PNLTYPE "OFF

BGMSETD 128,@PALLET

BGMPLAY 128

SN=68

SPSET 0,SN,2,0,0,0

SPOFS 0,0,0

UDBT=1

DDBT=2

LDBT=4

RDBT=8

ABT=16

BBT=32

XBT=64

YBT=128

LBT=256

RBT=512

SBT=1024

XMIN=0

YMIN=0

XMAX=241

YMAX=175

LOCATE 0,1:PRINT "SPANIM OFF"

@MAIN

SPREAD(0),CHRX,CHRY

LOCATE 0,0:PRINT "BUTTON ";BUTTON;"  "

LOCATE 13,0:PRINT "XPOS ";CHRX;" "

LOCATE 22,0:PRINT "YPOS ";CHRY;" "

IF BUTTON(3) AND SBT THEN GOSUB @RESET:END

IF BUTTON AND BBT THEN MD=2 ELSE MD=1

IF BUTTON AND UDBT THEN CHRY=CHRY-MD:SN=76

IF BUTTON AND DDBT THEN CHRY=CHRY+MD:SN=68

IF BUTTON AND LDBT THEN CHRX=CHRX-MD:SN=72

IF BUTTON AND RDBT THEN CHRX=CHRX+MD:SN=64

IF BUTTON(3) AND ((UDBT OR DDBT) OR (LDBT OR RDBT)) THEN SPANIM 0,1,0:LOCATE 0,1:PRINT "SPANIM OFF"

IF BUTTON(1) AND ((UDBT OR DDBT) OR (LDBT OR RDBT)) THEN SPANIM 0,4,6:LOCATE 0,1:PRINT "SPANIM ON "

IF CHRY<=YMIN THEN CHRY=YMIN

IF CHRY>=YMAX THEN CHRY=YMAX

IF CHRX<=XMIN THEN CHRX=XMIN

IF CHRX>=XMAX THEN CHRX=XMAX

SPOFS 0,CHRX,CHRY,1

SPCHR 0,SN,2,0,0,0

GOTO @MAIN

@RESET

CLEAR

ACLS

SPCLR

BGMSTOP

BGMCLEAR

RETURN

@PALLET

DATA ":0@79T120O6V100"

DATA "[L8GFEDABAG4&GECCDEF2&F>BBBA4&AGG2FEDCGFEDC2&CCDEF2G4&GFE2&ECDE"

DATA "F4F4G4&GF16G16E2&EEDCD2>A4A4B2GFE4CG4GFEREFEF2REFDECD>BGFE4CG4BAG4FE4DEFGFEDC4>B4ABGGABGGAFA<D>AFA<D>AFA<D>AFABGFG<C>AFA<C>AFABGFG]"

DATA ":2@79T120O4V100"

DATA "[L4C&C8>A8&AB<C&C8D8&DC>A&A8B8&BA<C&C8>A8&AG<C&C8>A8&AB<C&C8D8&DC>A&A8B8&B<DC&C8A8&AGL2FG<C>"

DATA "A4G4FG<CD4C4>A<D>A<C>BA1B]"

DATA 0<ac_metadata title="Character SPANIM help"> </ac_metadata>