Hello! If anyone can explain me the logic of creating basic fireworks in C++. I have to make the firework swirl though. If someone can guide me what header files to use, and a bit of the logic, it would be a great help!
@azula21 use graphics.h then
edit: if you need to use ascii you would need to have the x position and y position of the firework and calculate the next position (assuming it's animated and you want it to "explode")
@pepelaugh can't use that either dude. That is the main issue. Do you know any way which I can use to make my firework look like its going from the bottom to the top?
@azula21 Like the swirls going up or just the ascii art itself moving up?(so is the ascii art being actively affected eg, it grows larger, spreads out, etc... or do you just want a still firework ascii piece moving up the screen)
@azula21 simplest possible way is to have a folder of files which contain frames of fireworks, and for each frame, clear the terminal and cout the next file to the terminal.
if you want it to be generated, i'd say you'd have to calculate the vector between the edge of the screen and the center of the firework, and increase the edge of the firework by the vector.
@pepelaugh It may seem weird but I can't use vector eithers, actually only arrays, loops, ascii and basic stuff for that.
However, thanks a lot for the contribution.
@azula21 Ah- then the first answer would work for you, would it not? If you do not want to use files, you could store each frame in an array and loop through it, clearing the terminal at each frame. This would simulate a animation.
@pepelaugh Thankfully my teachers never said "no, you haven't learned that, so you're not allowed to use it", but I've heard of plenty doing just that.
Making Fireworks in c++ using basic code
Hello! If anyone can explain me the logic of creating basic fireworks in C++. I have to make the firework swirl though. If someone can guide me what header files to use, and a bit of the logic, it would be a great help!
opengl?
edit: using ascii values.
graphics.h
thenedit: if you need to use ascii you would need to have the x position and y position of the firework and calculate the next position (assuming it's animated and you want it to "explode")
Thankyou in advance!
if you want it to be generated, i'd say you'd have to calculate the vector between the edge of the screen and the center of the firework, and increase the edge of the firework by the vector.
However, thanks a lot for the contribution.
How experienced are you with C++?
Replace "Frame1","Frame2",etc with animation frames.
Then add a sleep function and clear the console.
thread
for sleep. if op is on windows he can useSleep
All depends on the teacher/course though.
To be honest, I doubt any school will restrict "advanced" code, that's just weird.