Pixel Perfect Collition

Ramiro

Now with an army of Mecha-Ralphs!
Veteran
Joined
Aug 5, 2015
Messages
858
Reaction score
364
First Language
Spanish
Pixel Perfect Collition
version 1.0.1​
 ​
What is this?

This script is a scripter's tool to allow to check pixel perfect collitions between pixels.

It's actually just a snipper than adds two methods to the Sprite's prototype.

What is Perfect pixel collition?

Is a way to check if two sprites "Touch" each other..

You can see an example here:



Do you see? they are not touching each other (even if both rects are touching)



If they touch, you'll know.

Downloads:

(Both links the master latest available version)

Bugs and limitations

At the moment it is rather simple, it doesn't check if the sprite's scale has changed or rotated sprites.

Those are features for next versions.

1.0.1 - Now it has to be a little faster, because it calculates less times per check.

Faq

How to use it?

In short terms:

spriteA.collidesWith(spriteB, tolerance=1); // means alpha 1 or bigger triggers touchTerms of Use

As almost all of my plugins, there are released under CC0 or Apache 2.0.

If you are worried about, don't worry you can use them in both commertial and non commertial games.

In this case, under Apache 2.0, it means you have to say 'thanks Ramiro' on a readme or your credits.

You can choose CC0 if Apache 2.0 license isn't available in your country.

Hope you enjoy.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,562
Reaction score
3,832
First Language
English
From the screenshot, it looks like it supports transparent pixels. Is that the case?


If so, that would be very useful.
 
Last edited by a moderator:

Ramiro

Now with an army of Mecha-Ralphs!
Veteran
Joined
Aug 5, 2015
Messages
858
Reaction score
364
First Language
Spanish
From the screenshot, it looks like it supports transparent pixels. Is that the case?

If so, that would be very useful.
That is the whole idea, it also has alpha tolerance if you like to use AA sprites...

Those features are exaplained in detail if you open the help inside the plugin parameters.

but basically:

spriteA.collidesWith(spriteB, tolerance=1); // means alpha 1 or bigger triggers touchEDIT: Now the algorythm should run a bit faster...
 
Last edited by a moderator:

Nova Toby

Veteran
Veteran
Joined
Mar 14, 2012
Messages
31
Reaction score
7
First Language
English
Primarily Uses
Can you explain a little more simply how to use this?  I have a basic Action Battle System in place but need to have better collision detection. For instance if the 'Player' collides with an enemy she gets damaged and knocked back and also if the players 'sword' sprite collides with an enemy then the enemy gets damaged and knocked back.

So basically I need to know how to use this plug in to have event commands triggered when two sprites collide (one of which could be the player sprite)
 

Ramiro

Now with an army of Mecha-Ralphs!
Veteran
Joined
Aug 5, 2015
Messages
858
Reaction score
364
First Language
Spanish
It's just a function you may call from any sprite:

if script call [ actorSprite.collidesWith(enemySprite) ]  comment: this happens when the two sprites collide  >else  comment: they are not colliding  >endIt doesn't work if you rotate those sprites, so you may have to do each rotated frame of the weapon as a different sprite in order of it to work, for example.

This has to be used with another plugins, it may be quite hard to use it with just events unless you know how to get the event's sprite (wich is a bit complicated without accessing directly at Spriteset_Map)
 

Lecode

(─‿‿─)
Veteran
Joined
Dec 18, 2013
Messages
490
Reaction score
657
First Language
French
Primarily Uses
N/A
I'll use this tool. Thanks Ramiro.
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 3)

Latest Threads

Latest Posts

Latest Profile Posts

Ami
--- Diary ---

M.Mage: It's the F.Mage's Diary. While she isn't here,i can read it.

May, 10: I'm hurt after the battle with the Minotaur. But luckily,F.Healer heal me with her Heal-2. That why,i Fall in Love with her.

M.Mage: Eh???
So... some of my Desktop hardware has kicked it apparently (still trying to figure out what and how at the moment :/ ) .... yay?
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Made a HUGE (YYOOOOJJ) Update to Monstructs and moving towards a Steam Early Access release!
A skill type called: "Rumagic". The intention is Magic with Rum(that pirates drink)
Does it sound strange in English?

Forum statistics

Threads
104,221
Messages
1,004,799
Members
135,737
Latest member
julek
Top