#trying to think of best way to handle enemy waves

1 messages · Page 1 of 1 (latest)

onyx bane
#

i have a trigger object, when you enter it. The camera locks in place. And there's collisions around so you're stuck in the view.

And i want enemies to spawn in from both sides, you have to defeat, when they're all defeated, the camera unlocks and you can leave.

Im just wondering how i should handle it best, there could be multiple waves, and i need to control where exactly where they can spawn from, and what exact enemies it is

onyx bane
#

i need it to be a thing i can reuse in multiple places. Like a thing i can place in a level with instance variables, and or i edit it's creation code

#

also thinking if there's unique cases, like instead of enemies just walking in from left or right, there's unique cases or animations to have them appear. How i'd even handle that

brisk grove
#

No idea if this is the best way, but the way I handle it is I place invisible spawner objects that have a variable definition for which object they spawn

#

As well as a variable for which wave they are

onyx bane
#

maybe i should break it up into several components somehow

#

like there's an object that tracks enemies, and triggers when they're all gone

#

and some that spawn specific enemies

brisk grove
#

my system at least is split into three objects, the spawners, an object that triggers the battle when the player touches it, and the wave manager which also is the size of the battle room, though for me I have varying sizes of battle rooms so you could merge the trigger object and the manager if it's a set size

onyx bane
#

i also have to make a way they actually enter, since there's walls on either side so you're locked in

#

though since i have different collision layers in my game i can probably use that to my advantage!

brisk grove
#

oh right, I actually have door spawners too that spawn in the blocking doors

onyx bane
#

maybe i can change enemy code slightly, so i can make any enemy go to a specific location before continuing normal ai

brisk grove
#

and then I put the trigger far enough into the room that the player won't ever be inside the door when it spawns

onyx bane
#

so when they spawn i'll ask them to go into room, and after, they're locked in, they fight normally

#

maybe could be way more modular. Like i have one big object around the "arena" that just checks if there's any enemies in it

#

and then some wave object, can check if they're all clear before doing the next wave

brisk grove
#

yeah that's what my wave manager object does

onyx bane
#

or i guess that part could be one single object

brisk grove
#

it tells the spawners with the appropriate wave value when to go

onyx bane
#

and yeah spawn locations, that the wave manager refers to

brisk grove
#

you could in theory do it fully data based but I like being able to lay it all out in the room instead of needing to type coordinates

onyx bane
#

yes me too, as much as possible

#

im thinking of also having some kinda of turret enemies. Idk if stuff like that should actually spawn or they just plop up from the ground, and if so, how i'd be able to actually track it

brisk grove
#

lemme check my actual code

#

ah looks like I have a state machine for it

onyx bane
#

spawning of enemies, should probably also be kinda sequential. I think the best and easiest way to handle managing that, is probably editing creation code within room editor. Otherwise i'd have to have so many different instance variables for controlling the waves