Dangerous Dave style shooting?

0 favourites
• 48 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
• I think beams are as long as the distance to the first thing they hit.

I think the original didn't have a beem.

• I think beams are as long as the distance to the first thing they hit.

I think the original didn't have a beem.

I agree the original didn't, but I think the ray tracer is fun to try, I just can't work out how long I should shoot the ray and what angle to shoot up?

• Well the platform example is a lot diferent than the game.

In the game the enemies are all at set heights, so hitting the up or down arrow just meant you want to shoot something on the next level up, or the one below, so there is no angle to find.

In the platform example, all enemies can be at any height, so a specific angle is pointless.

• Well the platform example is a lot diferent than the game.

In the game the enemies are all at set heights, so hitting the up or down arrow just meant you want to shoot something on the next level up, or the one below, so there is no angle to find.

In the platform example, all enemies can be at any height, so a specific angle is pointless.

Yeah, but he doesn't always hit the monsters if he's not in range or at the right angle, does he?

• Well the platform example is a lot diferent than the game.

In the game the enemies are all at set heights, so hitting the up or down arrow just meant you want to shoot something on the next level up, or the one below, so there is no angle to find.

In the platform example, all enemies can be at any height, so a specific angle is pointless.

How can I keep point B at the exact same angle between A, regardless of how long the distance between A and B is?

• You pick an angle. 0 degrees is that way ->. 180 is that way <-.

You would probably want something like 315 for top right, and 225 for top left.

You use the mirrored condition to tell when to use the opposite angle.

• You pick an angle. 0 degrees is that way ->. 180 is that way <-.

You would probably want something like 315 for top right, and 225 for top left.

You use the mirrored condition to tell when to use the opposite angle.

Yeah, but how do I set the length of the ray to be the edge of the viewport and keep the angle correctly?

• Try Construct 3

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

Construct 3 users don't see these ads
• As I tried to say before the ray doesn't care where the edge of the viewport is.

Furthermore you can't get that position without some actual raycasting, and the viewport offers nothing to cast against, unless you make some dummies.

However, you can presume that the layout width divided by two would be long enough to ensure that it will always end off screen.

Perhaps you could describe exactly what you want to do. Step by step.

You keep asking for an angle, and I have no other frame of reference other that those I've already addressed.

• As I tried to say before the ray doesn't care where the edge of the viewport is.

Furthermore you can't get that position without some actual raycasting, and the viewport offers nothing to cast against, unless you make some dummies.

However, you can presume that the layout width divided by two would be long enough to ensure that it will always end off screen.

Perhaps you could describe exactly what you want to do. Step by step.

You keep asking for an angle, and I have no other frame of reference other that those I've already addressed.

That's where the angle stays the same regardless of the position the player is towards the right-hand side of the screen, however, this is because the end point is fixed and it goes outside of the edge of the viewport, How can I keep this angle exactly the same AND keep the end point no further to the right than the viewport?

• Is mirrored

->trigger once

-->set ray angle to 225

else

->trigger once

-->set ray angle to 315

Im still not worried about finding the point where the ray meets the viewport.

It does nothing for game play, and has no negative impact.

• Is mirrored

->trigger once

-->set ray angle to 225

else

->trigger once

-->set ray angle to 315

Im still not worried about finding the point where the ray meets the viewport.

It does nothing for game play, and has no negative impact.

It will because otherwise you'll be able to shoot stuff out of range of the viewport, unless I make yet another test to only be able to shoot stuff within the viewport, regardless of the rays length. I can't just set the ray angle though, I have to manually set the X/Y on both points, and it screws up the height if I try to keep it within the range of the viewport?

• You should really get a deeper understanding of how the ray casting plug works before you continue.

• You should really get a deeper understanding of how the ray casting plug works before you continue.

I know, it tests for obstacles between two points, I guess I'm trying to figure out how to apply an angle and a length to two points, rather than anything specifically to do with raycasting.

• That is raycasting, specifically.

• That is raycasting, specifically.

Okay, to be more specific, can you modify my example to have the ray shoot at the same angle as this example and not exceed the viewport width?

• 48 posts