|
Post by GMLWaffle on Oct 2, 2016 1:47:08 GMT -6
So say you're like me, and you're terrible at creating sprites and graphics for your game.
Say you're also like me and you're very good at making sweet particle effects.
So unfortunately, there is no way to add collision with regular non-physics particles. "uh why don't you use physics particles then?". Simply because you can do more with them, in terms of how they act and behave.
So say you have a player object that shoots fire particles out of his hands. What a wiz (pun intended). So of course you want this fire to hurt the enemy object, or even catch some other objects on fire! But you can't do that due to the fact that particles are just graphics being drawn to the screen and there's no way to add collision to them.
However...
You could just simply create an object that has a sprite with a collision box, but is set to "not visible" at the x and y position of each particle. And with each particle it could be created, moved, destroyed, and so on. Then you could just have the collision with your enemy object or whatever you want with that "fake" object that's being created with the particle.
Just an idea I had at nearly 3 AM.
|
|
|
Post by illdiewithoutpi on Oct 2, 2016 8:51:13 GMT -6
Are you able to get positions of individual particles? I haven't messed with particles much, but I couldn't find anything that would allow for that.
My instinct with that is to create an object with the collision mask of an individual particle and create one of those objects whenever the player shoots out the fire particles. This object would have all of the positions of each particle in an array, and the particle behavior would be hand written inside of the object. Then, when checking for collision, it would loop through all of the positions of each particle and check for collisions with objects itself. That way you have a single object accounting for all of the collisions and an easy way to access the positions of your particles. Plus, it's fun to hand-code particle effects :D
|
|
|
Post by GMLWaffle on Oct 2, 2016 11:21:55 GMT -6
Or you could do a single object with a collision mask that is something like 16x64, assuming your fire only shoots 64 pixels away from your player. Or just however long your particle effect goes out from the player. Then have that created whenever you do what you're doing.
|
|