when dragging a object with finger, how i make it to be inside the scene only?

guillefaceguilleface Member Posts: 1,014
edited November -1 in Working with GS (Mac)
i try to put some walls around but actor won't collide when i drag it with the finger.

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    constrain attribute self.position.x to: max((0+( self.Size.Height /2)),min((480-( self.Size.Width /2)), game.Mouse.Position.X ))

    constrain attribute self.position.y to: max((0+( self.Size.Height /2)),min((320-( self.Size.Height /2)), game.Mouse.Position.Y ))
  • guillefaceguilleface Member Posts: 1,014
    thanks, thats a long formula lol, my playing area is in x=160 and y=360 counting a big actor 320 width x 480 tall, so i think i should replace those numbers that you put on the formula right? but didnt work.
Sign In or Register to comment.