Behavior Help

crapscraps Member Posts: 353
edited November -1 in Working with GS (Mac)
I have actor A:

Rule:
touch.inside
change attribute - game.rollTheDice TO: True

Actor B:

Rule:
attribute - game.rollTheDice IS True
animate (png's)

The two above rules work as outlined. You touch the Roll The Dice actor and the animation plays in the other actor.

The problem is that this will only happens ONE time. It needs to happen each and every time Roll The Dice actor is touched.

I do not have a "change the attribute" back to false any where else so the game.rollTheDice should always be True.

Thoughts

Comments

  • bgappsbgapps Member Posts: 183
    put a timer in on the dice saying
    after 3 seconds or how ever you want your dice to move
    set game.rollTheDice to false
    should work
  • HachikoHachiko Member Posts: 330
    if you put, in Actor B, after the animate and everything a Change Attribute game.rollTheDice = false then everything should work fine.
    Didn't get the last line : I do not have a "change the attribute" back to false any where else so the game.rollTheDice should always be True.
    So I don't know if this will help (since you would have to put it back to false) :P
  • crapscraps Member Posts: 353
    I have had this - http://i52.tinypic.com/ngp011.png but it does not work.

    But still no luck - a one time roll only. (The reason the destroy actor is there is to show what is underneath the animation.)

    I did not change the game.rollTheDice back to false because I thought if its always true it would be ready to go. Guess not.

    http://i52.tinypic.com/ngp011.png
  • bgappsbgapps Member Posts: 183
    the change attribute needs to be inside the 2 seconds
  • crapscraps Member Posts: 353
    Its been there and about everywhere else possible. Still no go.
  • bgappsbgapps Member Posts: 183
    try checking the "run to completion box" and put the change attribute in their if have not.
  • crapscraps Member Posts: 353
    Tried wont work. Should the game.rollTheDice = false be located somewhere else.

    The above should work.
  • HachikoHachiko Member Posts: 330
    Umh, as I see it, you're destroying that dice actor after 2 seconds, but you're not respawning it in the actor A right?
    If that's the case, then of course nothing happens, cause there is not that actor anymore. Just don't put any dice in the scene, than, in actor A, where you say change attribute to true, make it so that it spawn a dice too.
    Or else do not destroy the dice. Make after 2 second self.alpha = 0. If attribute = true then alpha 1, animation, after 2 seconds first set attribute to false then self.alpha = 0.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Why are you destroying the actor again?
    in your timer do a change image back to the original image so your actor is there for additional rolls. I would also change back to false otherwise the roll will not ever stop animating. put the change attribute in the timer also. try that. There is also a way you use otherwise to stop the roll also but see if this works for now
  • crapscraps Member Posts: 353
    Thanks - how could I have overlooked the destroyed actor and not putting it back again.

    Think of a slot machine - I have two random animated dice rolling then they are destroyed and the random dice outcome roll shows up (from underneath the animation).

    This way it looks like the dice are rolling and stopping and the stopped dice faces are truly the random dice outcome.

    Hope this makes sense.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Ok so change the image to a blank image after your timer. just upload blank.png and create and save a transparent image in gimp or photoshop or whatever you use and then you can set your time to change attribute game.rollthedice back to false and change image to blank.png
  • crapscraps Member Posts: 353
    Your all the best. It works and I actually learned something tonight. Thanks.
  • crapscraps Member Posts: 353
    Trying to apply the same type of behaviors to another game section without any luck. (new actors)

    Actor A
    Rule - Touch
    Actor A - game.betOn5 = true
    (some other behaviors that work go here)

    Rule
    All game.betOn10 (betOn50, betOn100 etc) = true
    Change Att - self.image.alpha =.5

    Rule
    All game.rollTheDice = false
    Change Att - self.image.alpha = 1

    So when one of the actors are touched - the other actors go alpha = .5
    and the actor touched stay at it self.

    Then after game.rollTheDice = false all the actors should go back to game.image.alpha = 1.

    It works one time. But not on the repeat.

    Yes after the rolling of the dice the game.rollTheDice does get changed back to roll the dice false.

    Like the problem in the first portion of this post - tried to correct it the same way - but wont work. WOW
  • crapscraps Member Posts: 353
    Any ideas of how I might get this working? Or another way of accomplishing the same thing?

    Thanks
  • HachikoHachiko Member Posts: 330
    You could try something like
    if mouse is down then -> if touch is outside then -> self.alpha = 0.5 otherwise -> self.alpha = 1.
Sign In or Register to comment.