How do I Mouse & Bullet Help

Get help using Construct 2

Post » Tue Mar 08, 2016 7:30 am

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 :P
Any help would be greatly appreciated!

Image

Image


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


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.
B
73
S
33
G
20
Posts: 85
Reputation: 15,688

Post » Tue Mar 08, 2016 7:45 am

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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
51
S
24
G
30
Posts: 521
Reputation: 19,594

Post » Tue Mar 08, 2016 7:52 am

LaDestitute wrote: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.
B
73
S
33
G
20
Posts: 85
Reputation: 15,688


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Unconnected, Waltuo and 18 guests