Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Da_Elf on Sat 18/11/2006 21:07:44

Title: alpha click
Post by: Da_Elf on Sat 18/11/2006 21:07:44
i was checking the forum and the help file but didnt see anything to help me. when you click on a characters alpha channel it "sees" the transparent area rather than whats behind. i think they should make it so that the alpha of a character is not clickable (well. so that if you used the look at at something behind the characters alpha channel you dont get the message "damn i look good")
Title: Re: alpha click
Post by: Khris on Sat 18/11/2006 21:47:09
If by "alpha channel" you are referring to the transparent areas inside the character's rectangle shaped sprite, I can assure you that you're doing something wrong because clicking there won't trigger the character's interactions.

If you are actually speaking of partially transparent areas of the character's sprite, there are ways to avoid this, e.g. using a second character that's following the first one exactly but isn't clickable.
Title: Re: alpha click
Post by: Sparky on Sat 18/11/2006 23:11:59
You might also want to make sure "pixel perfect collision detection" is checked in the "General settings" tab. If it's not checked, it could be causing the behavior you've described.
Title: Re: alpha click
Post by: Da_Elf on Sun 19/11/2006 03:12:25
it is checked. im using png's with alpha channel. and when i use the eyeball on areas which i know are part of the character except transparent, it acts as though ive glicked on the solid part

see the area under the helmet wing. thats where the eye is clicking
http://www.elfpro3d.com/Asterix/error.jpg

Title: Re: alpha click
Post by: Khris on Sun 19/11/2006 06:17:25
Try using chars (pngs) without an alpha channel. You won't need one.
At least, Asterix'd look as if he'd do fine without one.
Title: Re: alpha click
Post by: Janik on Sun 19/11/2006 06:21:29
That shouldn't be necessary - alpha-channel pixel perfect click works for me so it should be possible for Da_Elf...

Check how your sprite looks in the sprite manager... perhaps you have some pixels that are not quite 100% transparent, they should look black in the sprite manager and will trigger a click...
Title: Re: alpha click
Post by: Da_Elf on Sun 19/11/2006 06:52:11
he is painted in photoshop. that area is not painted on.

what do you mean png's without alpha? if asterix was on a white background i would need to have the alpha to cut out the white background.
Title: Re: alpha click
Post by: Da_Elf on Mon 20/11/2006 14:10:00
ah yeah. when importing it told it to ignore the files alpha then in ags i set it to use top left pixel for alpha. this worked well
Title: Re: alpha click
Post by: Shaque on Mon 20/11/2006 20:28:24
Can you make the cursor change colour or animate when there is actually something for it to detect? While I'm on this, is there a way to add animated or static arrows pointing to ways out of a room once it detects a door or edge of a screen?
Title: Re: alpha click
Post by: Khris on Tue 21/11/2006 01:03:53
// repeatedly_execute
   int lt=GetLocationType(mouse.x,mouse.y);
   if (lt==eLocationCharacter) mouse.Mode=eModeTalkto;
   if (lt==eLocationObject) mouse.Mode=eModeInteract;
   if (lt==eLocationHotspot) {
      Hotspot*h;
      h=Hotspot.GetAtScreenXY(mouse.x, mouse.y);
      int dir;
      if (h.GetProperty("exit")) {
         dir=h.GetProperty("dir");
         mouse.Mode=eModeWalkto;
         mouse.ChangeModeView(eModeWalkto, dir+OFFSET);
      }
      else mouse.Mode=eModeInteract;
   }
   if (lt==eLocationNothing) {
      mouse.Mode=eModeWalkto;
      mouse.ChangeModeView(eModeWalkto, DEFAULT);
   }


In the Custom properties scheme editor, add a boolean property called "exit", default value 0 and a number property called "dir", default value 0.

Then draw hotspots over the exits and set their "exit" property to "true" and their "dir" property to 1-4, depending on the direction the arrow is supposed to point in. (You can use more than 4 directions if you want.)

Then adjust the code: DEFAULT is supposed to be the number of the default walk cursor view, and choose OFFSET to make the code use the correct views instead of 1-4.
If your walk cursor arrows are using views 14-17, OFFSET would be 13, obviously.

To animate the cursors, check "animate using view x" in the cursor pane of the editor and enter the view's number.