Advertisement Jump to content
  • Advertisement
  • entries
  • comments
  • views

A C64 Game - Step 52

Sign in to follow this  


To make spawning enemies a bit more player friendly spawns are now shown before the enemy actually appears.


The way to implement this is quite simple. We've got a neat object system running already, so we make the spawn animation just another type.
Once the spawn life time is up the object is replaced in spot with the proper object type.

During a spawn point process we store the target type in SPRITE_ANNOYED (since spawns do not get annoyed):

          ;store spawn type in SPRITE_ANNOYED
          ldx PARAM7
          lda PARAM5
          sta SPRITE_ANNOYED,x

The spawns behaviour is straight forward, animate, count life time down and finally spawn the final object:

!zone BehaviourSpawn
          inc SPRITE_ANIM_DELAY,x
          lda SPRITE_ANIM_DELAY,x
          cmp #3
          beq .UpdateAnimation

          lda #0
          sta SPRITE_ANIM_DELAY,x

          lda SPRITE_POINTER_BASE,x
          eor #$01
          sta SPRITE_POINTER_BASE,x

          inc SPRITE_MOVE_POS,x
          lda SPRITE_MOVE_POS,x
          cmp #20
          beq .SpawnNow

          lda SPRITE_ANNOYED,x
          sta PARAM3
          lda SPRITE_CHAR_POS_X,x
          sta PARAM1
          lda SPRITE_CHAR_POS_Y,x
          sta PARAM2
          stx PARAM7
          lda #1
          jsr SpawnObject
          ldx PARAM7

The rest is too simple to show it here line by line, add new constants for the sprite, add the entry to the behaviour and hurt tables, add entries to the type start tables (color, sprite, etc.) and we're done.

And now the player is not killed by suddenly appearing enemies.

Previous Step Next Step

Sign in to follow this  


Recommended Comments

Thanks :)

Well, you can play it. Just grab any C64 emulator (Vice, CCS64, Hox, Frodo) and drop the .prg file onto it (or open it via the emulators attach media feature).

Share this comment

Link to comment
I like the idea of showing a spawn beforehand, I think this is one of those features that although small greatly improves "play-ability."

Share this comment

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!