newbie question concerning the "partical effect"

T

Traddles000

hi, I have a fairly decent understanding of java applets. I know how
to put images in the applet, move them around a bit, etc. My problem
is, I'm trying to create an effect so that basically when I call some
method makeBang(x, y, image) it will create 2 to 6 random images, which
will start moving away from the source x,y with random speed and random
direction from the source. Now, I got some code to work that kind of
did this, but it was absurdly messy and ended up slowing up my whole
system, I know there's a better way. Now to make things even more
complicated, I need those images to start to fade after they've been
moving away from x,y for a second or two and return once the last image
has completly faded. AND I need this method that does this to run
seperatly from the main program such that the code that calls
makeBang() can continue doing stuff, (namely calling makeBang() several
other times with different values) seperatly while all this image
movement is being done.

somehow I have a feeling I'm going to get a really complicated answer,
but if anyone is willing to explain to me how to do this I'm all about
learning new stuff
 
T

Thomas Weidenfeller

hi, I have a fairly decent understanding of java applets. I know how
to put images in the applet, move them around a bit, etc. My problem
is, I'm trying to create an effect so that basically when I call some
method makeBang(x, y, image) it will create 2 to 6 random images, which
will start moving away from the source x,y with random speed and random
direction from the source.

So you want to make some game and have an explosion effect?

Please note that I am not a game programmer, so take the following with
a grain of salt. I know that simple explosions, especially the 2D ones,
are often one with an animation, consisting of a series of
(prefabricated) frames. There are freeware and commercial explosion
maker tools which can generate such series of frames, which can then be
used in a game. Or you could create your own animation with drawing
tools, or some home grown program using your existing algorithm.

The animation of the explosion frames is then done as part of the normal
game main loop, and frame parts of the explosion are often moved like
normal sprits.
Now to make things even more
complicated, I need those images to start to fade after they've been
moving away from x,y for a second or two and return once the last image
has completly faded.

That should be part of the complete animation series.
AND I need this method that does this to run
seperatly from the main program such that the code that calls
makeBang() can continue doing stuff, (namely calling makeBang() several
other times with different values) seperatly while all this image
movement is being done.

My understanding is that this is not how game loops usually work. You
have a main loop doing all the timing. One iteration through the loop is
supposed to produce one game frame. Within such an iteration one is
supposed to process the current input events, recalculate the positions
of all objects (sprits), detect collisions, etc. and paint a frame
(usually at least double-buffering).

/Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top