Jump to content
  • Advertisement
  • entries
  • comments
  • views

A C64 Game - Step 51

Sign in to follow this  


More cooperative hodge podge. An experimental feature, both players are needed to kill an enemy. Sam must hold the enemy, so Dean can shoot it.


To accomodate this the changes are quite simple:

First block the hurting of enemies when they are held by Sam:

          ldy SPRITE_HELD
          ldx SPRITE_ACTIVE,y
          lda IS_TYPE_ENEMY,x
          cmp #2
          bne .NormalHurtByForce

          ;in 2p mode?
          ;TODO - if only one player is left?
          lda GAME_MODE
          cmp #2
          bne .NormalHurtByForce

          ;no further action
          jmp .NoEnemyHeld

          ldx PARAM6

Then, when Dean's bullet hits, check if the play mode is 2 player, and the enemy is actually held by Sam:

          ;is two player enemy?
          ldy SPRITE_ACTIVE,x
          lda IS_TYPE_ENEMY,y
          cmp #2
          bne .HitEnemy

          ;in 2p mode?
          ;TODO - if only one player is left?
          lda GAME_MODE
          cmp #2
          bne .HitEnemy

          ldy SPRITE_HELD
          sty PARAM1
          cpx PARAM1
          beq .HitEnemy

          ;enemy would be hit, but is not held
          jmp .ShotDone


And obviously, when an enemy is hurt, release Sam's lock:

          lda SPRITE_HELD
          sta PARAM1
          dec PARAM1
          cpx PARAM1
          bne .NotHeldEnemy

          lda #0
          sta SPRITE_HELD


As you can see, there're still TODOs left. Also, if 2 player mode makes this behaviour general or only for special enemies is yet to be decided.


Previous Step Next Step

Sign in to follow this  


Recommended Comments

There are no comments to display.

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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!