Mugi
Member
I'm not sure how useful this is to other people, but in my game, im REALLY needing the action states for other things, and
ducking i wanted to have, but ducking is more or less just a visual and doesnt really serve any purpose that would warrant it to get an action state of it's own.
(in my game, a down press of dpad is just hardcoded to do things.)
so i put together a set of inputs that make the player enter a ducking animation derived from idle state, instead of going into ducking action state.
here's how it's done;
1) make sprite for "ducking left" and "ducking right"
2) assign the sprites in your idle state (action state 00) in positions "down right" and "down left"
3) make 2 new Input script, duck.asm and releaseDuck.asm
here's the code:
duck.asm
releaseDuck.asm:
assign duck.asm in input editor to "Press Down" and releaseDuck.asm to "Release Down"
enjoy ducking without wasting an action state
https://youtu.be/Vf_qFwUbDt4
feel free to improve the code, im not the best of assembly programmers
ducking i wanted to have, but ducking is more or less just a visual and doesnt really serve any purpose that would warrant it to get an action state of it's own.
(in my game, a down press of dpad is just hardcoded to do things.)
so i put together a set of inputs that make the player enter a ducking animation derived from idle state, instead of going into ducking action state.
here's how it's done;
1) make sprite for "ducking left" and "ducking right"
2) assign the sprites in your idle state (action state 00) in positions "down right" and "down left"
3) make 2 new Input script, duck.asm and releaseDuck.asm
here's the code:
duck.asm
Code:
;FACE_DOWN_RIGHT = #%00000001 ; we use this to crouch, facing right.
;FACE_RIGH = #%00000010
;FACE_LEFT = #%00000110
;FACE_DOWN_LEFT = #%00000111 ; we use this to crouch, facing left.
LDX player1_object
LDA gamepad
AND #%11010000
BNE skipCrouch
LDA Object_movement,x
CMP #%00000110
BEQ faceLeft
StopMoving player1_object, STOP_RIGHT
StopMoving player1_object, STOP_LEFT
FaceDirection player1_object, FACE_DOWN_RIGHT
RTS
faceLeft:
StopMoving player1_object, STOP_RIGHT
StopMoving player1_object, STOP_LEFT
FaceDirection player1_object, FACE_DOWN_LEFT
skipCrouch:
RTS
releaseDuck.asm:
Code:
LDX player1_object
LDA Object_movement,x
CMP #%00000111
BEQ faceLeft_noCrouch
ChangeObjectState #$00, #$03
FaceDirection player1_object, FACE_RIGHT
RTS
faceLeft_noCrouch:
ChangeObjectState #$00, #$03
FaceDirection player1_object, FACE_LEFT
RTS
assign duck.asm in input editor to "Press Down" and releaseDuck.asm to "Release Down"
enjoy ducking without wasting an action state
https://youtu.be/Vf_qFwUbDt4
feel free to improve the code, im not the best of assembly programmers