Share your repls and programming experiences

← Back to all posts
🎉 3d fire works to celebrate 500 cycles yey!! 🎉
potatojs (843)

thank u vm for everyone that voted commented in my repls :)
in 150 i made 2d fire works
in 500!!i made 3d fire works
in 1000 ....???
move using ur mouse and enjoooy :)

Comments
hotnewtop
InvisibleOne (2673)

in 1000?

me: hmmm, 4d fireworks???
other me: that's impossible!
me: welllll, technically...
me a few seconds later: Ok yeah, that is impossible
Me again a few seconds later: ... so...5d fireworks???

JosephSanthosh (1196)

The only difference I see is that the fireworks are going up about twice as fast and are technically defying gravity as their exploding and falling down way too fast and also where's the 3d ?!?

potatojs (843)

btw wat?
what do u mean by where is the 3d?
do u know what 3d is?
hello.
@JosephSanthosh

InvisibleOne (2673)

Click and move your mouse around @JosephSanthosh

JosephSanthosh (1196)

Oh thanks! Usually 3d is moved on its own. @InvisibleOne

potatojs (843)

okaay i got it now!
i didn't wanna make it auto because of freedom and stuff
u know
@JosephSanthosh

JosephSanthosh (1196)

What has freedom got to do with a game ?!?

@InvisibleOne

ironblockhd (425)

@JosephSanthosh that it's a game! If you only can watch it it's not a game, then it's a live browser-generated video!

JosephSanthosh (1196)

live-browser generated video? @ironblockhd

Bookie0 (5937)

in 150 i made 2d fire works
in 500!!i made 3d fire works
in 1000 ....???

I guess 4D: where you can feel the fireworks as well as see them, like 4D movies. Like you can research exaclty how fireworks feel/sound ;)

potatojs (843)

nice and fine and all tat stuff and u?
@python88

python88 (298)

@potatojs same and all that stuff. and you mr.air?

potatojs (843)

@python88 i'm not mr.air fine and all how about u?

python88 (298)

@potatojs i'm not 'you' and you mr.potato that will be eaten by me during dinner (my mom is cooking potato chips)?

potatojs (843)

@python88 oh i think it's the goodbye :(

python88 (298)

@potatojs would you like some ketchup on you? ahem.. i mean would you like to have a tomato on your head?

potatojs (843)

@python88 yeah i like that waying of death DO IT

python88 (298)

@potatojs i mean, if you were in a hot air fryer that is 200 degrees f...

python88 (298)

@potatojs igores the fast that they were talking about dieing...

python88 (298)

@potatojs You have 550 cycles not 500

potatojs (843)

@python88 what he 're still in the summer bruh

potatojs (843)

i still have 1 week booooy
@python88

potatojs (843)

@python88 nop it's the summer daah

python88 (298)

@potatojs oh. for us we started a month ago

python88 (298)

@potatojs my teacher is saying: you need your science notebook. for your independent practice, you will use your science modulales

python88 (298)

@potatojs my birth day is next week!

potatojs (843)

nice! are you going to make a project about that?
@python88

python88 (298)

@potatojs a question in class: how is water different from ice?

python88 (298)

@potatojs where i live, it hasn't snowed for 5 years.:(

potatojs (843)

@python88 where i live,it never snowed :(

viraatvv (146)

@python88 are you @-Rocket- from Scratch? I you are, then I am @viraatvv from scratch

AtriDey (188)

Cool. Did you use an engine or is this made from scratch?

potatojs (843)

by engine you mean unity or something?no
a game lib?no
but i used p5.js a very cool lib for graphics and stuff
:D
@AtriDey

PizzaisGood (32)

Whoa interesting. Goes slow sometimes and then speeds up.( ̄︶ ̄*))
Anyways...
Congrats!🎉🎉

johnnyfrancis (19)

@PizzaisGood I think it speeds up on click.

potatojs (843)

lol no i think i made some faster than oders
@johnnyfrancis

fuzzyastrocat (1510)

@johnnyfrancis This actually can occur with p5js. I'm not sure exactly why, but in many of my p5js projects this has happened so it would be reasonable to assume it might happen here.

potatojs (843)

i think it happens because of the frame rate?
when u put to many object show them update them specially in this project where litearally you can have hundreds of particules in the screen at the same time
@fuzzyastrocat

fuzzyastrocat (1510)

@potatojs Hmm, possibly. Though that wouldn't really explain a random increase of speed on-click. I think it's a p5js thing, not a sketch-specific thing.

angrydoge (474)

Dude, I had an idea, but its not 5d or 4d, its 1d. the first dimension is where everything is a line, so maybe you could make a raycast engine type of thing with fireworks?? idk just an idea

potatojs (843)

lol i though about that to :D
but.. i don't think i'm going back again...
it would be amazing if i did it in the first one :)
thanks for the suggestion
@dabombdgdzjr

KellerWorthen (41)

This is some serious code

Name12 (159)

Magnificent!!
beautiful!!
wonderful!!

and let me guess, for 100 cycles, it is a more magnificent firework?

fuzzyastrocat (1510)

@potatojs Cool! However, the physics on this really irks me... give the fireworks velocity so that they don't just immediately start falling once they explode, then it will look more realistic :D

potatojs (843)

they have velocity :)
i can just make it...more
@fuzzyastrocat

fuzzyastrocat (1510)

