The Daily Click ::. Forums ::. Klik Coding Help ::. AI coding help for top down shooter
 

Post Reply  Post Oekaki 
 

Posted By Message

M10



Registered
  23/01/2018 19:16:43
Points
  2
27th January, 2018 at 27/01/2018 22:00:16 -

Hi, I'm currently making a top down shooter game, and I have a basic AI already. I have an invisible object that is used as the enemy's sight, and if it hit's the player then it will make the enemy fire. This works fine, however, when one enemy sights the player, they all instantly know of his location. Is there any ways to get round this so that only the one that spotted him knows?


 
n/a

LordHannu

Crazy?

Registered
  22/04/2007
Points
  7910

VIP MemberStarTeddy BearRibbonGame of the Week Winner2021 Halloween Competition Winner2022 Hi-Score Mash-up Competition (Bronze)2023 Halloween Competition (Bronze)2023 Halloween Competition Entrant
28th January, 2018 at 28/01/2018 21:16:34 -

Hi!

Its good if you have an example file to share. But i think i know what your after
I made an example file here: http://www.splattersoft.com/TB/DC/SightExample.mfa

Image


Edited by LordHannu

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
29th January, 2018 at 29/01/2018 17:23:20 -

Fusion has something called object scope that determines which object or group of objects an action applies to.

By default all instances of all objects are in the scope, so you need to narrow it down using conditions. The easiest is the alterable variable check. You can assign an ID to all enemies and then have the line of sight object share the same ID. When the line of sight overlaps the player narrow down the selected enemy by checking for the ID to match that of the enemy.

 
n/a

M10



Registered
  23/01/2018 19:16:43
Points
  2
29th January, 2018 at 29/01/2018 18:11:49 -

Thanks both of you! I'll try both methods and get back to you.

Edited by M10

 
n/a
   

Post Reply



 



Advertisement

Worth A Click