[wes-wog] zebra tutorial question - help with resetting actors x y coordinates
xyloFUN
Member Posts: 1,593
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
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
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
Sorry I don't have time to write out the rule but that all makes sense in my head. hope it helps
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
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.
@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
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)