Math lovers are here, your enemies are all robots !
I aggree with sqidders about the draw line/strech sprite method (I have speak about that in my first post men !) ... but i love the bullet method as bullets can take some time to move and so it's more easy for the player to hide before be seen ... the more time the enemy stay in line of view with player the more far the "view bullets" are fired ... this "view bullets" objects must be destroyed if enemy view change and can also be destroyed using a fade in time destroy behaviour to avoid using too many cpu. But don't say it take's always a lot of cpu !!! ... shooting invisible bullets or shooting "real" bullets it's near the same for the game ... same objects ... some are invisible others not ... so if your game can not handle this, it can not handle many enemies shooting at the same time so it's a good way to know if your game will be playable or not ! naelian2012-05-24 23:55:48
Yes i'm suggesting firing some invisible bullets every X from the enemy toward the player ... not something really different than drawing a line but a bullet "dash" line with speed effect and so less effectiveness :
In a game such as Splinter Cell some elements such as darkness, or player stealth mode are important to make a difference between "in line of sight" and "seen", it's not just a simple delay. By using a bullet mode you can adjust speed of bullets, bullets size and life time according to darkness and reduce player "shape" according to stealth mode. By doing this you give more "life" to the line of sight system and integrate a failure, it's not 100% effective such as humans behaviour !
How many times have you search something which was just in front of you ?
didnt find a working solution yet. i want the enemies also to view at the player only (angle) when there is no object of a specific family (BlockedObjects) between them. that makes it a bit harder to create the event group "sightCheck".
currently, i spawn invisible bullets for each enemy every 0.1 seconds, and set the angle of the bullet manually towards the player. then i set the angle of the enemy towards the player, only when he is hit by the invisible bullets spawned by the specific enemy.
anyway, this does only work when the player is overlapping an enemy. no idea why.
the invisible bullets are destroyed on BlockedObjects and outside screen. i cant recognize a real performance decrease.
do you have an idea how to solute this, maybe a capx?