SOLVED - What is wrong with this sentence? (cannot convert Character* to int)

Started by johanvepa, Tue 27/09/2016 20:47:19

Previous topic - Next topic

johanvepa

I am doing a check to see if things are overlapping. I have two character, one stationary called ctrashbin, and one moving, called cAffald1. Every game cycle, I wish to see if they overlap, then something happens.

Code: ags
  if (AreThingsOverlapping(cTrashbin, cAffald1))


When trying to compile, I am told there is an error at the line: Cannot convert 'Character*' to 'int'.

Me no unnerstand?

Crimson Wizard

Description of this function in the manual:

Quote
AreThingsOverlapping(int thing1, int thing2)

THING1 and THING2 can either be a CHARID, or can be an object number PLUS 1000

Example:
if (AreThingsOverlapping(1002, EGO)) {
   // code here
}

johanvepa

I read that.
In the example it shows us that it is suitable to write EGO.
What, then, is the CHARID of "cTrashbin" if not "cTrashbin"?


Crimson Wizard

Quote from: Nanuaraq on Tue 27/09/2016 21:16:18
I read that.
In the example it shows us that it is suitable to write EGO.
What, then, is the CHARID of "cTrashbin" if not "cTrashbin"?
AGS automatically creates a numeric constant for every character you have, and gives them names like your character's object name, except without "c" and in capital letters. These are CHARIDs.

EGO - is a numeric constant equal to ID of cEgo character.

There should be automatically created constants like TRASHBIN, but alternatively you could use cTrashbin.ID.

johanvepa

So I should write cTrashbin.ID? Because that is an integer, a numeric constant created by AGS. Allright, got that. It's damn hard to remember all these things, but it' still fun.
However, a nother problem just popped up. I try to determine if two characters are overlapping and I would expect that condition to be true when the graphics are actually touching each other, visually. These characters are just big circles, so its plain to see that they're 'overlapping' the moment the outer borders of their respective square 'boxes' touch, even though these parts of the characters are transparent. Do parts of characters that are transparent also set off 'AreThingsOverlapping'?



EDIT: I just read the manual. Of course they do. Sorry. And thank you for your help, wizard

SMF spam blocked by CleanTalk