• entries
    104
  • comments
    101
  • views
    255306

A C64 Game - Step 51

Sign in to follow this  
Endurion

1852 views

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.

step51.png

To accomodate this the changes are quite simple:

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

          ldy SPRITE_HELD
          dey
          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


.NormalHurtByForce
          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
          dey
          sty PARAM1
          cpx PARAM1
          beq .HitEnemy

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

.HitEnemy 


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

.NotHeldEnemy 


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.

step51.zip

Previous Step Next Step

Sign in to follow this  


0 Comments


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