Zebbi's Recent Forum Activity

  • I believe this is a bug, I can shoot with space, run to the left and aim up in other games, I can't see why C2 games would be any different?

  • Nope.

    Well, then what do you suggest?

  • 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?

  • 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.

  • 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?

  • On second thought. I can not wrap my mind on that question. What you do/want is this (illustrated) :

    We stand on the side of a loch. You say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    I take look at the map. Loch Lomond. Loch Morar. Loch Ness. That is gonna be a serious walk.

    After 3 hours, i am there. Now you say, jump into the water to where i said that you should end the journey. So, i jump.

    But now i am wet. So i stand there in the water.

    Now you say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    Eh? I should have taken a boat. But then i have to avoid land.

    1/ Of course. Use two tilemaps. 1 for the show. Erase the tile in the base tile map, set the tile in the show tilemap, find path, when path found, set the tile in the base tilemap, erase the tile in the show tilemap.

    2/ Yeah, do as above, find path to mouse.X and mouse.Y

    But that is not gonna work for tiles that are surrounded with other tiles. Because they are obstacles. I have no idea if you have surrounded tiles. So you need 3 tilemaps.

    1 to mark the border tiles, leaving the surrounded tiles errased, use that as obstacle map.

    1 to fill the surrounded tiles.

    1 as a temporary to move tiles, that are obstacles but that you dont want to be obstacles, to. And back again.

    Alternative, once they reach the second last index of the points in the calculated path, just move them to the stored mouseX/mouseY

    But that is so way off from what you wanted in the first place.

    So, or adjust the tilemap so a path can be found. Or, make the last move a straight move to the mouse.

    I think the most effective thing would be to, as you suggest, make a straight move to the mouse, but I don't know how to condition if the player is already on the tile. Obstacles won't be much of a problem I don't think because it only seems to care about the origin point, but it would be fun to see if the player gets stuck or not, I just don't know how to try this.

  • With a tilemap based pathfinder ? I dont see it.

    So, two questions:

    • Is it possible to find a path to the tile clicked + the extact position on the tile that has been clicekd for greater accuracy

    If not, then/if so, also:

    • If the player is already at the tile clicked, can we use this to do a non pathfinding MoveTo the pixel clicked on the tile?
  • 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?

  • 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?

  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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?

  • 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?

Zebbi's avatar

Zebbi

Member since 20 Jan, 2014

None one is following Zebbi yet!

Connect with Zebbi

Trophy Case

  • 10-Year Club
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

12/44
How to earn trophies