Orienting a player's arm to the mouse

  • Hi folks,

    I'm new here and I ran through the basic tutorial yesterday and everything makes sense, Construct 2 is a great tool, especially for me, since I have no mind for code whatsoever.

    Today I decided to test out an idea I had and see if it's feasible at all.

    Basically, I want the sprite's forearm to follow the mouse, and the arm to follow the forearm, as a kind of backwards skeleton. What I'm aiming to do is to give the player control on swinging a weapon.

    This is my sprite here:

    <img src="http://i2.photobucket.com/albums/y39/skidesigns/vik_zpsee4b59b0.png" border="0" />

    The arm and the forearm are separate objects.

    And here is how I've set up my Events sheet for the arm motion.

    <img src="http://i2.photobucket.com/albums/y39/skidesigns/Events_zps04d7b8ec.png" border="0" />

    (I've since corrected "forearm is visible" to attach to arm, rather than itself)

    The problem this seems to make is that the upper arm constantly rotates clockwise.

    Any ideas on how to fix the events? Or, if you have an idea of a better way of doing this, I am open to suggestions! Thanks! :)

  • Your events look good, so I cant see the problem unless you upload a capx or a demo.

  • Thanks :) I realize now the problem is not the arm anymore...I'm just not sure how to straighten out the whole structure.

    Here's how it looks so far:

    screenr.com/BoAH

    EDIT: I tried another test, this time with the arm as one sprite. This does fix all of my problems with the more complex setup, but limits the range quite a lot...Might need to make an executive decision to keep it simpler.

    screenr.com/DoAH

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I did some test and this is the best I could:

    dropbox.com/s/6o53lasjqzk87gw/arm.capx

  • I found this on the forums

    dropbox.com/s/4dyd1ieqo3cwhzw/armexample.capx

  • Thanks a lot! Still undecided as to which system I'll be using, but this definitely helps me get to grips with Construct better! :)

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