Can you walk through what the Spawn enemy function is doing and how it works? I see, for example, goon - On created, set skinID to self. UID then calls a function spawn enemy.
The function looks like it chooses the enemyskin and sets a hit box to the size of the enemy? Is that correct? I'm sorry I'm still learning and instances and UIDs are confusing to me.
Yup this is all correct :) The reason why I set the skinID to UID instead of just using UID is because in the past with other games I would always run into some sort of issue (like creating holograms of an original unit that all share one health pool), so now from habit I always have some sort of ID variable so I can set as many objects as I like to one ID.
The reason I create hitboxes separate to the enemy even though they are the same size is again out of habit: in this game it doesn't change much as all, but even if I had another few hours I was going to start adding headshots and trimming back hitboxes, so there would be more hitboxes per enemy and all of different sizes.
But doing the system as it is allows you to very easily alter the game in the future by creating and pinning different hitboxes to different image points and tagging them with things such as 'head', 'leg', 'weapon', privates', etc. so that you can assign different damage/experience values for each part.
Also you might notice the timers are being created in an unusual way - this is because using the 'Timer' behaviour doesn't pick objects, so if multiple objects trigger their timer at the same time, it can cause some serious problems (this was one thing that set me back hours trying to debug!). And the reason the time is tracked on a sprite instead of something global like an array is simply because I made it into a module that I can cut and paste into new projects and you can't cntrl+A an array.
The reason bullets are 'created' instead of 'spawned' is that if you spawn an object, you can't change its angle immediately, you need to wait at least 1 tick, which causes all sort of problems. It's fine for a turret that is rotating 360 degrees, but for weapons that are being mirrored etc. it's much better to use the 'create' action. Lastly you might note some 'wait 0 seconds' actions in the bullet creation - this is because without it some things got wacky, like bullet sprites being pinned to the wrong dmgbox etc. I don't know why it works, just a solution someone shared waaaay back in the C2 days. The reason why setting the team ID before the 'wait' action though is that if a dmgbox spawned over an enemy and the ID was set after wait 0, it would not have changed teams on creation and therefore hit the wrong team.
That's most of the weird stuff about the enemy spawns, but if you have more questions ask away :)