Animation frame

Get help using Construct 2

Post » Tue Oct 29, 2013 7:44 pm

Hey all, I'm rly idiot because I can't create simple event ><

There's .capx file with my problem: http://ge.tt/6vClebw/v/0

What I want to achieve is that when any user click on button, when sound is playing button frame on that time is number 1, but when it stop, it come back to frame 0
B
10
S
3
G
1
Posts: 14
Reputation: 1,220

Post » Tue Oct 29, 2013 10:24 pm

It is the way you name your tag that goes wrong.

Try this out:


The problem is that your event Audio -> on sprite.sound ended

In the Touched event you have touched a sprite, so it will know what sprite.sound to pick. But in the ended event. Which sprite.sound value should it pick?
cvp2013-10-29 22:24:55
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Wed Oct 30, 2013 7:19 am

@cvp

Your solution is good for one button, but what, when each button will have other sound, and they are pressed on the same time?
B
10
S
3
G
1
Posts: 14
Reputation: 1,220

Post » Wed Oct 30, 2013 7:31 am

[QUOTE=Abdizriel]
Your solution is good for one button, but what, when each button will have other sound, and they are pressed on the same time?[/QUOTE]

The events should work with any number of buttons/sounds. I'd place different buttons as different animations to that single object.
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Wed Oct 30, 2013 7:44 am

@vee41

Event unfortanely don't work so good. When I press one button and sound is playing and then press other button, where song is shorter, both turn to sprite 0, not only that one which end but also that one which is still playing.

If I understand you right with: ". I'd place different buttons as different animations to that single object."

I've one sprite object with diffrent animation frames for all buttons like there: http://ge.tt/6vClebw/v/0

B
10
S
3
G
1
Posts: 14
Reputation: 1,220

Post » Wed Oct 30, 2013 8:41 am

My bad, I stand corrected. :)

Here is fixed version: animation frame change when sound ends

Not the prettiest of solutions but works.vee412013-10-30 08:41:37
B
24
S
9
G
7
Posts: 756
Reputation: 7,302

Post » Wed Oct 30, 2013 9:36 am

@vee41
It still isn't change :(
When few sounds are playing they should be frame 1, when one of them end that one change frame to 0 rest of them if they're still playing stay on frame 1

I tryied do loop for each,but I got js errorsAbdizriel2013-10-30 09:38:05
B
10
S
3
G
1
Posts: 14
Reputation: 1,220

Post » Wed Oct 30, 2013 9:59 am

The .capx I posted works for me, when you click on button it changes the frame to 1 while sound is playing. Sprites frame changes to 0 when it is not playing a sound effect. You can have as many buttons/sounds as you need. Wasn't that the goal or did I miss something? :)

Edit: As always, don't bother running anything HTML5 related in Internet Explorer as it won't work as intended.vee412013-10-30 10:32:00
B
24
S
9
G
7
Posts: 756
Reputation: 7,302


Return to How do I....?

Who is online

Users browsing this forum: ST314 and 30 guests