Drag several actors...

Hi, I have a problem with a puzzle game... when the pieces overlap stick together :(
how can i do? tnx

Comments

  • grimtoothgrimtooth Member Posts: 69
    Haha... I ran into this too and I thought it was funny.

    Just make a game attribute (Boolean), mine was called "carrying.block?"

    Only allow the player to move an actor if "carrying.block?" Is false, set it to true when they pick one up and false when they drop it (for me that just meant when game.touch.count=0)

    Good luck!

    Grim
  • grimtoothgrimtooth Member Posts: 69
    Oh and if you didn't already... Making the actors "snap to grid" makes this kind of game work a lot better
  • ADSentertainmentADSentertainment Member Posts: 397
    Oh and if you didn't already... Making the actors "snap to grid" makes this kind of game work a lot better
    WHOA WHOA WHOA, what is this snap to grid thing you're talking about? Did they finally add that feature? :-O

    Having trouble with your game? Sounds like a personal problem.

  • grimtoothgrimtooth Member Posts: 69
    @ADSentertainment lol no they didn't add it.

    I just meant:
    When Touch.Count=0
    Change Attribute: Self.X to (floor(self.x/[Grid size]))*[Grid size]
    Change Attribute: Self.Y to (floor(self.y/[Grid size]))*[Grid size]
  • ADSentertainmentADSentertainment Member Posts: 397
    @ADSentertainment lol no they didn't add it.

    I just meant:
    When Touch.Count=0
    Change Attribute: Self.X to (floor(self.x/[Grid size]))*[Grid size]
    Change Attribute: Self.Y to (floor(self.y/[Grid size]))*[Grid size]
    Oh.... :((

    Having trouble with your game? Sounds like a personal problem.

  • curvilineecurvilinee Member Posts: 17
    Tnx grimtooth but i still have the problem :( ... i created 9 game bolean (like my pieces) called piece1, piece2, ecc... then on my piece i say: when i touch it, piece1 is true else is false, then i say if piece1 is true start drag. But if i release the piece on another piece still stick together :( how can i do? tnx a lot! .... xcuse me do you know the command to swap depht? tnx friend!
  • curvilineecurvilinee Member Posts: 17
    Tnx Wingmanapps

    My code on actor is this:
    on touch
    Change attribute: self.physics.drag to 1 else self.physics.drag to 0
    on touch
    Change attribute: self.physics.drag to 1
    Constrain attribute: self.position.x to game.Mouse.position.x
    Constrain attribute: self.position.y to game.Mouse.position.y

    what can i add to this code? xcuse me i'm newbie :\">
Sign In or Register to comment.