Display Text and Detecting Actor Movement

WolvennaWolvenna Member Posts: 11
edited November -1 in Working with GS (Mac)
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.

Comments

  • WolvennaWolvenna Member Posts: 11
    Okay, so I removed the two display text actions and created a single one to just display the game.stopped attribute. I guess the two texts conflicted too much. It wasn't really that big of a deal in the end. I just wanted to make sure that all of my attributes were working correctly, and it turns out they are and I was just being dumb with the text.

    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.
  • WolvennaWolvenna Member Posts: 11
    Hmmm, perhaps no one knows? I ended up having to set it aside for now because I can't figure it out and this game somewhat relies on the ability to do the things stated above. So I'll probably work on it more later on, and attempt something else for now. Dang, and I thought I had chosen something simple too.

    Well live and learn. I would still like any input anyone has, even if it's just ideas.
Sign In or Register to comment.