🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

A C64 Game - Step 51

posted in New Old Things
Published May 12, 2012
Advertisement

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
          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

Previous Entry A C64 Game - Step 50
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement