How to disable input when game object is present?

Post Reply
User avatar
Razzie.P
Posts: 84
Joined: Thu Jun 13, 2019 3:51 am

How to disable input when game object is present?

Post by Razzie.P » Sun Jul 14, 2019 3:45 am

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: Select all

    ;; 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!
User avatar
dale_coop
Posts: 4473
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: How to disable input when game object is present?

Post by dale_coop » Mon Jul 15, 2019 2:11 pm

You could check if the Player is active... and if not you skip the code.
Something like that:

Code: Select all

	LDX player1_object
	LDA Object_status,x
	AND #OBJECT_IS_ACTIVE
	BNE +
	;; if NOT active then:
	;;JMP endOfTheScript
	RTS
	+
	;; continue the script as usual :
	
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
Razzie.P
Posts: 84
Joined: Thu Jun 13, 2019 3:51 am

Re: How to disable input when game object is present?

Post by Razzie.P » Tue Jul 16, 2019 1:39 am

Woo hoo! Thank you!

That knocks another bug/issue off the list :P
Post Reply