dale_coop said:Yeah... nice script! Thanks to you.
MrGodman said:i'm following this thread in real time putting the code together as i read the posts. I have to say you've helped me see (a little bit) how asm works. thanks everybody in this thread.
gotDirForShoot:
LDA temp3
TAY
LDA DirectionMovementTable,y
ORA temp3
STA temp3
LDX player1_object
LDA #$00
STA preventShooting
LDA Object_movement,x
AND #%00000111
STA temp3
CMP #%000000010
BNE notRightForProjShoot
LDA Object_x_hi,x
CLC
ADC #$18
STA temp
JMP gotDirForShoot
notRightForProjShoot:
LDA Object_x_hi,x
SEC
SBC #$18
STA temp
gotDirForShoot:
LDA temp3
TAY
LDA DirectionMovementTable,y
ORA temp3
STA temp3
LDA Object_y_hi,x
STA temp1
LDA preventShooting
BNE +
ChangeObjectState #$03, #$08
CreateObject temp,temp1,#$01, #$00
LDA temp3
STA Object_movement,x
LDA #$01
STA preventShooting
+
RTS
LDA Object_y_hi,x
STA temp1
LDA Object_y_hi,x
SEC
SBC #$08 ;; height pixels higher
STA temp1
LDA Object_y_hi,x
CLC
ADC #$08 ;; height pixels lower
STA temp1
dale_coop said:Create your player's shooting animations, assign it to the "Action step 3" (don't forget to set an animation speed, and a "GoToFirst" for the "End of animation").
Create your projectile: the script uses the "Melee" object, set it as "player weapon", with a speed and acceleration. Also, set Edge And Solid object collision to "Destroy Me", a bounding box.
Then, use the ShootWeapon.asm script (assign it to the "Press" "A" button). Don't forget to comment the lines related to "preventShooting" (means comment lines 27, 28 and lines 35, 36), in the script.
if you need to adjust the position of the projectile...
For example, replace, vertically, you need to affect the object_y_hi, replacing:
with:Code:LDA Object_y_hi,x STA temp1
Or with:Code:LDA Object_y_hi,x SEC SBC #$08 ;; height pixels higher STA temp1
Code:LDA Object_y_hi,x CLC ADC #$08 ;; height pixels lower STA temp1
BNE +
ChangeObjectState #$03, #$08
CreateObject temp,temp1,#$01, #$00
BNE +
GetCurrentActionType player1_object
CMP #$01
BEQ continueShooting
CMP #$02
BEQ continueShooting
ChangeObjectState #$03, #$08
continueShooting:
CreateObject temp,temp1,#$01, #$00
LDA Object_movement,x
AND #%00000111
STA temp3
LDA Object_movement,x
AND #%00000111
ORA #%00000010
STA temp3