Problem description:
Let's get this out the way, the game is a side-scroller, so the map transitions in a different way, like to go from above ground into a sewer you press like enter/space or something. How would i achieve that.
Next, let's say I want a zombie to chase me from map to map, until either it's A. Killed or B. Distracted by something else(another player & sound)
and if so how would I go about doing it without destroying my CPU usage. I was thinking maybe an active/inactive variable for a car , like lets say the alarm variable is active on a car, so the zombies get drawn to it until the alarm variable is inactive then they go back to normal business.
I'm a beginner programmer, like I can do maps but I just wanted a general idea in the direction I should take for these types of things, or if someone can start me off with a bit of side notes
//yo
You need a root level, basic behavior. This behavior roams, chills out, or whatever else the zombie does without any special conditions.
After that, implement the checks for the special condition. Is prey in range of the zombie? Pursue the closest candidate. Prey can be whatever you design it to be, so I'd probably have a separate proc for checking that.
Now, findPrey() can narrow things down as much as you like. Notice how I typecasted prey to be /atom/movable, so that it can prey on both mobs and objs.
In pursuePrey(), simply order it to approach whatever it's after. Each time behavior() loops around, it'll re-adjust it's prey and pursue it then.
Hope this helps guide you. :)