Newbie Needs help with exchanging actors

skmcgeeskmcgee Member Posts: 3
edited November -1 in Working with GS (Mac)
I'm creating my first puzzle game and I can't seem to get it to work. I have two actors block and hole. I have three rows of blocks with 5 blocks in each row, except the last row, which has 4 blocks and 1 hole.

When I click on the block, I want it to move to the location of the hole, and I want the hole to move into the place where the block existed. I've created 4 attributes selected_x_pos, selected_y_pos, hole_x_pos and hole_y_pos.

On the block I have a rule when the block is clicked, I tell it to set selected x/y_pos to self_position_x/y and then I move the block to the hole_x_pos and hole_y_pos. (in that order)

On the hole I have a rule of collision where if the hole collides with the block, I first move the hole to selected_x_pos and selected_y_pos and then I set the hole_x_pos and hole_y_pos to the self.position x and y

When I put the 4 attributes in text actors, it appears that hole_x/y_pos isn't getting update with the correct values. It always seems to be 1 move behind.

How can I force it to update the attribute, since it doesn't seem to update when it runs on the collide rule?

Thanks

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    setup to all trigger by an attribute. Like say a Boolean called game.move

    And make all of those rules go when game.move equals true.

    then make a when touch is press rule on the block

    When touch is pressed
    --Change attribute game.move to true

    a rule when game.move is true
    --Timer after .5 sec change attribute game.move to false.

    You can play with the timer setting but right now your rule is becoming false before all of your attributes are setting up so now with this is will have more time to all update.

    Hope that helps

    ___________________________________________________________________________________
    GS BubbleBall Template HERE!!
    Stacks Level Selection Template HERE!!
    Expanding Option Menu Template HERE!!
    Tenrdrmer's Menu # 3 HERE!!
    AppSolute Entertainment on Facebook
    AppSolute Entertainment on iTunes
  • skmcgeeskmcgee Member Posts: 3
    Thanks it worked. Now I need to stop the hole from moving if you select a block that is diagonal to it or more then one row or column away from it. I have a few ideas, but if you've got any quick methods, I'd be glad to hear them.
Sign In or Register to comment.