|
-
Mar 26th, 2002, 11:24 AM
#1
Thread Starter
Lively Member
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.
Often talked of, never seen,
Ever coming, never been,
Daily looked for, never here,
Still approaching, coming near,
Thousands for its visit wait,
But alas for their fate,
Tho' they expect me to appear,
They will never find me here.
What's this about?
-
Mar 26th, 2002, 01:07 PM
#2
Frenzied Member
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
-
Mar 26th, 2002, 02:17 PM
#3
PowerPoster
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.
Gentile or Jew,
O you who turn the wheel and look to windward,
Consider Phlebas, who was once handsome and tall as you...
-
Mar 26th, 2002, 03:38 PM
#4
Thread Starter
Lively Member
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.
Often talked of, never seen,
Ever coming, never been,
Daily looked for, never here,
Still approaching, coming near,
Thousands for its visit wait,
But alas for their fate,
Tho' they expect me to appear,
They will never find me here.
What's this about?
-
Mar 26th, 2002, 04:06 PM
#5
Good Ol' Platypus
It lets windows update itself and everything (display, etc.). If you don't have it you won't see anything happen!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 26th, 2002, 05:30 PM
#6
Frenzied Member
Yes, other events take place when no code is running or when you call DoEvents (that's why it's called that name )
-
Mar 27th, 2002, 07:51 AM
#7
Thread Starter
Lively Member
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!
Often talked of, never seen,
Ever coming, never been,
Daily looked for, never here,
Still approaching, coming near,
Thousands for its visit wait,
But alas for their fate,
Tho' they expect me to appear,
They will never find me here.
What's this about?
-
Mar 27th, 2002, 12:46 PM
#8
Frenzied Member
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" 
Oh did you read my tutorial? Huh is there any other part that is not clear enough?
-
Mar 27th, 2002, 01:07 PM
#9
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 27th, 2002, 01:14 PM
#10
Frenzied Member
Yeah huh I dind't know it returns that but the way it's used in the loop, I assumed it always returns true 
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.
-
Mar 27th, 2002, 01:24 PM
#11
transcendental analytic
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.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|