control actor with touch question.

CaptFinnCaptFinn Member Posts: 1,828

I am currently using

Rule:
on touch
constrain self-y and self x to mousey and mousex.

i also have a collide with wall rule.

But my actor doesnt want to stop when i drag it over to the wall. it goes right thru the wall. Its almost as if its ignoring any other rule while its touched.

I know this is a basic way to move the actor with a finger. But how do i make it react to the walls?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    Constrain linear velocity X to 50 *( game.Mouse.Position.X - self.Position.X )
    Constrain linear velocity Y to 50 *( game.Mouse.Position.Y - self.Position.Y )

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    You also might want to stick this into the Otherwise section:

    Change linear velocity X to 0
    Change linear velocity Y to 0

  • CaptFinnCaptFinn Member Posts: 1,828

    i just tried that. on touch the actor goes flying all over the screen bouncing off the walls at fast speeds.

  • CaptFinnCaptFinn Member Posts: 1,828
    edited July 2016

  • SocksSocks London, UK.Member Posts: 12,822
    edited July 2016

    @FINNBOGG said:
    i just tried that. on touch the actor goes flying all over the screen bouncing off the walls at fast speeds.

    You've missed out the brackets.

Sign In or Register to comment.