Help needed with button animation

Uplink1001Uplink1001 Member, PRO Posts: 64

HI. and a happy new year to all.....
Can anyone help.
Have a button that changes colour when pressed and plays a short music track.
how do i get the button to change back to its original colour when the music stops....?
track lengths are only a few seconds.

Thanks in advance to all.

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    Timer: After X seconds
    -- Change self.colour.red to X
    -- Change self.colour.green to X
    -- Change self.colour.blue to X

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2016

    There isn't a way to determine when music has stopped playing but if you know the track length then you can use a timer set to that many seconds, as @Socks suggested.

    Actor colors use RGB color values in the 0 to 1 decimal range. If you have a color in mind such as lemon chiffon: rgb(255,250,205), you can change the actor's color attributes to 255/255, 250/255, and 205/255 respectively.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Uplink1001Uplink1001 Member, PRO Posts: 64

    hi
    I have used a timer but the animation cuts in after around 3.5 seconds, and the sound is around 5 seconds.??
    this happens on every sound when the button is pressed, any ideas?

    thanks

  • SocksSocks London, UK.Member Posts: 12,822

    @Uplink1001 said:
    I have used a timer but the animation cuts in after around 3.5 seconds, and the sound is around 5 seconds.??

    You've not previously referenced any animation, said how long it might be, how you are using it and what rules or behaviours control it, or any other details, so it's difficult to predict why it takes 3.5 seconds before playing (I'm assuming that's what 'cuts in after 3.5 seconds' means), you'd really need to provide some details.

    Also, not 100% sure what 'the sound is around 5 seconds' means, do you mean it also takes time (5 seconds) before it starts playing ?

  • Uplink1001Uplink1001 Member, PRO Posts: 64

    Hi.
    Okay i will start again. included some screen shots of one screen and the rules for the buttons on that screen.
    When i press one of the buttons on the screen, the sound plays and this in turn start an animation of a equaliser at the bottom of the screen, my problem is when i press each button in turn the first button will play the animation and then end it, but the other buttons fire the animation but sometimes it stops before the sound has finished and cuts out the sound also.
    Can anyone help.....?????



  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    The When Touch is Pressed rule condition is only true WHILE the button/tap is held down. Try putting all of the behaviors and rules that are inside that rule condition into a Timer set to after 0 seconds with Run to Completion checked. That should force everything to continue to run even when the mouse/finger is released.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Uplink1001Uplink1001 Member, PRO Posts: 64

    Thanks for that tatting, i'll give it a go

  • Uplink1001Uplink1001 Member, PRO Posts: 64

    Hi. again
    Could you give some sort of example for this.....???

    Thanks

  • SocksSocks London, UK.Member Posts: 12,822

    @Uplink1001 said:

    I'd be wary of using Disney's IP in an app, you do see people occasionally get away with using copyrighted material, at least for a short while, but there is always a risk of being sued (more likely you will get a C&D from Disney's lawyers if it's your first offense).

    Getting sued will probably not be the issue as you are unlikely to have the app approved, Apple have strong links to Disney (and Disney own Lucasfilms/Star Wars) so I can't imagine they'd want to be seen allowing copyright abuse of the Star Wars brand at the time of a major marketing push.

    Anyhow, basically I'd watch that you don't invest too much time in creating something that even if it manages to slip passed the approval stage, will never get featured, could get you sued (or at least attract a C&D order), and if it becomes even moderately successful will end up being pulled.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Uplink1001 said:
    Hi. again
    Could you give some sort of example for this.....???

    Thanks

    If you have a rule such as...

    When Touch is Pressed
       [do a bunch of stuff]

    ...change it to...

    When Touch is Pressed
         Timer after 0 seconds (run to completion checked)
              [do a bunch of stuff]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Uplink1001Uplink1001 Member, PRO Posts: 64

    Hi.
    App not being submitted to the app store, its for my son's personal use, just making it for him....as a practice app, just to see if i can do one....
    Thanks for the info.

    Uplink1001

  • SocksSocks London, UK.Member Posts: 12,822

    @Uplink1001 said:

    Hi.
    App not being submitted to the app store, its for my son's personal use, just making it for him....as a practice app, just to see if i can do one....
    Thanks for the info.

    Uplink1001

    Cool ! For a moment I was worried that we were going to have to spring you out of jail ! :)

Sign In or Register to comment.