...make sprite scroll to mouse

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello peoples,

    I am making a strategy game and how could I make it so when the player right clicks the object 'sprite' move towards the mouse position?

    I know how to make it jump to but not scroll

    -Many thanks

  • What I would do is create a small invisible sprite at the point you click. Then set the object sprite (whose behaviour is a bullet???) from speed 0 to speed 2. Then if object hits sprite, set the speed to 0.

    That's what I would do :)

  • You could use the "mouseto" behavior (from the plugins forum) and set it to mouse.x, mouse.y.

    You can check also in the How do I FAQ there's a few other implementations proposed in the section "object moving".

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I would create 2 variables moveToX and moveToY and define them when the player clicks, for instance:

    On player Left Click -> set moveToX = Mouse.X; set moveToY = Mouse.Y

    Do intended action here

    You can make a global variable or a local variable or instanced variable; whichever you prefer.

    You'll have to set the variables back to 0, however otherwise you would have some weird things happening lol.

    If you look at my post ProjectDL and play the game you will see that it works.

    Moving to the targeted object should be simple, I think there is a move to action; I'm at work right now and cannot verify.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)