I finally managed to modify the code, to make it work for my game.
In my case, I want normal key pickups that trigger the screen / unlock doors: which is the normal (current) behavior.
And I want some collectible pickups that don’t trigger the screen nor unlock doors, I want that pickups that just increase some variable (score, or money, or rubies, or ammo, ...)
What I do, is using "health" property of pickup objects, to do the difference.
If the pickup object has no health set, I consider it's a normal key lock pickup. And if there is health set (more than 0), I consider it's a collectible.
This is the script before (as you might have it) :
Code:
otherIsNotAMonsterTypeCollision:
LDA ObjectFlags,y
AND #%00100000 ;; is it a 'collectable'?
BEQ otherIsNotAcollectable
;;;; IS A pickup / power up
DeactivateCurrentObject ;; makes the other object go away
;; since other object is loaded in X
;;=========== WHAT DO YOU WANT TO HAVE HAPPEN WHEN YOU COLLECT THIS ITEM?
;;;;;;;ADD TO SCORE:
AddValue #$05, GLOBAL_Player1_Score, #$01
LDA DrawHudBytes
ORA HUD_updateScore
STA DrawHudBytes
;;;;;;;;;;;;;;;;;;;;;
;; JSR HandlePlayerPowerUp
JSR countAllTargets
And this is the code after my modifications :
Code:
otherIsNotAMonsterTypeCollision:
LDA ObjectFlags,y
AND #%00100000 ;; is it a 'collectable'?
BEQ otherIsNotAcollectable
;;;; IS A pickup / power up
DeactivateCurrentObject ;; makes the other object go away
;; since other object is loaded in X
;;=========== WHAT DO YOU WANT TO HAVE HAPPEN WHEN YOU COLLECT THIS ITEM?
LDA Object_health,x ;; check the value of "health"
;; if zero it's a normal key lock pickup
BEQ continueOtherIsNotAMonsterTypeCollision
;; if different than zero, it's a collectible pickup
;;;;;;;ADD TO SCORE:
AddValue #$05, GLOBAL_Player1_Score, #$01
LDA DrawHudBytes
ORA HUD_updateScore
STA DrawHudBytes
JMP doneWithThisObjectCollision
;;;;;;;;;;;;;;;;;;;;;
;; JSR HandlePlayerPowerUp
continueOtherIsNotAMonsterTypeCollision:
JSR countAllTargets
It's an early code, in this exemple, the collectible just increase the SCORE. Now I will use it to charge the weapon of my player (maybe with the value set in the health property).
If you have suggestions, comments, I'd happy to hear
thank you