Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: spook1 on Wed 15/03/2006 10:05:40

Title: click head, feet, belly etc
Post by: spook1 on Wed 15/03/2006 10:05:40
Is there a way to make specific regions of a character clickable?
E.g. make character touch his hair, feet, etc.
Look at different parts of the body.
To be more specific, I need this for interaction with a vehicle which is defined as a character.
I create some function Check_clicked_spot(), but now I started wondering if such a thing is already by default available in AGS.

regards,

Martijn
Title: Re: click head, feet, belly etc
Post by: Ashen on Wed 15/03/2006 11:02:05
No, AFAIK this can't be done by default.
Title: Re: click head, feet, belly etc
Post by: hedgefield on Wed 15/03/2006 11:39:11
I was thinking the same thing just recently! E.G. for shoot-outs, you know, head shot, kneecaps, stuff like that  ;D
Title: Re: click head, feet, belly etc
Post by: DoorKnobHandle on Wed 15/03/2006 13:16:59
For shoot-out sequences you'll have to do so much scripting by yourself, that you might as well add those "character zones" to your script manually.

For the sake of the original question: add a "run script" interaction to the "on any mouseclick" trigger of your character and add something like this:


if ( mouse.y > ( character[CHAR].y - ( CHAR_HEIGHT / 3 ) ) )
{
   // if player clicked on the lower third of the character
}

else if ( mouse.y > ( character[CHAR].y - CHAR_HEIGHT + ( CHAR_HEIGHT / 3 ) )
{
   // if player clicked on the middle third of the character
}

else
{
   // if player clicked on the upper third of the character
}


This should work - just remember to replace the "CHAR" with the script name of the character that you want to perform this script on and "CHAR_HEIGHT" with the size of this character along the y-axis (it's height) in pixels.