4.5.9 Screen Flags for more AI actions

9Panzer

Well-known member
Alright I'm sure this is basic stuff for alot of you but I found this handy when I was pulling bits and pieces out of the forums.
So basically you have 15 AI actions/behaviors to pick from. When you are designing a game that has lots of bosses and unique monsters this gets eaten up pretty quickly. You need to et creative to utilize these as much as you can to maximize variety.

Each of my boss monsters have a unique ability they use that is independent of the regular monsters.
For example:

my first level boss "Mecha-Grokk" jumps and drops spikes from the ceiling:

My second Boss "Pugna" Shoots fireballs that drop gravity mid flight.

Well right there I have burned 2 of my 15 actions. Which sucks unless you want your game to be extremely short. Screen Flags is was a solution that seemed to work for me.
So first thing is first. Lets setup the screen flags!

1. Click on the little gear icon at the top of the menu bar. This is for you Project settings.

2.jpg

2. Now go down the list on Project Labels and change some values. I used the boss names to represent their rooms.
Pugna Boss Attack
Grokk Boss Attack
Spider Boss Attack

If you notice I choose the 9th, 10th and 11th entries. This is done deliberately and I'll explain why later.

3.jpg

3. now that the Screen Flags are setup we can select them in the screens screen info. So lets select Screen info which is located just above the tile assets.

Untitled-1.jpg

4. Remember how I set those 3 flags up as the 9th, 10th, and 11th? Thats so they would fall into the Screen Flags 2 listing. So with that in mind select whichever boss you are fighting on that screen. In my case it was my Pugna Boss fight. Lets check it off.

5.jpg

5. alright we have all the screen flags setup. So now we need to setup an AI action. I'm going to assume that you know how to setup an AI action. So I won't step through that. But you will want to use this script for the Action. I set this up as "BossAttack.asm"

LDA ScreenFlags01 ;Uses Screen Flags 2
AND #%10000000 ;Pugna Boss Fight
BEQ +
;;; Does whatever Pugna Does
+
LDA ScreenFlags01 ;Uses Screen Flags 2
AND #%01000000 ; Grokk Boss Fight
BEQ +
;;; Does whateverGrokk Does
+
LDA ScreenFlags01 ;Uses Screen Flags 2
AND #%00100000 ; Spider Boss Fight
BEQ +
;;; Does whatever Spiders Does (lol)
+
RTS

What this is doing is checking the screen flags and doing whatever you want based on the flag that is set. So If I'm running Pugnas screen flag then it will check it and go "Hey its Pugnas screen!" and it will run the action that is set. Doing things like this you could technically use screen flags in conjunction with AI_actions and really slim down how many actions you need.

I hope this helps someone :)
 
Top Bottom