Im having trouble right now. as I cannot think of how this can be done. :/
All I wanna do. Is draw an animated image based on what key is being pressed. each animation has a different width,height and amount of frames, and frames per second it should be played at. I just wanna know basics so I can try and implement other things later on like fading and flashing.
Heres my code currently for my types
Does animation need its own type?
Thanks for helping whoever.
All I wanna do. Is draw an animated image based on what key is being pressed. each animation has a different width,height and amount of frames, and frames per second it should be played at. I just wanna know basics so I can try and implement other things later on like fading and flashing.
Heres my code currently for my types
Type TPlayer Field x, y, speed EndType Type TBomberman Extends TPlayer Field bombs, health, power, hammer, gloves, punch, skates EndType Type TAnimation Extends TBomberman Field maxFrames,animationFps,width,height Global animationCounter:Int = 0 Global animationCount:Int = 7 Global animationFrame:Int = 0 Global maxFrames:Int = 33 EndType Global animationCounter:Int = 0 Global animationCount:Int = 7 Global animationFrame:Int = 0 Global maxFrames:Int = 33 Global bomber:TImage=LoadAnimImage("gfx/players/bomberman/waiting.png",22,24,0,33,MIPMAPPEDIMAGE) MidHandleImage(bomber) Function updateAnimations() animationCounter:+1 'increments every tick If animationCounter >= animationCount 'once ready then we'll update which frame to display animationCounter=0 If animationFrame < maxFrames-1 'because we want 0 - 11 not frame 12 animationFrame:+1 Else animationFrame = 0 End If End If SetScale(2,2) DrawImage(bomber,320,240,animationFrame) 'DrawImage(bomb,120,140,animationFrame) 'draw all of your animations here based off the current animationFrame 'though keep in mind that with this example every animation would be running at 12 fps 'another way you could do it is to have animationCounter count through 0 - 59 and then 'just use a divide for which ticks you want your frame to be updated on for each animation EndFunction
Does animation need its own type?
Thanks for helping whoever.