alpha click

Started by Da_Elf, Sat 18/11/2006 21:07:44

Previous topic - Next topic

Da_Elf

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")

Khris

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.

Sparky

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.

Da_Elf

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


Khris

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.

Janik

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...
Play pen and paper D&D? Then try DM Genie - software for Dungeons and Dragons!

Da_Elf

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.

Da_Elf

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

Shaque

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?
Knowledge is a right, wisdom is a choice.

Khris

#9
Code: ags
// 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.

SMF spam blocked by CleanTalk