Jump to content
  • Advertisement
  • entries
    104
  • comments
    102
  • views
    260202

A C64 Game - Step 94

Sign in to follow this  
Endurion

1652 views

Now we have a real two player coop mode. It's not both players playing by themselves, but true teamwork. Sam needs to capture, and only then Dean can shoot enemies.

step94.png

To makes things easier we add a new flag to check if two player mode is active (TWO_PLAYER_MODE_ACTIVE):

          ;set two player mode active flag 
          lda #0 
          sta TWO_PLAYER_MODE_ACTIVE 
          lda GAME_MODE 
          cmp #GT_COOP 
          bne + 
          
          inc TWO_PLAYER_MODE_ACTIVE
          
+


Remove the flag if one of the player dies on his last life:

.OtherPlayerStillAlive 
          ;remove 2 player active flag 
          lda #0 
          sta TWO_PLAYER_MODE_ACTIVE 
          jsr RemoveObject 
          rts


If Sam is firing away and the enemy would be hurt, we bail out if our flag is set. The flag set means having a value of 0. So beq actually checks if it is not set:

          ;Sam needs to keep pressed 
          jsr RedrawForceBeam 
          
          ldy SPRITE_HELD 
          dey 
          ldx SPRITE_ACTIVE,y 
          lda IS_TYPE_ENEMY,x 
          cmp #1 
          bne .NormalHurtByForce 
          
          ;in 2p mode? 
          lda TWO_PLAYER_MODE_ACTIVE 
          beq .NormalHurtByForce 
          
          ;no further action 
          jmp .NoEnemyHeld 
          
.NormalHurtByForce


In Deans shot routine we check if the enemy is held, if not bail out:

.EnemyHit 
          ;enemy hit! 
          ;is two player enemy? 
          ldy SPRITE_ACTIVE,x 
          lda IS_TYPE_ENEMY,y 
          cmp #1 
          bne .HitEnemy 
          
          ;in 2p mode? 
          lda TWO_PLAYER_MODE_ACTIVE 
          beq .HitEnemy 
          
          ;is the player held? 
          ldy SPRITE_HELD 
          dey 
          sty PARAM1 
          cpx PARAM1 
          beq .HitEnemy 
          
          ;enemy would be hit, but is not held 
          jmp .ShotDone 
          
.HitEnemy 


Simple addon, but bound to get complicated :)

step94.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
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!