moving an actor on the screen with mouse position

rjacomenrjacomen Member, PRO Posts: 19
I need to be able to move an actor through a maze with just mouse position. Wherever I move the mouse the actor moves. I assume it would be when mouse is inside the actor, but how can I get it to move everywhere I move the mouse? The user of the game will not be able to click mouse buttons or keyboard due to a disability, but can move the mouse using a track ball.

Comments

  • -Timo--Timo- Member Posts: 2,313
    you have to work with constrain attribute.
    constrain x position to mouse x position
    constrain y position to mouse y position

    you can put these in a rule and say. if touch is pressed or if mouse position is inside
    do constrain x position to mouse x position
    constrain y position to mouse y position
    now when you press on the actor and move the mouse somewhere else the actor will follow.

    I think this is what you want, good luck!
  • rjacomenrjacomen Member, PRO Posts: 19
    Thank you. Worked perfectly. Much appreciated. THe only issue of course is once the mouse is locked into the actor, it's locked in permanently. I did set a rule where if the actor collides with a wall it resets the scene.
  • -Timo--Timo- Member Posts: 2,313
    if you change the rule to
    if touch is inside do:
    constrain x position to mouse x position
    constrain y position to mouse y position
    when you release the touch the actor wont follow your mouse, and when you touch the actor again he will follow you ;)
  • rjacomenrjacomen Member, PRO Posts: 19
    I can't do touch because the user will not be able to touch and hold. It's more technical than that because we are using other software with the game. The user will not be able to click a mouse, hold a finger down or anything like that.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited July 2013
    @rjacomen, you'll need to cover the screen with a large invisible actor. On this actor put a rule that constrains the mouse x and y locations to two game attributes. Then you can use the values of these attributes in your game. If you need me to put together a demo let me know.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @rjacomen, I put a little demo together.
Sign In or Register to comment.