Zebbi's Recent Forum Activity

  • Are you trying to do some sort of laser sight?

    I guess so, it's so it's like using an invisible bullet, but instantaneous, plus I can have bullets ricochet off surfaces, but since the end of the trace is absolute, i can't get a 45 degree angle to stay consistent. Is there some sort of trigonometry that sets the distance according to angle or something?

  • I don't know what you need an angle for.

    All the shoot event would care about is if there was a target within range, if that target was above or below the player, and if it has a clear shot to it.

    Im not even sure it needs to have a clear shot in the video.

    Now if you want to have more frames for more angles, you would check if the y was in multiple places like player y though player y + 32 would be one level above the player, and player y+32 though player y+ 64 would be 2 above the player, and you would change frames according to that.

    Note: I say frames, unless you want to do a multi-image sprite like in Spriter, then you would use the angle(player.x,player.y,badguy.x,badguy.y)

    Yeah, I just need the angle to work out what's in the way of fire: https://www.dropbox.com/s/nydz7dk0le6l9 ... .capx?dl=0

    This unfortunately isn't a fixed angle, it changes depending on how close to the edge of the viewport you are. Any ideas how to fix this at a 45 degree? Then the trace will be perfect, I'm not sure if the foreach loop is efficient enough, shame system expressions like distance can't work per instance.

  • Here's one working with distance, I had to use a for each loop, is that okay? https://www.dropbox.com/s/x1fz2zfmm86q0 ... .capx?dl=0

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

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

  • I made a guide <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    https://shatter-box.com/knowledgebase/i ... nstruct-2/

    If you are missing something, let me know.

    Regards

    Andy

    That's the one! Does this guide cover the newer webview export?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Is there an updated guide for compiling a game with xdk? It's been a year since I tried it and I'm happy to build for the future and skip crosswalks bloat in favour of webview to target 5.0+ android versions. With cocoon I only used Adsense and leaderboards, and I bought cranberrys but never used them. The old shutter box guide is down now, is there one I could follow that's up to date?

  • Yeah, but this is quite cool if you don't want to do that for every edge, unless there's a big downside to using this method (other than two detectors per enemy)?

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

  • Sorry, the gif is too wide to display properly: https://s28.postimg.org/vqpowx6ot/stev.gif

    and: https://s27.postimg.org/fw3fosfv7/stevex.jpg

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

  • I'll do something with the platform template .

    Thank you!

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