Artix
New member
Greetings NESMaker,
You can make any game object spawn a monster with this action step...
What if you want to be able to spawn a bunch of monsters? Well, there are a limited number of those precious action steps. So one way of doing it... would be to peek at which monster is trying to spawn and change the id based on it.
Here is the code that I am using in ChronoKnight.
It does not let you spawn too many monsters (max of 4)
To copy/pasta this, you will need to add a tempArtix variable to your Zero Page Ram in the settings of your project.
This code was modified from the code Dale Coop helped me make for Dungeons & DoomKnights a while back. Also, thanks to CutterCross for helping me work out a bug that I could not spot on Discord. <3 this community.
You can make any game object spawn a monster with this action step...
Code:
;; SPAWN A MONSTER
LDA Object_x_hi,x ;; X location
STA temp1
LDA Object_y_hi,x
STA temp2
;; The format is CreateObject x, y, object_type, action_step, name table
CreateObject temp1, temp2, tempArtix, #$00, currentNametable
What if you want to be able to spawn a bunch of monsters? Well, there are a limited number of those precious action steps. So one way of doing it... would be to peek at which monster is trying to spawn and change the id based on it.
Here is the code that I am using in ChronoKnight.
It does not let you spawn too many monsters (max of 4)
To copy/pasta this, you will need to add a tempArtix variable to your Zero Page Ram in the settings of your project.
Code:
;; Spawn a new Monster AI Step
CountObjects #%00001000
CMP #$04 ;; Max of 4 Monsters to prevent slowdown
BCS NoSpawnTooMany
;; Set a default monster just in case
LDA #14 ;; Explosion
STA tempArtix
LDA Object_type ;; See which monster is trying to spawn something
CMP #21 ;; Snek Spawner
BNE+
;; Create Snek
LDA #20
STA tempArtix
JMP SpawnAMonster
+
LDA Object_type ;; See which monster is trying to spawn something
CMP #23 ;; Bat Spawner
BNE+
;; Create Bat
LDA #16
STA tempArtix
JMP SpawnAMonster
+
;; OK, time to spawn
SpawnAMonster:
;; Store the Center in temp1 and temp2
LDA Object_x_hi,x
STA temp1
LDA Object_y_hi,x
STA temp2
CreateObject temp1, temp2, tempArtix, #$00, currentNametable
NoSpawnTooMany:
This code was modified from the code Dale Coop helped me make for Dungeons & DoomKnights a while back. Also, thanks to CutterCross for helping me work out a bug that I could not spot on Discord. <3 this community.
Last edited by a moderator: