Dangerous Dave style shooting?

Get help using Construct 2

Post » Wed Jan 11, 2017 5:20 pm

I'll do something with the platform template .
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Wed Jan 11, 2017 5:32 pm

newt wrote:I'll do something with the platform template .


Thank you!
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Wed Jan 11, 2017 5:56 pm

https://dl.dropboxusercontent.com/u/666 ... anlos.capx
It might not be very noticeable, but I set it to change frame according to the y of the target.
If you want to shoot directly above you wouldn't use the los, you would compare the x, and y of the target.
Also the cone probably needs to be dialed in a bit.

Also, also
If you want it to shoot through solids, change the los to custom.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Wed Jan 11, 2017 6:44 pm

newt wrote:https://dl.dropboxusercontent.com/u/666516/temp/dandanlos.capx
It might not be very noticeable, but I set it to change frame according to the y of the target.
If you want to shoot directly above you wouldn't use the los, you would compare the x, and y of the target.
Also the cone probably needs to be dialed in a bit.

Also, also
If you want it to shoot through solids, change the los to custom.

Okay, in testing, it seems the cone part is going to be a problem since I have to make it small enough so it apparently works up-close, but then it's wide and you end up hitting them when your at a distance and quite high above them. Is there any way of doing this so the LOS acts like a beam rather than a cone? Basically, a beam the height of the player or a bit smaller that only hits when you're parallel to them Y-wise, and it's the same for any height? I'd use an invisible bullet, but I think that would cause problems with the instantaneous response I need. Maybe a custom LOS?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Wed Jan 11, 2017 7:11 pm

Like I said you can mess with the los settings, or test the targets xy's, or use the third party ray trace plug.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Wed Jan 11, 2017 7:48 pm

newt wrote:Like I said you can mess with the los settings, or test the targets xy's, or use the third party ray trace plug.


I've never figured out how to test the offset position of an adjacent Sprite, in this case, is it above or below or on the same trajectory. Is that how you would suggest testing?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Wed Jan 11, 2017 8:13 pm

The capx already shows you how to test above, or below.
You just need an x component.
Test if the los target x is within the player's x minus n, and the player's x + n.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Thu Jan 12, 2017 7:22 pm

newt wrote:The capx already shows you how to test above, or below.
You just need an x component.
Test if the los target x is within the player's x minus n, and the player's x + n.

Here's something I tried with the raycaster, as you suggested: https://www.dropbox.com/s/07koqkknhtmnj ... .capx?dl=0

I just can't get the angle correct, if I use the edge of the layout or the start of the layout, depending on the direction the player is facing, that's fine for a straight line, but I can't add the 45 degree angle consistently if you press up. The great thing is I can control the width of the firing line with the trace sprite, but I'm not sure how this will be for performance if it's invisible (I could extend the trace sprite width to cover double the players height to allow for an error of margin).

Any ideas how to make the ray cast at a perfect 45 degree angle if you're pressing up at all positions in the level, mathematically speaking? Presumably by adjusting the X position?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Thu Jan 12, 2017 9:03 pm

I'm not sure what you are going for compared to the original video.
If I were to use the trace plug, when I wanted to shoot, I would pick the closest badguy, trace to its xy from the player, check its distance, and then compare its x, and y to determine up/down etc.
All the trace does is determine if it has a clear shot.
Image ImageImage
B
169
S
50
G
174
Posts: 8,331
Reputation: 110,806

Post » Thu Jan 12, 2017 9:40 pm

newt wrote:I'm not sure what you are going for compared to the original video.
If I were to use the trace plug, when I wanted to shoot, I would pick the closest badguy, trace to its xy from the player, check its distance, and then compare its x, and y to determine up/down etc.
All the trace does is determine if it has a clear shot.

Yeah you're right, I'm doing just that, in a way. So, I need to compare trace to the badguy, I couldn't think of a way of doing that, cause the x,y would have to be exactly the same as the badguy, wouldn't it? What would I use to compare trace to the badguy? I think trace looks perfect for this, really, I just don't know how to tweak the angle properly.
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: batto and 18 guests