Disabling attack while jumping...?

Icon-Ninja

New member
This may have been covered elsewhere, but I've been out of the loop for the past several months due to work, and I'm finally getting back to my projects, but I'm having trouble disabling the player character's attack while airborne (working in 4.1.5 at the moment). I just want the player to be unable to attack unless their feet are on the ground. I know there's a check for PlayerIsNotInAir but how do I properly add it to the attack script(s)? I'm currently using the create_melee_weapon (to render the character's attack anim; basically made the "weapon" look like the character to address some animation needs) and the create_projectile_platformer scripts for my attack.
 

MistSonata

Moderator
It's been a while, so I could be wrong, but as far as I remember the flag for touching the ground is in bit 5 of Object_vulnerability.

Try writing the this code near the top of the scripts just below the line "LDX player1_object":

Code:
	LDA Object_vulnerability, x
	AND #%0010000 ;; this checks bit 5 of the variable we just loaded
	BNE + ;; if bit 5 is set, it means they're on the ground, so skip to the "+" to bypass the RTS
	RTS ;; otherwise bit 5 is NOT set, meaning they're in the air, so RTS out of this code and don't execute it 
	+

Let me know if that works for you.
 

Icon-Ninja

New member
MistSonata said:
It's been a while, so I could be wrong, but as far as I remember the flag for touching the ground is in bit 5 of Object_vulnerability.

Try writing the this code near the top of the scripts just below the line "LDX player1_object":

Code:
	LDA Object_vulnerability, x
	AND #%0010000 ;; this checks bit 5 of the variable we just loaded
	BNE + ;; if bit 5 is set, it means they're on the ground, so skip to the "+" to bypass the RTS
	RTS ;; otherwise bit 5 is NOT set, meaning they're in the air, so RTS out of this code and don't execute it 
	+

Let me know if that works for you.

I tried your suggestion, but unfortunately that only seems to disable attacking altogether. Maybe the flag isn't in Object_vulnerability?
 

MistSonata

Moderator
I think they did change it. Try this instead:

Code:
        LDA Object_physics_byte,x
	AND #%00000001
	BNE +
	RTS 
	+
 
Top Bottom