TO LOAD THIS PICO-8 CART, in immediate mode, type:
Demonstrating how to have a quick and easy to code field of vision without using a bunch of CPU processing or even complex code.
VVhat's new ?
Added cpu meter to show how quickly the scans are made. Notice they are < 1% CPU total.
Allowed ability of being able to hide behind enemies.
Changed the color of passive enemies to dark blue.
Distance by default is disregarded. To enable distance check, press the ❎ key. Again to swap.
Made walls to be drawn more intelligently where there is always an opening.
Improved the engine efficiency by checking the distance to the target first only using a search when the distance has been met.
- Sped-up the player's movement slightly by adjusting the key repeat.
Use the arrow keys to navigate.
Press 🅾️ to swap between seeing the enemies only if they see you or not.
Press ❎ to enable distance, again to disregard which is the default.
You can travel freely through the walls.
Note that the enemies cannot see you through a wall even if it is very close to them. This is being done by tracking each enemy to the player to see if an obstacle is in the way. If it is like a wall then the enemy cannot see you.
What other simple methods can you use to have a player not be seen by an enemy if there is an obstacle in the way ?
[Please log in to post a comment]