Zebbi's Forum Posts

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

  • Try Construct 3

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

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

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

  • What do you think, newt ?

  • EDIT: Fixed links!

    Okay, here's what I have so far, and it's terrible: https://www.dropbox.com/s/g61zuyo6gggk3 ... .capx?dl=0

    Here's the raycaster plugin: https://dl.dropboxusercontent.com/u/207 ... ce.c2addon

    This is the original game and it runs in the browser, so if you'd like to compare where his fires, here it is: https://archive.org/details/msdos_Dange ... nsion_1991

    I just can't quite work out how far to send the beam, since it shouldn't really go any further than the viewport, and the angle height is difficult to get right depending on how close to the edges you are, in my example, it doesn't work for the top of the level, the angle turns into a hard horizontal line.

  • Actually, if have a different code set if the player is mirrored, so it would switch to being half again outside the left side of the screen. But thinking about what you're saying, I can't think of a reason that wouldn't work! I just had this idea it would require something more technical, but I think if this works I'll be more embarrassed than I've ever been embarrassed before! Let me see...