How do I make 2D Mouse follow & °

0 favourites
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hello everyone who is reading this!

    I got stuck on one of the things and couldn't find in on forums as I don't know what it is called..!

    Basically I have a character which is running left & right etc... .

    Character shoots if mirrored shoot left if not mirrored shoot right.

    But I'm unsure how to make the character shoot where the mouse is so the player could actually shoot where he wants not only left and right... .

    I'm not sure what should I do or how I should do it?

    My first thought that came in mind was making the body animation separate with hands and every tick or / Sec mouse X - mouse Y ? that's the first problem!

    The second problem is how do I make it so he cant aim too high and too low and when he when mirror then mirror hands too! I have no idea how to do this but to learn how to do it would be awesome!

    Thank you everyone for your attention!

    Any help is much appreciated!

  • You might find your answer here if not pm me

    https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0

  • Lordshiva1948 I cant PM you I need 500rep, and I don't know what it's called what I want how I suppose to find it ?

  • I'm thinking it works like this so only the hands move?

    I'm using 2 sprites.. but what next? I mean is this the best way? or there is another way?

    Because I'm also wanting to change the animation later on to without weapon! will i need to hide them or something ?

    Thank you!

  • Changing animation doesn't mean you have to hide them, you just change animation..

    If the actions are different with the other animation you either add the condition - is playing animation, or put all events in a group and activate deactivate them depending on the animation.

    Now you have seperated the arms, the next step is pinning them to the body using the pin behaviour.

    Then you add an action of rotating the arms.. either you rotate them towards position mouse.x,mouse.y , or rotate toward angle(sprite.x,sprite.y,mouse.x,mouse.y)

    Then you add a condition to limit the rotation of the sprite , probably using either "is between angles" or "is within angle"

  • LittleStain But when I press Right the character mirrors it self but the arms stay to the Left?

    Could you show me an example? I don't get it

    Here is my characters moves & what i did:

  • Changing animation doesn't mean you have to hide them, you just change animation..

    But I did my hands as a second sprite! Is that bad? Or I should of just placed it in the Player aniamtion? But then only hands will Animate ?

  • Anybody ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok

    Now you have you char and his arms and there pinned

    Next make a statment that if player is mirrored than mirror arm else dont mirror arm

    After that make your origin for your arm at the shoulder than repostion accoringly

    Now youve done that you should than set arm angle to position and x and y is your mouse x and y

    This should be done every tick

    If you need more help feel free to post

    Yo and tell me how it goes on monday yh

  • And fraps1k

    Try completing more of the level becuaee your teacher wants something to show on wednessday

  • Hey man thanks for responding but i need help with the character to aim wherever the mouse is so basically I want him not to aim higher then 70* (top)and not to aim lower then 30*.

    See the .capx .upload.ee/files/4727180/MY_PRACTISE_SHOOT_360.capx.html

  • Oh ye and I have no clue why this happens please explain someone Thank you!

    The arm is more to the right when I mirror my character?

  • Would this work?

    https://dl.dropboxusercontent.com/u/485 ... m-Gun.capx

    I myself would actually go for setting the arm mirrored, instead of using an animation to mirror it..

    Also regarding your question above, it might be nescessary when mirroring to upin, reallign and repin..

  • Ahh ye that is it ..! Oh you did a hell of a job there (conditions)!

    Thank you everyone! Now I can see what i did wrong ...

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