Mouseclick and sprites

Get help using Construct 2

Post » Sat Apr 28, 2012 2:53 am

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
B
16
S
6
G
6
Posts: 100
Reputation: 4,840

Post » Sat Apr 28, 2012 2:59 am

The sprites collision polygon is probably not the same for the "on" and "off" frame. You can change it in the image editor.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Apr 28, 2012 3:05 am

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
B
16
S
6
G
6
Posts: 100
Reputation: 4,840

Post » Sat Apr 28, 2012 3:08 am

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.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Apr 28, 2012 3:11 am

Sorry, new to C2 :)

Thanks!
http://dl.dropbox.com/u/4898391/ZIGx.capxJulmust2012-04-28 03:11:42
B
16
S
6
G
6
Posts: 100
Reputation: 4,840

Post » Sat Apr 28, 2012 3:47 am

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
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sat Apr 28, 2012 3:50 am

Actually, the new "Else" system condition is meant specifically for this kind of thing.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Sat Apr 28, 2012 4:01 am

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?
B
16
S
6
G
6
Posts: 100
Reputation: 4,840

Post » Tue Dec 11, 2012 4:06 pm

Thanks Nimtrix

necro-bump but just found your example very useful thanks matey
B
10
S
2
G
2
Posts: 45
Reputation: 2,039


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests