How do I make a bullet more accurate?

Get help using Construct 2

Post » Tue May 06, 2014 12:40 pm

Hey all,

Im having an issue with the bullet behaviour. It is spawning correctly and it IS moving towards the mouse co-ordinates but its not accurate... at all. It moves in the general direction of the mouse co-ordinates, but not EXACTLY towards the mouse co-ordinates (which is the desired effect). Instead the bullet is always 50-100 pixels above or below the cursor, depending on its placement on the screen. See the screenshot below:

fwegagr.png


Am i doing something wrong or is "the general mouse direction" the only way it can move? The following screenshots are of when the bullet being created and the its off-course trajectory:

dfgsdfg.png

hstyhst.png


As you can see, its moving in the general direction of the cursor but nowhere near the actual co-ordinates.

Any help would be hugely appreciated, as always :)
Many thanks all,
moymoymoy
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Tue May 06, 2014 1:11 pm

Are you using the "Bullet behavior" for the bullet?

If yes, on event 74 replace the "set angle toward" action with the "set bullet angle of motion" and on the field type: "angle(PlayerArmSprite.ImagePointX(1), PlayerArmSprite.ImagePointY(1), mouse.X, mouse.Y)" (without the quotes).

Also, you can merge event 74 to 73. Add a "trigger once while true" condition to the event 73 and move the "set bullet angle of motion" action below the "spawn object" action.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue May 06, 2014 1:29 pm

Ahhh eli0s my hero :D good to see you man, hows it going?

But yeah, i am using the bullet behaviour. Ive changed the events as suggested so it now looks as follows:
umdyfnfg.png


Unfortunately im getting the same results :(
You do not have the required permissions to view the files attached to this post.
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Tue May 06, 2014 1:47 pm

In the world of heroes I must be... the amazing slug-man! :D

Doing good moymoymoy, thanks for askinng ;)

Now, this is weird. Is it possible to send me the capx (or a simplified version of it) to take a look..? We must be missing something obvious there, but a closer look will help to trace it down!
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue May 06, 2014 1:55 pm

I'll inbox you the capx for same reasons as before :) Good to hear you're all good my friend ^_^

In the meantime if anyone else has suggestions also, I'll be more than happy to try them out :D
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Tue May 06, 2014 1:55 pm

You might need to take the layer/parallax into consideration. Look at the Mouse manual page: https://www.scirra.com/manual/114/mouse regarding X("layer"), Y("layer")
ImageImageImage
B
71
S
21
G
220
Posts: 3,646
Reputation: 123,721

Post » Tue May 06, 2014 3:05 pm

Ok. I have found the problem, but not a solution. It's the system| layout scale 0.6 that causes the offsetting...

I must say that I was almost ready to bite my monitor when I realized that I should check the scale factor...

If you set the layout scale to 1, it works ok. I don't know how to overcome this, I tried the magicCam plugin to see if the scaling from within the plugin uses an other algorithm, but it renders the same results.

That's why I insist that a real 3d work space is crucial. As it is now, C2 scales everything from 0,0 coordinates, this is causing the offset. Perhaps there is a way around this by using the parallax values of the layers and ass/subtract some offset in relation to the scale, but this is too complicate for me.

Some hero :roll:
Last edited by eli0s on Tue May 06, 2014 3:15 pm, edited 1 time in total.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue May 06, 2014 3:10 pm

@eli0s That makes sense i guess but then why am i not having that problem with the Yee enemy when it shoots?

@blackhornet Thanks for the suggestion, i had a look/mess around with it but i was getting same results :(
B
11
S
2
G
1
Posts: 62
Reputation: 1,410

Post » Tue May 06, 2014 3:18 pm

Because it is not on the edge of the layout, thus the scrolling factor isn't so obvious? Also, you are not able to confirm exactly were it shoots, the mouse cursor is much more accurate comparison point to detect the offset.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue May 06, 2014 3:18 pm

eli0s has just described exactly what I was suggesting is the problem. You've got to get the coordinates all relative to the same layer.
ImageImageImage
B
71
S
21
G
220
Posts: 3,646
Reputation: 123,721

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest