How to disable input when game object is present?

Razzie.P

Member
Using the maze module, I added a script to allow the player to shoot, stolen from the shooter tutorial and tweaked a bit. When I collect all prizes in a level the Victory Object plays for a few frames, then the game warps to the next screen. Normal stuff so far -- but during the Voctory Object, the game still recognize my input for shooting, and will create the projectile object, which, causes the game to glitch out in a few different ways. Hud breaks. Reset code doesn't work. Death object freezes. All kinds of craziness. So I was trying to figure out how to disable those inputs when the Victory Object is present.

Game Object - PlayerVictory
In Constants, it's OBJ_PLAYER_VICTORY , with a value of 10

Looking through the script, it seems I need to do something like this, but I'm not sure what numbers to plug in and what variable to use.

Code:
    ;; We check for Player Victory Object to see if we can shoot
    CountObjects #%00000100, #$00   ;; count victory object somehow
    LDA someVariableHere      ;; the variable used to count is something?
    CLC
    CMP #$00        ;; compare to 1
    BCC +           ;; if less than 1 on screen we can create a projectile
    RTS         ;; else we quit   
    +
    ;; else, the script continues:

Thanks in advance for any help!
 

dale_coop

Moderator
Staff member
You could check if the Player is active... and if not you skip the code.
Something like that:
Code:
	LDX player1_object
	LDA Object_status,x
	AND #OBJECT_IS_ACTIVE
	BNE +
	;; if NOT active then:
	;;JMP endOfTheScript
	RTS
	+
	;; continue the script as usual :
 
Top Bottom