Re: Hazy and vague
Paul Kerslake wrote:
> In my last e-mail I wrote:
>
> Here's a biggie: I know how to make a program that can move an image
> (text or bitmap) around the screen using the arrow keys (or any other
> key fot that matter), but, how can I have frames?
>
> e.g.
> Having a bitmap of a space-ship and, when it moves, animate the fire
> coming out the back.
>
> I got an e-mail back telling me it was hard to figure out just what I
> wanted....
> I find this rather hard to explain... I think what I'm looking for is=
> how to make an animated bitmap that repeats itself.
>
> - Sorry for the enigma
Ok. Basically, make a sequence of bitmaps in the animation, and a variable
with an index into the animation sequence (i.e. the frame). Then, in a loop,
display the current frame, wait a short while, increment the index (set it
back to 1 after it's gone through the animation), and display the new frame.
The way to implement this depends on the specifics of your program (i.e. what
events your program has to handle etc.). I wrote a simple game in Euphoria a
while ago. As it got more complex, the system I had used to process events,
redraw the screen etc. became unmanagable. I wrote an event system library
(Event System for Euphoria or ESE - it's in the archives) and a game library
to go with it. You might find it useful. The graphics portion is not quite
complete, but it has several other features including keyboard event handling
and timers amoung other things. It provides a simple event interface, and
also allows some extremely simple cooperative multitasking. This way you can
handle keyboard events etc. and still use timers to time your animation (so
it won't be choppy).
Jeffrey Fielding
JJProg at cyberbury.net
|
Not Categorized, Please Help
|
|