In my 2D game, I’ve encountered a very specific task. I needed to create a “Bouncing Bullet Shells” effect for my particles. I found the perfect video to implement my idea, but it wasn’t a tutorial, and the presented project didn’t have open code. In the comments, the author provides a part of the particle shader script, but I couldn’t understand it. Can anyone help me implement this or point me to similar tutorials? Thanks in advance to everyone who responds!
link to video - https://youtu.be/RO5tlO545l4?si=6lZJ7V-DwQAkgL6t
The part of the code:
vec2 apply_bound(float y_in, vec2 vel){
if(y_in > bound){
if(abs(vel.y) < 20.0){
vel.y = 0.0;
}else{
vel.y = -0.75 * abs(vel.y);
}
vel.x = 0.0;
}
return vel;
}