DanielT1985
Member
dale_coop said:Yes it’s exactly that
So what about positioning the weapon? How can you do that in the shootWeapon.asm Script? Or is that even possible?
dale_coop said:Yes it’s exactly that
DanielT1985 said:dale_coop said:Yes it’s exactly that
So what about positioning the weapon? How can you do that in the shootWeapon.asm Script? Or is that even possible?
dale_coop said:Yes it’s exactly that
LDX player1_object
LDA Object_movement,x
AND #%00000111
STA temp3
CMP #%000000010
BNE notRightForProjShoot
LDA Object_x_hi,x
CLC
ADC #$18 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing Right (a smaller value will make it closer)
STA temp
JMP gotDirForShoot
notRightForProjShoot:
LDA Object_x_hi,x
SEC
SBC #$18 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing LEFT (a smaller value will make it closer... try a small value #$08 or #$09 or #$0A to see the result)
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
dale_coop said:You need to add some code to adapt the horizontal position of the object that will be create (your weapon/projectile), depending of the facing position of your Player.
Take a look at my comments in this shootWeapon.asm script:
Code:LDX player1_object LDA Object_movement,x AND #%00000111 STA temp3 CMP #%000000010 BNE notRightForProjShoot LDA Object_x_hi,x CLC ADC #$18 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing Right (a smaller value will make it closer) STA temp JMP gotDirForShoot notRightForProjShoot: LDA Object_x_hi,x SEC SBC #$18 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing LEFT (a smaller value will make it closer... try a small value #$08 or #$09 or #$0A to see the result) 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_movement,x
AND #%00000111
ORA #%00000010
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_movement,x
AND #%00000111
STA temp3
CMP #%000000010
BNE notRightForProjShoot
LDA Object_x_hi,x
CLC
ADC #$10 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing Right (a smaller value will make it closer)
STA temp
JMP gotDirForShoot
notRightForProjShoot:
LDA Object_x_hi,x
SEC
SBC #$00 ;; <<---- HERE the horizontal offset value for the projectile/weapon when your player is facing LEFT (a smaller value will make it closer... try a small value #$08 or #$09 or #$0A to see the result)
STA temp
gotDirForShoot:
LDA temp3
TAY
LDA DirectionMovementTable,y
ORA temp3
STA temp3
dale_coop said:Don’t worry, this community is made for that. Help each other.
I am glad if I could help you
DanielT1985 said:dale_coop said:Yes it’s exactly that
So I got my character's projectile to me at the vertical position, but what about the horizontal position. When I shoot right, it's near the player but not near enough, and when I shoot left, it's far away from the player. I want it to me near my character to make it act like a fist. (The rock sprite is a placeholder, btw.)
dale_coop said:I think it's because the player is facing down when the game starts... see this topic :
http://nesmakers.com/viewtopic.php?f=3&t=981
dale_coop said:For the 2 projectiles limit, just make a backup (copy) of your NESMaker (just in case you don't success), and follow my topic:
http://nesmakers.com/viewtopic.php?p=6698#p6698
dale_coop said:Have you set the the "limitProjectile" variable "initial value" to "2"?
ZeGGamer1 said:dale_coop said:Have you set the the "limitProjectile" variable "initial value" to "2"?
Yes, I have.