-
How to Animate?
I need to know if there is a control or function or something that can create an animation from several bmps. I have a character in my game, and I want to animate him when he walks, and when he is idle, fighting, etc.
is there an easy way to do this?
I'd prefer it to be flickerless, but anything is better than nothing.
-
The best way to do it is using BitBlt. It's not that hard (in my opinion) and this way you get rid of the flickery controls. I think there are a few controls out there that can create animations easily, but they're not very efficient and are very flickery when you move them.
Just make a search on "BitBlt", there are lots of good sites with excellent tutorials on it ;)
-
Fox (another member) also has a very good tutorial on his website.
Look for posts by him (using the search tool if you need to) and follow the link in his signature.
-
thnx. i found fox, got some help on bitblt, and am doing all right.
just one quick thing that isnt worthy of its own thread, what does DoEvents do? i've seen it in many peoples source, but couldn't figure out what it does.
-
It lets windows update itself and everything (display, etc.). If you don't have it you won't see anything happen!
-
Yes, other events take place when no code is running or when you call DoEvents (that's why it's called that name :p )
-
Then does this mean it will run when the window updates itself?
While DoEvents
blah, blah, blah
wend
and what is this?
form_unload
running=false
DoEvents
end
end sub
both of these i have seen in a particle system demo that doesn't
work, and i'm trying to figure out why.
Actually, it was Jotaf98's particle system code from his article!
-
Yes, DoEvents always returns true so basically it's the same as having it inside the loop - every time it runs the code inside the loop, it tells windows to update itself and receive events.
The second code, when the user unloads the form (clicking the "Close" button in the top-right corner), sets "running" to false so that the program knows it must stop the loop, lets Windows update itself using DoEvents, and terminates the program. But that's not necessary, you can just use "End" in the "Form_Unload" :p
Oh did you read my tutorial? Huh is there any other part that is not clear enough?
-
Doevents returns the amount of forms active
Doevents processes message queues within your application only, this call is quite costly, so don't put it in time critical loops.
-
Yeah huh I dind't know it returns that but the way it's used in the loop, I assumed it always returns true :D
You usually only wanna use DoEvents when you want to receive events like for example key presses, for example in a game it would only be useful once every frame. More than that and it's only slowing you down.
-
well in fact i encountered a problem with calling doevents in loops, it tended to screw up if you didn't have any forms active, that was a couple of years ago, and I posted it somewhere, and ever since people probably started to call doevents in loops like that without knowing why.