Shoot 'em up - bullets won't disappear

Heyho.

I posted a thread about my shooting game (see attached patch; LEFT and RIGHT moves gun, left mouse button fires) earlier.
Thanks to everyoneishappy every now the bullet textures won’t mix up anymore.

But now I wreck my brain about how to let the bullets disappear after they hit a target. I managed to make them disappear as long as the collision with the target takes place. But I need them to be invisible from the moment of the first hit until their termination.

Please enlighten me!

shooter_v2.zip (25.5 kB)

that is possible of course, but requires complicated spread operations as the spread count is ever changing and the position of a particular particle changes position in the spread. what you would need is a datatype named particle, or bullet or so, which has several options like position, texture, color, visible…

if you dont want to code, you could fake something like that with strings, maybe like this:
posX;posY;texNR;visible

so a bullet would look something like:

0.1;0.4;2;1 or
0.3;0.2;1;0 …

then you have a subpatch which draws a particle (or a spread of them). it splits the string in its values and uses the data to draw a quad at this position, getslices the right texture and sets the alpha to 0 or 1. somewhere else you have subptches which set the visibility, position and so on…

Thanks Tonfilm! I’ll try your suggestion.

Could you as well provide a short description how the coded version would have to be? Do you mean a selfmade Plugin? How would one do that? Are there any coding tutorials on this website?

Cheers

the VVVV.Utils namespace contains a Particle class, which is quite what you need. start here: plugins

Thanks to tonfilms hints I created my first Plugin!

It works nicely and spares a lot of nodes in the patch.
Though the disappearing-when-collision thing is still an issue I need help with.
In order to prevent multiple collisions between the same two objects (check my patch to understand what I mean) I’d like the bullets to be killed as soon as they hit one of the floating objects. I don’t really know how I could integrate that into my plugin. Any ideas?

Plus I’d like to hear your opinions on how I implemented the floating targets considering the collision detection. Might there be a smarter way?

In the attachment you find the actual version of the shooter. You’ll have to put the ‘AnimationMyBullet’ folder in to your Plugins folder.

Excited about your input!

shooter_v3.zip (1.8 MB)