[wes-wog] zebra tutorial question - help with resetting actors x y coordinates

xyloFUNxyloFUN Member Posts: 1,593
edited November -1 in Working with GS (Mac)
I have a quickie to ask:

Do you ever feel like adding just "one more feature" to an app?

Well, I am almost ready to submit something I have been working on for weeks but it would be cool if I could add this simple gimmick:
I have a few buttons that trigger a sound file and while that file is playing, I'd like to have a coloured stripe move off the screen, thus providing feedback about when the sound is about to end (so that the player can press again with a bit of warning on when to prepare to do so).

First, I've added an integer attribute which i called "visualFeedback".

To the buttons which trigger sound, I've added a rule: when touch is pressed, change attribute visualFeedback to 1
Otherwise, change attribute visualFeedback to 0

The little green bar which moves has this rule (which i need help with)
When attribute visualFeedback is 1, move actor 180 (which is left)
Otherwise, change attribute visualFeedback to 0

This will move the feedback bar left and stop it from moving when the button actor which plays/triggers sound is released but I also need to reset it so that the movement can be generated new for a different sound triggering button.

Any clues on how to do this while generating the least strain on the system?

thanks :)

Comments

  • xyloFUNxyloFUN Member Posts: 1,593
    @wes wog,
    if you happen to catch this, would you mind helping me out?

    I've watched your zebra youtube tut and it is close to what I want but once the navigation buttons stop, I need to reset the moving object (actor) back to its origin.

    Thanks :)
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    just interpolate your ribbons position to a point off screen and set the duration the same time as your audio file. then figure what position close enough to having the ribbon completely off screen to trigger your reminder to push the button again and you can do a change attribute to move the ribbon back on the starting point.

    Sorry I don't have time to write out the rule but that all makes sense in my head. hope it helps
  • forkliftforklift Member Posts: 386
    Tenrdrmer's way will work. I'm not saying my way is better, but it's just another way of thinking. *edit* I just don't like interpolate much.

    Rules in the sound bar could be:

    change attribute (game.soundbarstartX) to self.position.X

    (do your move command)

    Timer: after (number of seconds long the sound is) set self.position.X to game.soundbarstartX
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    forklift said:
    Tenrdrmer's way will work. I'm not saying my way is better, but it's just another way of thinking. *edit* I just don't like interpolate much.

    Rules in the sound bar could be:

    change attribute (game.soundbarstartX) to self.position.X

    (do your move command)

    Timer: after (number of seconds long the sound is) set self.position.X to game.soundbarstartX

    OMG how can you like GS timers over interpolate. I find interpolate to much more reliable. I actually had to go back through a game change every timer to an interpolate command cause my app got rejected over the stupid timers not working right.

    Either way will work Xylo but the interpolate will move the ribbon with the self.movable attribute unchecked which i'm told is good for performance. Don't know if it helps any or not. kinda like actor recycling which I don't think is rally needed but now you have two options

    and don't lie forklift we all know you think your way is better. ;)
  • forkliftforklift Member Posts: 386
    tenrdrmer said:
    OMG how can you like GS timers over interpolate.

    and don't lie forklift we all know you think your way is better. ;)

    Haha! When I use interpolate, I've noticed that interpolating something X amount of pixels is different than moving X amount of pixels. Probably because it's reusing the distance value over a time period. Just confusing for me. When I use a move command, I know exactly how many pixels it will move every time. Interpolate just takes some guessing.
  • xyloFUNxyloFUN Member Posts: 1,593
    Calm down guys ... any suggestion is worth considering and who knows who else will google this in the millenniums to come ...

    @tenrdrmer,
    i have not implemented your way just yet because I have never used interpolate so I need to do a little reading up in order to manage.
    Basically, what I need to do is so super simple that someone surely did a tut on it but i can't find one.

    Reseting an actors position after a button (other actor) is released can not be that difficult.

    All I need to do is slide the stripe off the screen but the sliding only happens as long as a certain button is pressed. Anytime that is not the case, the the coloured stripe needs to stay at its origin.

    Anyone else have a simple solution for this?

    thanks :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    xyloFUN said:
    Calm down guys ... any suggestion is worth considering and who knows who else will google this in the millenniums to come ...

    @tenrdrmer,
    i have not implemented your way just yet because I have never used interpolate so I need to do a little reading up in order to manage.
    Basically, what I need to do is so super simple that someone surely did a tut on it but i can't find one.

    Reseting an actors position after a button (other actor) is released can not be that difficult.

    All I need to do is slide the stripe off the screen but the sliding only happens as long as a certain button is pressed. Anytime that is not the case, the the coloured stripe needs to stay at its origin.

    Anyone else have a simple solution for this?

    thanks :)

    did u get my email :)
  • forkliftforklift Member Posts: 386
    Xylo, nobody's offended, relax. I knew he was joking... hence his ;) (but if he's not, i'm taking my toys and going home! see... there's another joke)
  • xyloFUNxyloFUN Member Posts: 1,593
    @john,
    yes I got one and answered it. Did you write another one?

    @forklift,
    sorry, no sleep, no suggar, no coffe, ... i just need to finish this puppy and send it home. Than I'll crawl into be until Sunday and dream about shooting at anything that makes noise. In my dream, the gun has a silencer too)
  • xyloFUNxyloFUN Member Posts: 1,593
    Wes-Wog demonstrated is so beautifully but i wish he went the extra mile and elaborated on a few more basic things. It's a great tut and all it probably needs is one additional attribute plus the rules to trigger it.
Sign In or Register to comment.