There exists no example of working platform AI as far as I know. I have combed through the threads and articles here with no such luck. I only want something basic. Each enemy has a set area where they walk back and forth, stopping occasionally. When the player is in their range of sight, they will walk in the direction of the player. If they reach the end of their patrol zone, they should stop and look in the direction of the player. If the player returns to their area, they will again walk in the direction of the player, otherwise continue their patrol. Thus far, I have had no luck with making this work. I am new to fastloops and spread values and am not sure how properly implement them. I can get each enemy to have their own hitbox and detectors of sight(not the best way, I know) but no matter how many exceptions I put in, enemies always do the same thing no matter if the player is next to them or not. Does anyone have any simple platform AI example? I imagine this is one of the simplest platform AI you could put in a game as the enemies do not need to track the player outside their own area.
Spread value 1 in alterable value A of enemy (this will ensure that only the enemy within range will be affected)
(alterable values are internal to each seperate instance of the same active which allows this to be possible)
Character/player is within range (use something like x of player > x of enemy -50 and x of player < x of enemy + 50 to find the range)
and Enemy is within range of character/player (x of enemy > x of player -50 and x of enemy < x of player + 50)
---> Set alterable value A of character/player to the alterable value A of enemy
If Alterable Value A of enemy = Alterable Value of character/player
and Alterable Value A of character/player = Alterable Value A of enemy
---> Set enemy attack sequence into motion
Of course you'll need to figure out the simple moving the enemy back and forth AI, or whatever sort of initial walking the rounds guard duty type movement you want before adding the above events.
(the reason that I've included things that may seem redundant btw, is in hopes that it makes it specific enough to work without flaw)
This is all only a guess of course because I have not tested it myself having not ventured into the realm of AI yet.
To me AI seems like it could be fun though, and not difficult until you get into advanced features and crazy mathematics.
Like I said though, this is coming from a simple logical guess as to how it may work, so it could fail, just gotta try it in order to see I guess.
If it doesn't work with all those events, try deleting some and/or switching things around a bit, sometimes that helps.
Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?