ItchyGames
New member
Hi There,
the problem I'm facing with projectiles is the following:
1) if I set the projectile with the flag Ignore Gravity enabled, it does not move where is created.
2) Else, it will add gravity force to it, so the projectile does not go straight.
3) The Screen where I'm doing the tests have the Physics enabled.
This is the code I'm using to create projectiles
Any help will be welcomed.
the problem I'm facing with projectiles is the following:
1) if I set the projectile with the flag Ignore Gravity enabled, it does not move where is created.
2) Else, it will add gravity force to it, so the projectile does not go straight.
3) The Screen where I'm doing the tests have the Physics enabled.
This is the code I'm using to create projectiles
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
LDA Object_scroll,x
STA temp3
CreateObject temp1, temp2, #$02, #$00, temp3 ;; <<== Create a Game Object 01 (=Melee)
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 Object_y_hi,x
SEC
SBC #$08 ;; half of the height of the intended projectile
STA Object_y_hi,x
;;PlaySound #$00, #$00
RTS
Any help will be welcomed.