Display Text and Detecting Actor Movement
![Wolvenna](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
I'm currently working on a little game where you drop a single actor from the top of the screen and it falls into a pyramid of block actors beneath it. The game is supposed to keep track of how long the actors continue to move and score points accordingly.
I used Tshirt Booth's tutorial on how to detect actor movement and set it up accordingly giving each actor a Real attribute called "stopped" that detects their movement. I then created a boolean game attribute called stopped. Within the block actors I created a rule that says
self.stopped = 0
change attribute game.stopped to true
self.stopped > 0
change attribute game.stopped to false
I then created a text actor that reads the game.stopped attribute and gave it rules that say
game.stopped = true
display text "Stopped!"
game.stopped = false
display text "Moving!"
Now when I test the game, the text actor seems to have absolutely no idea what it's talking about. The "Stopped!" and "Moving!" texts will flicker for a while before settling on one or the other (usually the wrong one). I thought it might be a problem with having both of the rules within the actors referring to the number zero, so I made the second rule
self.stopped > .01
But that didn't really change things in the slightest. Does anyone have any idea what the problem might be?
I'm new to GS and only have minor experience in programming. The logic makes sense to me, but maybe someone who has more experience than I can see what I've done wrong.
I used Tshirt Booth's tutorial on how to detect actor movement and set it up accordingly giving each actor a Real attribute called "stopped" that detects their movement. I then created a boolean game attribute called stopped. Within the block actors I created a rule that says
self.stopped = 0
change attribute game.stopped to true
self.stopped > 0
change attribute game.stopped to false
I then created a text actor that reads the game.stopped attribute and gave it rules that say
game.stopped = true
display text "Stopped!"
game.stopped = false
display text "Moving!"
Now when I test the game, the text actor seems to have absolutely no idea what it's talking about. The "Stopped!" and "Moving!" texts will flicker for a while before settling on one or the other (usually the wrong one). I thought it might be a problem with having both of the rules within the actors referring to the number zero, so I made the second rule
self.stopped > .01
But that didn't really change things in the slightest. Does anyone have any idea what the problem might be?
I'm new to GS and only have minor experience in programming. The logic makes sense to me, but maybe someone who has more experience than I can see what I've done wrong.
Comments
Now, my next step is that I want to create a timer that begins counting once the blocks start moving, and stops once they've all stopped. I believe I have everything set up correctly, but I'm unsure how to set up the timer. Any tips?
EDIT:
Apparently now it's not working correctly anymore. It seems to be having problems detecting movement. If one of the blocks drops below a certain speed it automatically switches the attribute game.stopped to true. Then it spends the rest of the time switching back and forth between true and false.
Well live and learn. I would still like any input anyone has, even if it's just ideas.