Mouse Click movement

0 favourites
  • 7 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hi,

    How do I make a sprite move to mouse click and it's animation change relative to mouse position (like the Lucas Arts point and click games)?

    I already read the Mouse Click on How-To section, but I that didn't understood...

    Thanks!

  • There is a move to mouse example when you click new project in Construct 2, but you could also use the third party plugin MoveTo you can find in the plugin section of this forum. A third way is using lerp to interpolate between the two positions, but this takes some coding to figure out, so because you seem to be new to construct I would recommend option one or two..

    Because you are referring to lucasarts you probably want to scale the sprite too.

    Here's a simple example of how to do that:

    index.html

    And here's the capx

    distance-scale.capx

    I've used scale, but you could also use width and height, size..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • LittleStain, thanks for your help!

    I saw the move to mouse example in Construct 2 and it's very easy <img src="smileys/smiley4.gif" border="0" align="middle" />, but how do I make the sprite changes it animation relative do mouse position?

    Many thanks for your help!!!

  • compare the mouse position to the player position.

    if you really want to rotate the sprite just set it's angle : angle(sprite.x,sprite.y,mouse.x,mouse.y)

    if you want to mirror the sprite depending on mouse.x

    system compare two values: mouse.x > player.x

    if you only want to do it while moving add a condition for is moving and set the animation based on the destination.

    Everything is possible, but because it's unclear to me what you are expecting I'll leave it at these three examples.

  • Well, that should help. Thanks!

    Sorry if I was unclear in my explanation, 'cause I want to archive someting like LucasArts character movement, in other words, the sprites has animations for it's front, back and side view.

    But thanks again, you really helped me! :-)

  • you could set the animations based on angle of movement.

    if angle is between 45 and 135 set animation to front.

    if angle is between 135 and 225 set animation to side and set mirrored..

    etcetera..

  • Thank's!!!

    You really really helped!!!

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