I modified some scripts and animations, to have my player shooting projectiles lower if holding Down when he shoots.
Here my "CreateSimpleProjectileWithMotion.ASM" script:
I made an animation too, so my player is on his knees (not great graphics, but...) when he shoots projectiles lower.
I assigned the animation type "OnKnees" to the Action Step 04 in my Player "Object Details".
And made a script to change to that animations when I hold Down.
Here my "ChangeToOnKneesAnimation.asm" script :
Finally, in input editor, I assigned this script to "HOLD" "Down", and assigned the "ChangeToIdleAnimation.asm" script to "RELEASE" "Down".
Note: another (better?) technique would be to make a new CreateLowerSimpleProjectileWithMotion, creating anothe game objects (the #$02, for example) and assign the offsets as wanted (in the "Game Objets" dialog), and modify the inputs wisely (maybe using a unique script shootProjectile..; and check the gamepad inputs to execute one script or the other).
Here my "CreateSimpleProjectileWithMotion.ASM" script:
Code:
CreateSimpleProjectileWithMotion:
LDY player1_object
CPY #$FF ;; if the player object is set to ff, he's dead.
BNE playerCanCreateProjectile
RTS
playerCanCreateProjectile:
;; get offset
;; in a later version, we will use user defined offsets.
;; for now, we'll place projectile creation at center of object
LDA Object_movement,y
AND #%00000111
TAX
LDA weaponOffsetTableX,x
;;; now we have the offset
CLC
ADC Object_x_hi,y
STA temp1
LDA weaponOffsetTableY,x
CLC
ADC Object_y_hi,y
STA temp2
CreateObject temp1, temp2, #$01, #$00 ;;testVar
LDA Object_movement,y
AND #%00000111
STA temp
TAY
LDA DirectionMovementTable,y
ORA temp
STA Object_movement,x
;; add object size offset.
LDA Object_x_hi,x
SEC
SBC #$08 ;; half of the width of the intended projectile
STA Object_x_hi,x
LDA gamepad
AND #%11110000
CMP #%00100000 ;;check if down is pressed
BEQ projectileDown
JMP projectileCenter
projectileDown:
LDA Object_y_hi,x
SEC
ADC #$04 ;; half of the height of the intended projectile
STA Object_y_hi,x
JMP continueCreateMoreProjectilePlaced
projectileCenter:
LDA Object_y_hi,x
SEC
SBC #$08 ;; half of the height of the intended projectile
STA Object_y_hi,x
JMP continueCreateMoreProjectilePlaced
continueCreateMoreProjectilePlaced:
PlaySound #$00, #$00
;; here, anything else when he shoots
RTS
I made an animation too, so my player is on his knees (not great graphics, but...) when he shoots projectiles lower.
I assigned the animation type "OnKnees" to the Action Step 04 in my Player "Object Details".
And made a script to change to that animations when I hold Down.
Here my "ChangeToOnKneesAnimation.asm" script :
Code:
LDA onLadder
BNE endcheckLowAnimation
LDX player1_object
ChangeObjectState #$04, #$02
endcheckLowAnimation:
RTS
Finally, in input editor, I assigned this script to "HOLD" "Down", and assigned the "ChangeToIdleAnimation.asm" script to "RELEASE" "Down".
Note: another (better?) technique would be to make a new CreateLowerSimpleProjectileWithMotion, creating anothe game objects (the #$02, for example) and assign the offsets as wanted (in the "Game Objets" dialog), and modify the inputs wisely (maybe using a unique script shootProjectile..; and check the gamepad inputs to execute one script or the other).