Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

What parameters to enter for this pixel collision script?

Basically, I would like to check if a 'bullet' event hits the 'player' and/or vice-versa. 'bullets' hitting 'enemies' and 'events' is good too.

Here is the script in question:
http://mvplugins.com/plugin/Ramiro/PixelPerfectCollision

Now, the script has NO examples associated with it. This means I have no idea what parameters to put in for 'sprite'.
(The 'rect' one also seems to use shorthand in explaining what it is trying to say which is infuriating (especially given it doesn't look like the scripter's first language is English, no offense!), I am left to assume 'rectangle' ie the bounding area around the event/sprite (the square that the event is in) but this could be wrong...)

It says:

Sprite.prototype.collidesWith(sprite[, alpha])
- Checks if two sprites are colliding by pixels.
- Parameters:
- sprite: The sprite to check collition.
- alpha: The tolerance to check collition, (by default 1)
if you are using alpha blending on your sprites considerer
giving it a larger value.
This could be anything, like the following:

Sprite.prototype.collidesWith(SPRITENAME[, 1])
Sprite.prototype.collidesWith(SPRITENAMEANDID[, 1])
Sprite.prototype.collidesWith(EVENTNAME[, 1])
Sprite.prototype.collidesWith(EVENTID[, 1])

I am also assuming these go into an if statement with the Sprite.prototype.collidesWith(SPRITENAME[, 1]) (for example) in the 'script' field or something?

If this isn't what I am looking for, could anyone direct me to a better script for checking collisions between events, to a pixel-perfect scale?

Thanks.
 
I was following this thread and noticed that the link you posted to Anthony's plugin does not satisfy pixel collision. I too was wanting to find a more user friendly pixel collision plugin for implementing things like projectiles in my own game eventually.

I think what we are looking for is a plugin that creates invisible hitboxes around our projectiles and NPCs, then compares the hitboxes to see if they are colliding so we can carry out an event based on the outcome. Anthony's script seems to compare if events are colliding. His script is pretty awesome but is not as precise as what I am looking for. I realize what I'm looking for is a little more complex since hitbox size is not a one-size-fits-all sort of thing. If you know of anything like this though could you let us know?

Or perhaps you are more skillful at interpreting Ramiro's PixelPerfectCollision plugin and could maybe define a more user friendly guide of how to implement it (I for the life of me can not figure it out, nor do I even know if it would accomplish what I am looking for).

Thank you.
 
Top