Author Topic: Something I wrote to help me animate my stuff  (Read 2601 times)

Devlin

  • Guest
Dunno if there's something better out there, but all that stuff about timers and stuff just confused me silly...

Code: GLBasic [Select]
//
// Add this to your main loop :
// counter=counter+1
//
// Function AnimSprite (idlo,idhi,delay,x,y)
// Animates a string of sprite id's
//
// idlo  : Id of beginning of animation
// idhi  : Id of end of animation
// delay : Delay(Recommended value : 10 (may vary per machine, need to improve on this somehow))
// x     : X position of animation
// y     : Y position of animation
FUNCTION animsprite: idlo , idhi , delay , x , y
// local variables : idlo , idhi , delay , x , y

IF frame < idlo
frame = idlo
ENDIF

IF counter = delay
counter=0
frame=frame+1
ENDIF

IF frame > idhi
frame = idlo
ENDIF

SPRITE frame,x,y
ENDFUNCTION //animsprite
//
EDIT : I've fixed another bug :)

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10697
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Something I wrote to help me animate my stuff
« Reply #1 on: 2007-Feb-12 »
Cool. I should start packing these stuff into the manual as well.