How do I Mouse & Bullet Help

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • This is hard to explain in just text so I will have to post some images on my little issue.

    The short explanation is I am trying to have it so that a gun follows the mouse on two different sides and is able to fire bullets, the gun follows the bullet just fine, the bullet however does not, that and once you switch sides the mouse controls seem to be inverted ?

    Anyways here are some screens of the code.

    The arms & guns are all separate sprites with the proper image points.

    I want to convert to this touch later on but I need to understand how the follow the mouse deal works

    Any help would be greatly appreciated!

    And than I use this to prevent the objects from going to a 360 angle.

    The code above works great actually, except for the fact that the bullets do not really follow the mouse.x & y, the seem to be at least an inch over where the cursor actually is on the screen.

  • This might be a simple answer but this solution I'm suggesting is first thing that came to mind.

    In your event where the bullets follow the mouse X/Y, why not set an offset for the mouse.x/mouse.y? I mean like:

    Mouse.X -5

    Mouse.Y -5

    Tweak it until maybe if you can see if it'll work, but also try substituting +5 instead.

    If my memory is correct, -y corresponds to down, +y corresponds to up, +x corresponds to the right, and -x corresponds to the left.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This might be a simple answer but this solution I'm suggesting is first thing that came to mind.

    In your event where the bullets follow the mouse X/Y, why not set an offset for the mouse.x/mouse.y? I mean like:

    Mouse.X -5

    Mouse.Y -5

    Tweak it until maybe if you can see if it'll work, but also try substituting +5 instead.

    If my memory is correct, -y corresponds to down, +y corresponds to up, +x corresponds to the right, and -x corresponds to the left.

    Thanks for the fast response!

    I have already attempted to play around with changing the mouse.x-5 mouse.y-5 thingys but it really does not effect the issue i'm having.

    Here is the actual capx file https://dl.dropboxusercontent.com/u/690 ... OOTER.capx

    If you open & run it, it will make more sense than me trying to explain it in text lol. right arrow key = show right arm + right gun & left arrow key = show right arm + right gun, left click shoots the bullet. Now each arm and gun follow the mouse on the x,y but you will notice when you rotate your mouse when using the left arm that it's almost like the controls get inverted.

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