Can the background be locked ( un-selectable)

justpro5justpro5 Member Posts: 49
edited April 2012 in Working with GS (Mac)
Hi
I have two questions:
Q1:
Please is there a way to lock the background so it will not be affected with actors . Sometimes when you place an actor on the scene it makes the background move from it place.

Q2:
how Can I make an arrow appear when i shift from square to another square .
I will explain :
Suppose that i have 9 squares on the sane ( 3cols X 3 rows)
when I click on the first square and then click on the second square beside it I want to let an arrow appear
my work is based on TSbooth demo http://gshelper.com/?p=521
I can make the square but I want to make an arrow when i choose another square up , down , right , left and diagonal

Sorry for my English . I hope that you understand what I mean

Thanks in advanced for any suggestion or help

Best Answer

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    Your English is very good.

    A1: It is not possible to lock an actor on a scene, but there are ways to avoid the problem you're having. One way is to position the background actor on the edge of the scene (or change the scene height/width to double its size and then move the background actor into the extra space you just created) and use two change attribute behaviors at the top of the background actor's rules to change self.position.x and self.position.y to whatever they should be (e.g. the center x and y values for your scene) when the scene starts.

    A2: Yes, this is possible but a bit tricky. Someone else may have a better solution, but here's mine: create two integers named game.firstClicked and game.secondClicked. You'll need to give each square actor an integer self.location set to 1 through 9. Then, in the actor's rules have a rule that says When touch is pressed --> When game.firstClicked=0 change attribute game.firstClicked to self.location; otherwise (if game.firstClicked > 0) game.secondClicked to self.location. Your arrow actor can then have rules to check the values of game.firstClicked and game.secondClicked. When both are > 0, change your arrow actor's self.position.x and self.position.y to some multiple of game.firstClicked and game.secondClicked (e.g. x=1*50 or 2*50 or 3*50 for the locations of the three squares in the top row), or use a magnitude behavior to calculate the distance between the squares if you are allowing the player to click on squares that are not right next to each other.

    Sorry for the long answer... hope it makes sense!

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

Answers

  • justpro5justpro5 Member Posts: 49
    Thanks tatting for your reply ,but I still can't figure it out . If you plea can make an example I'll appreciate it. thanks
Sign In or Register to comment.