Sprites - Visibility - Clickability

Just started using Construct 2? Post your questions here

Post » Thu Jun 18, 2015 10:21 pm

I have a bit of an issue with my code, I've done a simple mute/unmute music sprite.

Originally I made it a single sprite with multiple frames but even if I had animation set to STOP it would still animate strangely.

The other issues is once I separated them and placed them on top of each other that I could only click one button. I changed that and slightly overlapped them to see what is happening, it seems that despite being on the same layer, in the order being placed under and being set to invisible, the sound off was not clickable when sound on was placed over it.

Here is an example in pictures;

Inside the development environment

Image

Selectable sound on area
Image

Selectable sound off area
Image
B
4
Posts: 19
Reputation: 240

Post » Fri Jun 19, 2015 6:25 pm

Sprites Z order, layer order or visibility does not interfere if it's clickable or not.

Instead of using a button over the other, try creating a single sprite to work as your button and then change it's frames depending on how it's toggled.

Sorry if I can't help any further, but I don't quite understood your problem D:
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Fri Jun 19, 2015 6:35 pm

I guess you aren't using an else statement?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jun 19, 2015 7:22 pm

RayKi wrote:Sprites Z order, layer order or visibility does not interfere if it's clickable or not.

Instead of using a button over the other, try creating a single sprite to work as your button and then change it's frames depending on how it's toggled.

Sorry if I can't help any further, but I don't quite understood your problem D:


I was basically using two sprites on top of each other and making one visible and the other invisible on each click but the sprite on top was never clickable even if the sprite under it was set to invisible.
B
4
Posts: 19
Reputation: 240

Post » Fri Jun 19, 2015 7:28 pm

Easiest way would be with one sprite with 2 frames:

On sprite clicked
-- sprite frame = 0
> set frame to 1
> set sound on
-- else
> set frame to 0
> set sound off
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jun 19, 2015 7:37 pm

Code: Select all
On sprite clicked -> set sound to 1-sound
                  -> set frame to sound

This will suffice to switch sound on/off and same time set proper animation frame to represent sound state.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests