mouse spirit
Well-known member
Welcome. I have been working on making a jump attack(not difficult) with a matching jump attack animation(tougher) without
using up an extra action(also crouching) .This post is mostly about the animations.This assumes that you have an object melee weapon script
already and a projectile object using projectile source but could be adapted for other things.
My game uses controls sort of like a ninja gaiden .Crouch,upB projectile,melee,jumping,and so on.
Edit: I have this all working great for my game. Animations show up how they should
and my melee weapon stay with my character. Ive edited these scripts and reposted them here.I will start to comment them
and update this post again.
Also in my Game Object Player , i made my up-right and up-left melee state animations to my newly made jumping left and right attack animations.
I have a jump animation in upright and upleft in my idle state.Ducking animations in downright downleft in idle.Duck attacking animations in downright downleft in melee state.
The crux of this code is using those diagonal animations to then avoid having to use up an action for something like crouching or crouching attack or jump attack.
You will see in my code that there are other added pieces such as a JMP or blahblah:.You will have to adapt it to your code but i can help if you need any.
Lastly,this may not be the best way to do this. This is the way that i have come up with that seems to do what i want the best, so far.
Here are the input scripts i altered.
I do not advise just copying them and pasting.These are here to help you understand what i did which may
help you greatly or hopefully atleast a little bit, but they have other edits for my personal game which may cause issues for yours.
They may need adapting to your script.That being said, certainly use these how you like.Much thanks to dale_coop and others.
Some of these scripts are not needed but i thought just incase someone wants to see those others scripts,here they are.
startmovingright asm
Code:
LDA isPaused
BEQ +
RTS
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE +
JMP ++
+
LDA gamepad
CMP #%00000010
BEQ end4
CMP #%10010010
BEQ end4
++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA gameHandler
AND #%00100000
BEQ++
ChangeObjectState #$00 , #$02
RTS
++
LDX player1_object
;;;;; this is for platform game.
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
CMP #$01
BEQ +
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ +
ChangeObjectState #$01, #$04
JMP +
;;;;;;;;;;;; END PLATFORM TYPE GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
end4:
JMP end1
+
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE +
StartMoving player1_object, MOVE_RIGHT
FaceDirection player1_object, FACE_UP_RIGHT
JMP++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
StartMoving player1_object, MOVE_RIGHT
FaceDirection player1_object, FACE_RIGHT
++
end1:
RTS
startmovingleft asm
Code:
LDA isPaused
BEQ +
RTS
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE +
JMP ++
+
LDA gamepad
CMP #%00000010
BEQ end2
CMP #%01010010
BEQ end2
++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA gameHandler
AND #%00100000
BEQ++
ChangeObjectState #$00 , #$02
RTS
++
LDX player1_object
;;;;; this is for platform game.
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
CMP #$01
BEQ +
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ +
ChangeObjectState #$01, #$04
JMP +
;;;;;;;;;;;; END PLATFORM TYPE GAME
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
end2:
JMP end3
+
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE +
StartMoving player1_object, MOVE_LEFT
FaceDirection player1_object, FACE_UP_LEFT
JMP++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
StartMoving player1_object, MOVE_LEFT
FaceDirection player1_object, FACE_LEFT
++
end3:
RTS
I edited these scripts to say when on ground or not,when pressing or not (my button combos for projectile(up b, up right b, up left b) or melee (none of that and b))
if in air , do UPRIGHT or UPLEFT attack animation.If on ground, do just RIGHT or LEFT attack animation. Stuff like that.
createobjectmelee asm
Code:
LDA isPaused
BEQ +
RTS
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE try2
LDA Object_movement,x
AND #%00000111
CMP #%00000110 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_UP_LEFT
JMP+
++
CMP #%00000010 ;;facing right?
BNE +
FaceDirection player1_object, FACE_UP_RIGHT
+
try2:
LDA Object_movement,x
AND #%00000111
CMP #%00000110 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_LEFT
JMP+
++
CMP #%00000010 ;;facing right?
BNE +
FaceDirection player1_object, FACE_RIGHT
+
LDA gamepad
AND #%00010010
CMP #%00010010
BNE goaheads
JMP +
goaheads:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA gameHandler
AND #%00100000
BEQ notNPCstate_attack
JMP doneAttacking
notNPCstate_attack:
LDA weaponsUnlocked
AND #%00000001
BNE canAttack
JMP doneAttacking
canAttack:
;notAlreadyAttacking:
;nowifonground:
LDX player1_object
GetCurrentActionType player1_object
CMP #$03
BNE notAlreadyAttacking1
JMP doneAttacking
;;;;;
notAlreadyAttacking1:
;;; don't attack if already attacking.
;;; do we have to check for hurt here?
;;;;; Here, we WOULD create melee
ChangeObjectState #$03, #$02
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ jumporground
;;;;;;
;;;;;;;;;;;;;;;;
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
;JMP goherenow
jumporground:
;;;;;;;;;;;;;;;;;;;
LDA Object_x_hi,x
STA temp
LDA Object_y_hi,x
STA temp1
;goherenow:
LDA Object_movement,x
AND #%00000111
STA temp2
TAY
LDA Object_x_hi,x
SEC
SBC #$10 ;; <<--- HERE, you have to set width of melee weapon in HEX (1 tile = 8px, 8 in decimal = #$08 in hex. Use the binary <-> hex converter plugin)
STA temp
LDA Object_scroll,x
SBC #$00
STA temp3
LDA temp
;;; offset x for creation
CLC
ADC weaponOffsetTableX,y
STA temp
LDA temp3
ADC #$00
STA temp3
LDA Object_y_hi,x
CLC
ADC weaponOffsetTableY,y
SEC
SBC #$08 ;; <<--- HERE, you have to set height of melee weapon in HEX (1 tile = 8px, 8 in decimal = #$08 in hex. Use the binary <-> hex converter plugin)
STA temp1
;;;;;;;;;;;;;;;;;
LDA which_weapon
CMP #$01
BEQ ++
JMP weap2
++
;;weap1
CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$00, temp3
JMP meleeCreated
weap2:
LDA which_weapon
CMP #$02
BEQ ++
JMP weap3
++
CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$01, temp3
JMP meleeCreated
weap3:
LDA which_weapon
CMP #$03
BEQ ++
JMP meleeCreated
++
CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$02, temp3
JMP meleeCreated
meleeCreated:
STX player1_weapon
;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
;;PlaySound #SND_SLASH
+
doneAttacking:
RTS
createprojectile asm
Code:
LDA isPaused
BEQ +
RTS
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE try1
LDA Object_movement,x
AND #%00000111
CMP #%00000110 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_UP_LEFT
JMP+
++
CMP #%00000010 ;;facing right?
BNE +
FaceDirection player1_object, FACE_UP_RIGHT
+
try1:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack/button combos allowed
LDA gamepad
CMP #%00010011
BEQ canShoot
CMP #%10010011
BEQ canShoot
CMP #%01010011
BEQ canShoot
LDA gamepad
CMP #%00010010
BEQ canShoot
CMP #%10010010
BEQ canShoot
CMP #%01010010
BEQ canShoot
JMP doneShooting
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
canShoot:
;; We count the projectile already on screen to see if can Shoot another one :
CountObjects #%00000100, #$00 ;; count player weapon on screen
LDA monsterCounter ;; the variable used to count is monsterCounter
CLC
CMP #PROJECTILE_MAX ;; compare to 2
BCC + ;; if less than 2 on screen we can create a projectile
RTS ;; else we quit
+
LDX player1_object
;;; check if already shooting
CMP #$06
BNE notAlreadyShooting
JMP wasAlreadyShooting
notAlreadyShooting
+
++
ChangeObjectState #$03 , #$02
;;;if you wanna stop player comment out next eight lines
LDY player1_object
CPY #$FF;;;;;
BNE playerCanCreateProjectile
RTS
playerCanCreateProjectile:
LDA limitProjectile
BNE continueCreateProjectile
RTS
continueCreateProjectile:
DEC limitProjectile
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ wasAlreadyShooting
LDA Object_movement,x
AND #%00001111
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x
; if was already shooting
wasAlreadyShooting:
LDA Object_movement,x
AND #%00000111
STA temp2
TAY
LDA Object_x_hi,x
SEC
SBC #$08 ;; width
STA temp
LDA Object_scroll,x
SBC #$00
STA temp3
LDA temp;;; offset x for creation
CLC
ADC projOffsetTableX,y
STA temp
LDA temp3
ADC #$00
STA temp3
LDA Object_y_hi,x
CLC
ADC projOffsetTableY,y
sec
sbc #$08 ;; height
STA temp1
;;test if player has weaponm 1
;LDA weaponsUnlocked
;AND #%00000001
;BEQ playerDoesNotHaveWeapon1
;else weapon 1 is now unlocked
;;test if player has weaponm 2
;LDA weaponsUnlocked
; AND #%00000010
;BEQ playerDoesNotHaveWeapon2
;else weapon 2is now unlocked
; continueCreatingTheProjectileObject:
CreateObject temp , temp1, #OBJECT_PLAYER_PROJECTILE, #$00, temp3
;;;;x is now the newly created objects x
LDA Object_movement,x
ORA temp2
STA Object_movement,x
LDY temp2
LDA directionTable,y
ORA Object_movement,x
STA Object_movement,x
;PlaySound #SND_SHOOT
++
doneShooting:
;DEC limitProjectile
RTS
pre draw asm
Code:
;; sprite pre-draw
;;; this will allow a user to draw sprites
;;; before object sprites are drawn.
;;; keep in mind, there are still only 64 sprites
;;; that can be drawn on a screen,
;;; and still only 8 per scan line!
;;; you can use DrawSprite macro directly using the following scheme:
;DrawSprite arg0, arg1, arg2, arg3, arg4
;arg0 = x
;arg1 = y
;arg2 = chr table value
;arg3 = attribute data
;arg3 = starting ram position
;; x and y are the direct positions on the screen in pixels.
;; chr table value is which sprite you'd like to draw from the ppu table.
;; attribute data is a binary number (starts with #%), and here are how the bits work:
;;; bit 7 - Flip sprite vertically
;;; bit 6 - Flip sprite horizontally
;;; bit 5 - priority (0 in front of background, 1 behind background)
;;; bit 4,3,2 - (null)
;;; bit 1,0 - subpalette used (00, 01, 10, 11)
;;; for starting ram position, use spriteOffset.
;; this is set to 0 just before entering this script (or 4 if sprite 0 hit was used).
;; ***remember to increase spriteOffset by 4 for every sprite that is drawn,
;; including after the last one drawn*****, so that the first object's sprite begins
;; in the next available spot.
;; I have created a macro function to handle updating to the next sprite. So, to update to the next sprite position,
;; all that you have to do is use the function UpdateSpritePointer
;;EXAMPLE:
; DrawSprite #$80, #$80, #$10, #%00000000, spriteOffset
; UpdateSpritePointer
;;;; DRAW SPRITE ZERO FOR SPRITE ZERO HIT
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
LDA gameState
CMP #GS_MainGame
BNE + ;dont draw sprite zero
;DrawSprite #$f8, #$1e, #$7F, #%00000000, spriteOffset
;248 30 127 bit 5 = priority
DrawSprite #SPRITE_ZERO_X, #SPRITE_ZERO_Y, #SPRITE_ZERO_INDEX, #%00100000, spriteOffset
UpdateSpritePointer
;dont draw sprite zero.
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
checkStartScreenSelector:
LDA update_screen_details
BNE endCheckingStartScreenSelector
;; is special screen:
LDA newScreen
CMP #$01
BEQ endCheckingStartScreenSelector
;; is START SCREEN:
;; positions selection:
LDA #SELECTION_POS_Y ;; coord Y position when selection mode is 0
STA temp1
LDA #SELECTION_POS_X
STA temp2 ;; coord X position of all selections
LDX #$00
startScreenSelectorLoop:
CPX curSelection
BCS +
LDA temp1
CLC
ADC #SELECTION_STEP_Y
STA temp1
LDA temp2
CLC
ADC #SELECTION_STEP_X
STA temp2
INX
JMP startScreenSelectorLoop
+
DrawSprite temp2, temp1, #STARTSCREEN_CURSOR_TILE, #%00000000, #$00
UpdateSpritePointer
;JMP endCheckingStartScreenSelector
endCheckingStartScreenSelector:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;pause stuff
LDA isPaused
BNE +
JMP isNotPaused
+
DrawSprite #$6C, #$78, #$70, #%00000001, spriteOffset
UpdateSpritePointer
DrawSprite #$76, #$78, #$71, #%00000001, spriteOffset
UpdateSpritePointer
DrawSprite #$80, #$78, #$72, #%00000001, spriteOffset
UpdateSpritePointer
DrawSprite #$8A, #$78, #$73, #%00000001, spriteOffset
UpdateSpritePointer
DrawSprite #$94, #$78, #$74, #%00000001, spriteOffset
UpdateSpritePointer
isNotPaused:
;; Nate's janky object parenting w/ melee weapon/ w/ edits from dale_coop
;;;;;;;;;;;for new jump attack and other stuff
LDX player1_object
LDA Object_animation_frame,x
STA temp
LDA Object_movement,x
AND #%00000111
STA temp3
TAY
LDA Object_x_hi,x
SEC
SBC #$10 ;; width of melee weapon
CLC
ADC weaponOffsetTableX,y
STA temp1
LDA Object_y_hi,x
CLC
ADC weaponOffsetTableY,y
SEC
SBC #$08 ;; height of melee weapon
STA temp2
LDX player1_weapon
LDA Object_type,x
CMP #OBJECT_PLAYER_MELEE
BNE +
LDA temp1
STA Object_x_hi,x
LDA temp2
STA Object_y_hi,x
LDA Object_movement,x
ORA temp3
STA Object_movement,x
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
stop moving right asm
Code:
; LDA isPaused
;BEQ +
;RTS
;+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ +
JMP ++
+
StopMoving player1_object, STOP_RIGHT
FaceDirection player1_object, FACE_UP_RIGHT
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
ChangeObjectState #$00, #$04
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
StopMoving player1_object, STOP_RIGHT
FaceDirection player1_object, FACE_RIGHT
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
ChangeObjectState #$00, #$04
+
RTS
stop moving left asm
Code:
;LDA isPaused
;BEQ +
;RTS
;+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BEQ +
JMP ++
+
StopMoving player1_object, STOP_LEFT
FaceDirection player1_object, FACE_UP_LEFT
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
ChangeObjectState #$00, #$04
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
++
StopMoving player1_object, STOP_LEFT
FaceDirection player1_object, FACE_LEFT
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
ChangeObjectState #$00, #$04
+
RTS
start crouch asm
Code:
LDA isPaused
BEQ +
RTS
+
LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE +
JMP end7
+
LDA gameHandler
AND #%00100000
BEQ++
RTS
++
LDX player1_object
GetCurrentActionType player1_object
CMP #$03 ;; attack
BEQ +
CMP #$01
BEQ +
LDA Object_physics_byte,x
AND #%00000001 ;; is it on ground
BEQ +
ChangeObjectState #$00, #$04
JMP +
+
LDA Object_movement,x
AND #%00000111
CMP #%00000110 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_DOWN_LEFT
JMP+
++
CMP #%00000010 ;;facing right?
BNE +
FaceDirection player1_object, FACE_DOWN_RIGHT
+
end7:
RTS
stop crouch asm
Code:
LDX player1_object
StopMoving player1_object, STOP_LEFT
GetCurrentActionType player1_object
;CMP #$03 ;; if incvincible?
;BEQ +
CMP #$03
BEQ + ; skip if we are casting spell
;;;changing state to idle
ChangeObjectState #$00, #$04
LDA Object_movement,x
AND #%00000111
CMP #%00000111 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_LEFT
JMP+
++
CMP #%00000001 ;;facing right?
BNE +
FaceDirection player1_object, FACE_RIGHT
+
RTS
handle hurt monster asm
Code:
;;; what should we do with the monster?
;;; monster is loaded in x
LDA Object_vulnerability,x
AND #%00000100 ;; is it weapon immune?
BEQ notWeaponImmune
PlaySound #SFX_MISS
JMP skipHurtingMonsterAndSound
notWeaponImmune:
LDA Object_status,x
AND #HURT_STATUS_MASK
BEQ dontskipHurtingMonster
JMP skipHurtingMonster
dontskipHurtingMonster:
LDA Object_status,x
ORA #%00000001
STA Object_status,x
LDA #HURT_TIMER
STA Object_timer_0,x
;;; assume idle is in step 0
ChangeObjectState #$00,#$02
;;;; unfortunately this recoil is backwards
LDA Object_status,x
AND #%00000100
BNE skipRecoilBecauseOnEdge
LDA Object_vulnerability,x
AND #%00001000
BNE skipRecoilBecauseOnEdge ;; skip recoil because bit is flipped to ignore recoil
LDA selfCenterX
STA recoil_otherX
LDA selfCenterY
STA recoil_otherY
LDA otherCenterX
STA recoil_selfX
LDA otherCenterY
STA recoil_selfY
JSR DetermineRecoilDirection
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; edited for new jump attack/truly means monster being hurt an amount----
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-----health equal to which weapon i have from my different-weapons code and variable
skipRecoilBecauseOnEdge:
LDA Object_health,x
SEC
CMP #$01
SBC which_weapon
BMI +
JMP notMonsterDeath
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
DeactivateCurrentObject
PlaySound #SND_SPLAT
;;;;;;;;;;;;;;;;;; ok, so now we also add points to score
;LDY Object_type,x
;LDA ObjectWorth,y
;STA temp
; AddValue #$03, GLOBAL_Player1_Score, temp
;arg0 = how many places this value has.
;arg1 = home variable
;arg2 = amount to add ... places?
;; and this should trip the update hud flag?
;;;;
TXA
STA tempy ;;dale_coop
AddValue #$08, myScore, #$01, #$00
;STA hudElementTilesToLoad
; LDA #$00
; STA hudElementTilesMax
; LDA DrawHudBytes
; ora #HUD_myScore
; STA DrawHudBytes
UpdateHud HUD_myScore
LDX tempy ;;dale_coop
JSR HandleDrops
JSR HandleToggleScrolling
CountObjects #%00001000, #$00
LDA monsterCounter
CLC ;;dale_coop
BEQ +
JMP ++
+
.include SCR_KILLED_LAST_MONSTER
++
JMP skipHurtingMonster
notMonsterDeath
STA Object_health,x
skipHurtingMonster:
;PlaySound #SFX_MONSTER_HURT
skipHurtingMonsterAndSound:
LDX tempx
;; what should we do with the projectile?
;PlaySound #SFX_MISS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;new code for jump attack/truly this is for telling the monster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;if its being hit with melee or projectile basically
LDA Object_type,x
CMP #$01
BEQ WeaponIsMelee
INC limitProjectile
DeactivateCurrentObject
JMP DoneHurtingMonster
WeaponIsMelee:
LDA Object_flags,x
AND #%11111011
STA Object_flags,x
DoneHurtingMonster
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
extra contol read code asm
Code:
ExtraInputControl:
;;; occasionally, there is input code that may be very specific, and it may be
;;; difficult to implement via the visual interface and accompanying scripts.
;;; this is a code that runs after all input checks, and allows for custom ASM.
LDA gameState
CMP #GS_MainGame
BEQ doMainGameUpdates
JMP skipMainGameExtraInputControl
doMainGameUpdates:
LDX player1_object
GetCurrentActionType player1_object
STA temp
LDA Object_physics_byte,x
AND #%00000010
BEQ isNotClimbing
LDA temp
CMP #$04
BNE isNotClimbing
LDA gamepad
AND #%11000000
BEQ noDirWhileClimbing
ChangeObjectState #$02, #$04
noDirWhileClimbing:
;;; is climbing.
;;; which means don't check to change to idle.
JMP skipMainGameExtraInputControl
isNotClimbing:
LDA temp
CMP #$03 ;; is it shooting (shooting is same anim in air and on ground)
BNE isNotAttackingAction
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
JMP skipMainGameExtraInputControl
isNotAttackingAction:
LDA gamepad
AND #%11000000 ;;; left and right
BEQ dontskipMainGameExtraInputControl
JMP skipMainGameExtraInputControl
dontskipMainGameExtraInputControl:
;;; if left and right are not pressed
LDA screenFlags
AND #%00100000 ;; does it use gravity?
;; if it does not, it would not have jumping or ducking, so
;; skip state updates for jumping and ducking.
BEQ notDucking ;; just will change to idle.
LDA Object_physics_byte,x
AND #%00000001 ;; if is in air
BNE notInAir
GetCurrentActionType player1_object
CMP #$02 ;; is it already state 2?
BEQ skipMainGameExtraInputControl
ChangeObjectState #$02, #$04
JMP skipMainGameExtraInputControl
notInAir:
LDA Object_h_speed_lo,x
ORA Object_h_speed_hi,x
;BNE skipMainGameExtraInputControl
;;;; controller is not pressed
;;;; horizontal speed is zero.
;; check to see if in air, shooting, etc.
LDA gamepad
AND #%00100000 ; if down is pressed
BEQ notDucking
ChangeObjectState #$00, #$04
JMP skipMainGameExtraInputControl
skipMainGameExtraInputControl:
RTS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;edited for new jump attack,maybe small edits above
notDucking:
LDA gamepad
AND #%11110000
BNE skipMainGameExtraInputControl2
;GetCurrentActionType player1_object
;BEQ skipMainGameExtraInputControl2
ChangeObjectState #$00, #$04
;;skipMainGameExtraInputControl2:
skipMainGameExtraInputControl2:
LDX player1_object
LDA Object_movement,x
AND #%00000111
CMP #%00000111 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_LEFT
JMP+
++
CMP #%00000001 ;;facing right?
BNE +
FaceDirection player1_object, FACE_RIGHT
+
;ChangeObjectState #$00, #$04
LDX player1_object
LDA Object_movement,x
AND #%00000111
CMP #%00000101 ;; facing left?
BNE ++
FaceDirection player1_object, FACE_LEFT
JMP+
++
CMP #%00000011 ;;facing right?
BNE +
FaceDirection player1_object, FACE_RIGHT
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
RTS