I am wanting to write small Particle and ParticleEmitter Classes for a HTML5 Canvas Game (Though, just discussing it in pseudo code is fine)
I am not great, at all, at Physics, and I don't want to use any 3rd party scripts/libraries to do this for me. Is there a simple way to do this? The Game is a top-down 2D Game and here is the sort of thing I'm wanting to achieve:
The Particle is the black ball, and I want it to accelerate up and move to the left until it reaches a specified amount of pixels above the origin, stop, and then accelerate down until it stops and disappears completely
Any help would be appreciated, I've been searching for a while now and cannot find anything on this.
Thanks
EDIT: I have implemented a quick mock-up in my game and it works well, but I was just wondering if there was any better, more efficient way to do it (Just because I don't know if this is the proper way, it does not affect performance)
if(_update) {
_yV += _gravity;
_y -= _yV;
_x -= 0.8;
_diff++;
if(_diff >= 10 && _loop) {
_yV *= -0.8;
_loop = false;
_diff = 0;
}else if(_diff >= 20 && !_loop) {
_update = false;
}
}