Maths help

MetzoPainoMetzoPaino Member Posts: 195
edited November -1 in Working with GS (Mac)
I'm trying to have a bucket catch falling objects, it seemed like I could just make some collidable walls and that would be that, but when I move quickly the actors pass through them so thats no useable.
The Game Salad people offered a quick fix, but I need to edit it slightly and so far have no managed to get it to work. Currently the right and left walls of the bucket both give there positions to scene attributes called Bucket Left and Bucket Right. The falling object is then constrained in the bucket with this logic:
http://i259.photobucket.com/albums/hh285/Clockwork_Universe/Screenshot2011-07-19at201029.png

Unfortunately that forces the object into the middle of the bucket rather than allowing it to stay where it would have landed in the bucket. So essentially I am trying to freeze an object in place once it has landed in the bucket, but still move with the bucket.

Can anyone help? I've spent all day on this problem with no avail.

Comments

  • EastboundEastbound Member, BASIC Posts: 1,074
    You need a variable in the actors you are trying to catch. Call it 'offset' or something.

    Then, when the object is caught, set offset to: `self.positionX-game.bucketleft`

    Finally, with a slight modification to what you have, constrain the ball's x to: `game.bucketleft + self.offset`
  • MetzoPainoMetzoPaino Member Posts: 195
    Eastbound said:
    You need a variable in the actors you are trying to catch. Call it 'offset' or something.

    Then, when the object is caught, set offset to: `self.positionX-game.bucketleft`

    Finally, with a slight modification to what you have, constrain the ball's x to: `game.bucketleft + self.offset`

    Is this what you mean:
    http://i259.photobucket.com/albums/hh285/Clockwork_Universe/Screenshot2011-07-19at225907.png

    Because it doesn't work, now nothing is constrained in the bucket and things have returned to the original problem of the object being movable and going through the walls.
Sign In or Register to comment.