Is there a way to visually display line of sight?

0 favourites
  • 4 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Like a beam that adjusts it self if something is put between the beam emitter and its target.

  • Just stretch a sprite.

    set width to distance(x1,y1,x2,y2)

    Sprite set angle to angle(x1,y1,x2,y2)

  • This is a rough hack on top of my old CustomLOS example, but here is a Visible Beam that runs fairly quick <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile"> https://dl.dropboxusercontent.com/u/471 ... eBeam.capx

    The red LOSCheck object is much wider than the visible beam, so maybe decrease the height of the LOSCheck for the visible beam to look more accurate!

    For more optimizing you could also do this:

    Instead of checking every X milliseconds maybe do a function or sub-event that runs when the map has changed/moved that has each BadGuy object spawn a single check bullet.

    However, the spawning of more bullets does help though if you want to increase the speed bullets travel at, since sometimes they will miss a collision in their movement. Increasing bullet size helps combat the missed collisions. I don't remember but I thought the C2 Rain demo had a laser that simulates instant-hit as well, or maybe I'm again remembering a CC example.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks guys, was sketching on a game where something like this would be nice. Will make sure to try you suggestions when I start building it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)