MODULE: Pixel-perfect collision detection v1.02

Started by SSH, Fri 28/04/2006 16:09:53

Previous topic - Next topic

Cassiebsg

Thanks :)
I  ended up coding the function last night, and even though it's not pixel perfect (I think) it works good enough for what I need it to do.

But thanks anyway, saved and stored for if it turns out I need the PP perfect. :-D
There are those who believe that life here began out there...

croquetasesina

I'm trying that when two characters come together, the protagonist moves away.

I script thist:

bool IsCollided = false;


function room_RepExec()
{
if (PPColliding.CWithC(cJuan, cPeter) && IsCollided == false) {
  IsCollided = true;
  Display ("CROQUETA");
  cSofi.Walk (86. 119, eBlock);
  IsCollided = false;
}
}
Code: AGS




But it does not stop constantly repeating "CROQUETA" and the character does not move away.
I would like that when two characters come together, they repel each other.

Could anyone help me, please?

Snarky

#22
Code: AGS

bool wasColliding = false;

function room_RepExec()
{
  bool isColliding = PPColliding.CWithC(cJuan, cPeter); 
  if (isColliding && !wasColliding)
  {
      Display ("CROQUETA");
      cSofi.Walk (86, 119, eBlock);
  }
  wasColliding = isColliding;
}

croquetasesina

Thank you so much Snarky, Scavenger help me too with this:

Code: AGS

bool IsCollided = false;

function room_RepExec()
{
if (IsCollided == false) {
if (PPColliding.CWithC(cPeter, cJuan))
{
  Display ("CROQUETA");
  cPeter.Walk (86. 119, eBlock);
IsCollided = true;
}
} 
else IsCollided = false;
}

Snarky


AndreasBlack

#25
Is there a manual for this somewhere? It's not working the link. The basic Syntax i already know, but i would like to know forexample disable temporarely or pause options, if there are any.

actaria

 Hello,

Does anyone have a working link to download the module and the documentation please ?

I would like to try it.

Thanks a lot.

heltenjon

Quote from: actaria on Thu 01/12/2022 14:41:28Hello,

Does anyone have a working link to download the module and the documentation please ?

I would like to try it.

Thanks a lot.
Looks like this one is still up:
Quote from: Mehrdad on Mon 20/06/2016 07:59:45Here you are:
https://www.dropbox.com/s/kn03yyfbzpucosm/PPCollision.zip?dl=0
 

actaria


actaria

Do you also have the documentation ?

I tried to lauch the demo but it's not working maybe because of my AGS version 3.5.1

This is the first time i use a module because i am not satisfied with:
Character.IsCollidingWithChar and AreThingsOverlapping

Do i simply have to copy the ".scm" file to my Adventure game studio directory ?

Thank you

Crimson Wizard

#30
Quote from: actaria on Thu 01/12/2022 16:54:12Do i simply have to copy the ".scm" file to my Adventure game studio directory ?

You need to right click on "Scripts" and select "Import script module", then choose the scm file. The scm file may be anywhere. The Editor will unpack scm into the script files and add to your project.

Because the module is so old, there may be problems with it running in the contemporary version right away. In this case you'll have to adjust some settings in "General Settings - Backwards Compatibility", but I cannot tell which without trying the module first.

actaria

Quote from: Crimson Wizard on Thu 01/12/2022 17:38:57
Quote from: actaria on Thu 01/12/2022 16:54:12Do i simply have to copy the ".scm" file to my Adventure game studio directory ?

You need to right click on "Scripts" and select "Import script module", then choose the scm file. The scm file may be anywhere. The Editor will unpack scm into the script files and add to your project.

Because the module is so old, there may be problems with it running in the contemporary version right away. In this case you'll have to adjust some settings in "General Settings - Backwards Compatibility", but I cannot tell which without trying the module first.


Hello,

Now i will be busy with all that this is perfect  :-D
Let's try to use my 1st module and i will try many backwards compatibilty settings in case it's not working well.

Thanks again Crimson Wizard

actaria

It's working well with script compatibility level 3.5.0 Alpha but not with 3.5.1 i think because of:
GetViewport


actaria

I am now trying to use the module

Code: ags
function room_RepExec()
{ 
if (PPColliding.CWithC(character[0], character[15])) {
cChar1.Say("i am dead");
  }
}

Unfortunately it's not working nothing happens when i collide.
I triple checked the characters ID's.
Both characters got solid properties On

What am I doing wrong, any ideas ?

Thank you.

Crimson Wizard

Quote from: actaria on Thu 01/12/2022 20:04:55I am now trying to use the module

Code: ags
function room_RepExec()
{ 
if (PPColliding.CWithC(character[0], character[15])) {
cChar1.Say("i am dead");
  }
}

I don't exactly know what the problem with this is, but would like to point that you don't have to do "character[0]" and "character[15]". Whenever a function requires a Character* pointer, you may pass a script name, similar to how you are using cChar1 to call "Say":

Code: ags
if (PPColliding.CWithC(cChar1, cAnotherChar)) {

This makes it easier to understand which characters you are refering to.

actaria

O yes ok thank you for the explanation and it's easier than numbers sure thing.

SMF spam blocked by CleanTalk