Page 1 of 1

Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 2:53 am
by Julmust
I'm trying to create a HUD that you click with the mouse to toggle the player state. Problem is, every time I click on the button, the area which is intractable(I.e click-able) changes.. It will also erratically change depending on how I set-up the behaviours.

Any ideas?

Example:
http://dl.dropbox.com/u/4898391/ZIGx.capx

Much appreciated,
~BJulmust2012-04-28 03:11:28

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 2:59 am
by Nimtrix
The sprites collision polygon is probably not the same for the "on" and "off" frame. You can change it in the image editor.

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 3:05 am
by Julmust
I tried changing the collision polygon. I can safely say it has nothing to do with my issue.

*Edit* Actually -- If I set it to the bounding box, I can't interact with the button at all. Very strange this.Julmust2012-04-28 03:08:50

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 3:08 am
by Nimtrix
I could have a look at your .capx if you upload one instead of the project files, it's a lot easier that way. Just use "save as single file" when saving the project.

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 3:11 am
by Julmust
Sorry, new to C2 :)

Thanks!
http://dl.dropbox.com/u/4898391/ZIGx.capxJulmust2012-04-28 03:11:42

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 3:47 am
by Nimtrix
No worries ^^,
The .capx file is basically just a .zip of your project files, but we can open them directly in C2, which makes things a lot easier.

The problem here seems to be with the global variable. If I'm not mistaken, problems like these occur when you change a variable between 1 and 0 and have the variable in the conditions for the same events. (someone else could probably explain that a bit better, don't have time atm)

I used an instance boolean instead, and it seems to take care of the problem:

Julmust_Problem.capx

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 3:50 am
by TL22
Actually, the new "Else" system condition is meant specifically for this kind of thing.

Re: Mouseclick and sprites

PostPosted: Sat Apr 28, 2012 4:01 am
by Julmust
I actually solved it by 1) using a boolean like Nimtrix but also 2) just toggle a group. An Else system would be nice. Where is this?

Re: Mouseclick and sprites

PostPosted: Tue Dec 11, 2012 4:06 pm
by Binkus
Thanks Nimtrix

necro-bump but just found your example very useful thanks matey