@potatojs What I mean is that the velocity should carry over into the burst particles. Right now, the firework has velocity, but as soon as it explodes the velocity magically vanishes. In reality, the firework would explode and the particles would "get" all the velocity the firework had.

This would look really weird if it was implemented right now, because there's another problem I've just realized: there's no acceleration on the firework. It goes straight up without slowing down. So, here's the suggested fixes:

  1. Make it so that the firework slows down — that is, add a negative constant (like, say, 0.1, but tweak it to make it realistic) to the firework's velocity every frame. (this represents gravity)
  2. When the firework explodes (ie, in the "explode()" function), pass the firework's velocity as an additional parameter. Add that velocity to all the particles' velocities (direction = p5.Vector.random3D().add(0, -firework_speed)).
  3. Make it so that the firework explodes only when it is almost stopped, such as if(firework.speed < [some constant, try 3 or something]) explode(...); instead of at a fixed time.

Hope that makes sense!

potatojs (843)

that sounds interesting i'm gonna try it now!
@fuzzyastrocat

fuzzyastrocat (1510)

@potatojs I just tried implementing it — these few simple changes make it look a lot more realistic!

fuzzyastrocat (1510)

@potatojs Hey, I see they slow down now. Awesome, they look more realistic!

fuzzyastrocat (1510)

@potatojs No problem! However, I notice this is how you're slowing them down:

if(abs(pos-fireWorks[i].end)<=100){
    fireWorks[i].speed*=0.9
}

Don't do that — gravity always exists, so it should always be slowing down :D
Instead, try these three things:

  1. Remove (don't set) fireWorks[i].end. Don't use an arbitrary ending point, a well-made physics system will find the end for you! (so on line 34, get rid of fireWorks[i].end>=fireWorks[i].y and only check for speed. And remove line 7 of fireWork.js).
  2. Always slow down. So, remove lines 31 and 33.
  3. Slow down correctly. Instead of fireWorks[i].speed *= 0.9, do fireWorks[i].speed -= 0.1. Gravity is linear on velocity — what you are doing now is representing some kind of friction, like air resistance. (But air resistance is so minimal it shouldn't slow them down that much and can therefore be forgotten :D)

Sorry to keep bugging you, I like this project so I want to help it get better :D

(One more note: looks like you pass the velocity to explode, but you don't do anything with it. Try changing line 66 (or whatever line has let direction= blah blah on it, I might have the wrong number) to let direction=p5.Vector.random3D().add(0, -vel).)

potatojs (843)

ok i'm gonna try those :D
lol i actually add the velocity to the direction but because the fire work velocity is just a change in the y axes so i just add the vel to the direction.y wich is easier because for some reason i didn't use vectors with the velocity of the fire work itself :D

thanks it's really nice to know that they actually liked this project (because i made it a while ago) lol
@fuzzyastrocat

fuzzyastrocat (1510)

@potatojs Great!
Ah ok, didn't see that. Yeah it's good to use vectors with everything just to make things consistent, but for a simple case like this that's probably fine.

No problem, I think it's pretty cool :D

AphixDev (217)

You got them skills, itz like the fourth of july

TheAverageAsian (3)

Coding is fun, but it kills me sometimes.
This is one of the things that would probably kill me.
@potatojs

TheAverageAsian (3)

Yeet. I'm buried under tons of code, which kills me everyday.
@potatojs

DannyIsCoding (694)

Whoops! I'm a little late. Still CONGRATS! :)

AdrianTkachenko (3)

yaaaaaayyyyyyyyy btw you shold learn unity and c#!

potatojs (843)

it's in my plans :)
but i can't right now :(
@AdrianTkachenko

DavidLi17 (18)

HUHHHHHHHH... Where are those fireworks coming from?

DavidLi17 (18)

@potatojs hoihuhhaheehihoiheheahahehuhhoihihumhumhunhuthuttathehutyaanhutgoescrazy!!!!!!!!!!!!!!!!!!!
potatoes don't eat ducks.
ducks don't eat potatoes.
we can be friends!!!!!!!!!!
nom nom nom potato chips are delicous nom nom

potatojs (843)

@DavidLi17
hoihuhhaheehihoiheheahahehuhhoihihumhumhunhuthuttathehutyaanhutgoescrazyhoihuhhaheehihoiheheahahehuhhoihihumhumhunhuthuttathehutyaanhutgoescrazy
ok.

DavidLi17 (18)

@potatojs nom nom can i eat you nom nom wow you look delicously cool

DavidLi17 (18)

@potatojs DavidLi17 just ate potatojs nom nom

potatojs (843)

@DavidLi17
stupid duk potatoes like eating duks and not talking to stupid duks

DavidLi17 (18)

@potatojs dude, there is actually a plant called the duck potato!!!!!!!!!!!!!

potatojs (843)

@DavidLi17 what? lmao
this is really cool
this plant was born after a potato ate a duk

potatojs (843)

i don't know how grades in the US education system work so let's say i'm 13 :)
@DavidLi17

DavidLi17 (18)

@potatojs first of all, the plant was a potato that wanted to look like a duck so it can avoid being eaten by a duck, but all ducks were smart enough to know that it is still a potato, so they ate the"duck" potato. Are you doing geometry in math?

DJWang (1344)

This is horrible..........y awesome!!!

DynamicSquid (4618)

can you make it shoot 3d squids?

potatojs (843)

lol wait a second
actually wait a day lol
@DynamicSquid

potatojs (843)

actually you're gonna wait a couple years
@DynamicSquid