Hey, I'm new to the Java arena, and am trying to create an application (using JForm and JPanel) displaying a fireworks show. The problem is creating an explosion for the display. Does anyone have any recommendations for creating an explosion? I've been stuck on this for quite some time and thought I'd see if anyone had any recommendations. Thanks for any advice you can provide.
Thanks majestic0110, I'll try that. I've been playing around with another version I found a while back, and have trouble integrating it into the rest of my app (get errors that G is null from a NullPointerException). I'll try this other one and see what I can get.
Forgive me if this is something obvious, but I'm still getting stuck on this. Right now the elements in the array don't seem to be initializing since I get NullPointerExceptions repeatedly in the loop. Does anyone see anything I'm missing? When I placed println statements within the code I could see that the initializations didn't work.
int gravity, a, v, T, L, x, y;
double valueA, valueB, dx, dy;
Random r = new Random();
for(t = 0; t < Explosion.length; t ++)
gravity = 20;
a = r.nextInt(50);
v = r.nextInt(50);
valueA = v*Math.sin(a)*t;
valueB = (.5)*gravity*(t*t);
dx = (int)v*Math.cos(a)*t;
dy = (int)valueA - valueB;
x = (int)dx;
y = (int)dy;
Explosion = new FireworksSprite;
//for(t = 0; t < Explosion.length; t ++)
System.out.print("Iterating through Array" + t);
It WAS something simple, I left out a line initializing the array's objects. I'll leave this thread open in case I run into any further issues, and will close out once this is completed. Thanks to those who have replied, you've been great help.