How do I invert line of sight's cone of view?

0 favourites
  • 8 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • I am coordinating on a 2D platformer school project and just got a ton of 2D enemy sprites from my art dept. They're not facing in the desired direction to detect other sprites for ranged combat. I would normally just put them in a family and mirror them all. But this game has enemies spawn on the right side of the screen and move left, (and player spawn on left and move right) so mirroring them would make them all moonwalk.

    In short, is there a way I can invert the cone of view (i.e. make them see behind themselves) without having to go into a photo editor, invert all the images, reimport them, mirror them in Construct, and program the cone of view as designed? Or is there a way to 'trick' C3 into changing the angle/orientation without visually flipping the sprite? I have tried doing negative range and cone of view numbers like -200 and -80 but that's not worked.

    Thank you in advance!

  • Please see example. The enemies move left, and the sprite was drawn this way -- but the angle remains at default 0 degrees (otherwise the sprites would then face "backwards"). Need to make this enemy see what's "behind" it (even though it visually appears to be in front of it). I don't want to have too big a cone of view, otherwise it may attack unintended targets.

  • Try "Is overlapping at offset", or cast a ray using the Los behavior.

  • I'll share the project as well. drive.google.com/drive/folders/1WlHEzfFi5CKFX74r_EF4JJY8fnsj7Zhv

    newt Okay thanks. Can the ray cast backward/negative?

  • Its by xy to xy. You're checking to see if a line is intercepted.

    If you wish to use player.x-32, then that will work.

    There's a template from the start page Raycast reflections that should be helpful.

    In theory you can also make a dummy object with another Los behavior.

  • Okay thanks newt I'll try that! Collision by offset was a good temporary solution, only problem being that of course once the sprite moves out of that point of space the action stops. I'll look into the rays. Thanks

  • The best solution would be changing all graphics, to make sure that all images are at 0 degrees (facing right). You can easily do this in Construct, no need to re-import all sprites. In Animation Editor click "Mirror horizontally" icon while holding Shift key, this will mirror all frames in current animation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you everyone for your responses. dop2000 your solution worked great, was nice and easy. Thanks again!

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