Why does gamesalad just break my game if things are done rapidly?

FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

So I have it set so that there are 5 Actors, A, B, C, D, & E. Then I have 5 rules, Rule A, B, C, D, & E. Then I have 5 buttons, A, B, C, D, & E. When each button is tapped, it sets the corresponding rule to true, and all other rules to false. (there are no else statements here). When the corresponding actor has its rule activated, it performed a rotation to angle relative to the scene 90 degrees, and a movement to coordinates. When the rule is set back to false (by activating a different button therefore setting all other rules to false), it causes the piece to rotate and move back to its original position. So basically only one can be activated at one single time, and when another is activated, it makes sure all others return to their positions.

Here's the problem. I'm not sure where the breaking is happening, I've tried a myriad of things, but if you activate one piece then rapidly hit another (which would be required for playing) it causes the rotations of both pieces involved to be the opposite of what they should be. Where basically they stop performing rotations, they stay where they are. They still move to their proper coordinates, but they are stuck in the rotation they are after breaking. Again I've tried a billion different things, going through all the rules and attributes trying to figure out why it would be doing this, everything is set to "run to completion".

I'm beginning to think it's just Game Salad that can't keep up with all the switching of rules fast enough and it just breaks. I'm at a standstill here.

Comments

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Another thing I would like to add, is something similar happened in another game I was working on. I had a character that would move on a vertical grid. You would press the up and down arrows on the keyboard to move the character up or down a space. But if you pressed down then up rapidly the character would go into a quick continuous motion off the screen.

  • SocksSocks London, UK.Member Posts: 12,822

    @Darvecard said:
    . . . I've tried a billion different things, going through all the rules and attributes trying to figure out why it would be doing this . . .

    You've been through all the rules, conditions, behaviours, attributes, how they are set up, how they are related to each other and in what order . . . and so on ?

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148
    edited January 2015

    So I have Boolean game attributes called Rotate A, B, C, D, & E.


    So lets go into button A's properties.

    Rule: When (all) of the following are happening
    touch is (pressed)

                do
    
                change attribute
                        set game.rotate A to true
    
                change attribute
                        set game.rotate B to false
    
                change attribute
                        set game.rotate C to false
    
                change attribute
                        set game.rotate D to false
    
                change attribute
                        set game.rotate E to false
    

    //(and that code is repeated to all the buttons but obviously adjusted to which attribute its adjusting, so on button C its setting game.rotate C to true instead of A, and all the other ones including A to false.)


    //(just for clarification the actors default rotation is -90, so the angle I want it to turn to when activated is 0)
    Now lets go into Actor A's Properties

    Group (button Activated):
    When (all) of the following are happening

            if game.Rotate A is (true)
    
              do
                     Rotate to Angle
                                 Rotate to angle: 0 -- relative to (scene)
                                 At a speed of: 500       [Run to completion]
    

    //(the coordinates below are the coords that actor A should move to when activated)

                     Move to: 
                                 Move to: 150, 222 -- relative to (scene)
                                 At a speed of: 500       [Run to completion]
    

    Group (button other button Activated):
    When (all) of the following are happening

            if game.Rotate A is (false)
    
              do
                     Rotate to Angle
                                 Rotate to angle: -90 -- relative to (scene)
                                 At a speed of: 500       [Run to completion]
    

    //(the coordinates below are the default coords that actor A should move back to when another is activated)

                     Move to: 
                                 Move to: 80, 301 -- relative to (scene)
                                 At a speed of: 500       [Run to completion]
    

    //(and once again this is copied to all the other actors with their corresponding rules, coordinates, etc)

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148

    Yeah I have been through anything. Does anybody know why this would be going on?

  • colandercolander Member Posts: 1,610

    Upload a test project showing the problem/s and someone will have a look at it for you.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2015

    If you check Run to completion you're telling that behavior to continue running until it's done regardless of whether the rule condition has changed since the rule started. So pressing button A then button B quickly would result in the A actor trying to rotate to 0° and -90° at the same time... which would result in an unpredictable final position.

    But do post a link to download your project (.zip it first) because I tried to reproduce the problem in a simpler fashion and I actually couldn't.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I agree uncheck all run to completions and that should sort out your problem. Also you need to add lockout conditions to your rule if x is true and the others are false then do. This will be sure the others can't activate when one is pushed as it locks out the others.

  • FlyboyTrevy_FlyboyTrevy_ Member, PRO Posts: 148
    edited January 2015

    Ok, unchecking everything works. It happens extremely rarely now. Not totally sure as to why, I thought Run to Completion would cause all the rotations to run until they hit where they were supposed to be, but I guess not. :) Now I say extremely rarely because if you hit the another button then the one that was past selected really quickly, it will cause the first actor involved to get stuck where its at when the second one is clicked (just like before) except its a minor issue now because when you click another it fixes itself, and once again it only occurs when its a repeated button. Should be fine.

Sign In or Register to comment.