[C2]Enemy: Line of Sight

0 favourites
  • 13 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • Hey, Dcrew here!

    Just wanted to show off a creation here. (PM me if you wonder how it's done)

    <img src="http://screensnapr.com/e/kckaAB.png" border="0">

    The line is always between the Player and Enemy (can have as many enemies as you want) and set's the line's width to the distance between the Player and Enemy and set's the angle towards the Player and it's position at the Enemy.

    When the Line touches obstacles or walls or (anything you want really) it turns Red. thus meaning it cannot see you! But when it's green it can see you, thus making it aim at you and see-ing you!

    I think this is a really good idea for enemy AI in games and will go great with Pathfinding :D

    Thanks!

    Click here to Download the Source file <font color="red">(Main)</font>

    Click here to Download the Source file <font color="blue">(Mirror)</font>

  • You should post the cap and/or exe.

    Edit: I edited the topic name to state it is for C2.

  • You should post the cap and/or exe.

    Updated first post with download links!

  • This is great, and would probably work with platform type environment with a little tweak... would it be simple to add restrictions to the angle the line is able to move? ie... restrict the enemy's field of view?

    I'll try fiddling to see what can be done.

  • plauk, it would probably be easier to add conditions to when you are seen rather than restrict the line's movement. I'm using a similar system for my game, and though I'm not up to that part yet, I've given it a lot of thought and that seems to be the way to go.

  • plauk It would be super easy to do that. Just make it so the line will only go green (it can only spot player) if the distance between the two are below 400 (or w/e you want)

  • Your the man ^_^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wow very nice, i need this solution for my game. Thank yuo

  • dcrew ..thanks for this man.

    Improved parts of it and added range calculations and stuff.

    Hope it helps someone looking for such

    Tutorials - enemy-ai-for-range-of-fire-and-line-of-sight-top-down-player

  • Thank you my friend.

  • Its great ,

    I have a query how to create listing or grade of the gaming or I means to say how to create list of level's such as 1,2,3 etc for eg. h t t p: // w w w. innobrik.com/hanuman/hanuman.html

    after click the start button you get the list page right now it show 1 (level 1) and other are locked after win the level 1 first you get level 2 and in the list page second level locked has been removed.

    How to create it any idea.

  • sorry it seems i dont have this behavior in my construct.how did you get it? how is it done? if it a plug-in how did you install it? please teach me,am really new in this.thank you very much :)

  • sorry it seems i dont have this behavior in my construct.how did you get it? how is it done? if it a plug-in how did you install it? please teach me,am really new in this.thank you very much :)

    I've been away at college for long, so sorry I've not had the time to visit the sites I love and reply to others.

    I'm sure you've probably figured this out by now so I'm not sure I'll be much use by now, sorry but if not feel free to private message me. Also this did not use a plugin, download the source of the game provided in the link given in the very first post and see for yourself. =)

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