CreateSimpleProjectileWithMotion:
LDY player1_object
CPY #$FF ;; if the player object is set to ff, he's dead.
;BNE playerCanCreateProjectile
;RTS
;playerCanCreateProjectile:
;LDA GLOBAL_Player1_Ammo
;BNE continueCreateProjectile
;RTS
;continueCreateProjectile:
;; 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 Object_y_hi,x
SEC
SBC #$08 ;; half of the height of the intended projectile
STA Object_y_hi,x
;PlaySound #$00, #$00
;JMP decreasePlayerAmmo
RTS
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
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
CreateSimpleProjectileWithMotion:
LDY player1_object
CPY #$FF ;; if the player object is set to ff, he's dead.
BNE playerCanCreateProjectile
RTS
playerCanCreateProjectile:
LDA myWeapon ;;load the variable weapon
BNE continueCreateProjectile ;;if NOT equal to zero, when can continue creating the projectile
RTS ;; else we stop
continueCreateProjectile:
;; 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 Object_y_hi,x
SEC
SBC #$08 ;; half of the height of the intended projectile
STA Object_y_hi,x
;;PlaySound #$00, #$00
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
;;STA hudElementTilesToLoad
;; LDA #$00
;; STA hudElementTilesMax
;; LDA DrawHudBytes
;; ORA #HUD_ myWeapon
;; STA DrawHudBytes
RTS
;;; activateWeapon code for player.
;;; works with variable myWeapon
;;; works with HUD variable HUD_myWeapon
TXA
STA tempx
;;;you may want to test against a MAX value.
;;; this could be a static number in which case you could just check against that number
;;; or it could be a variable you set up which may change as you go through the game.
LDA #$01
STA myWeapon
;;; we also need to set up the routine to update the HUD
;; for this to work right, health must be a "blank-then-draw" type element.
;;STA hudElementTilesToLoad
;; LDA #$00
;; STA hudElementTilesMax
;; LDA DrawHudBytes
;; ORA #HUD_ myWeapon
;; STA DrawHudBytes
LDX tempx
dale_coop said:A lot of property you can see in the tool (NESMaker tool) is not yet implemented in the engine (ASM code).
I think relic and songs, boss, ... are not implemented yet.
dale_coop said:Because you need the fixed movement scripts (the ones that come with NESMaker have issues)
From here: http://nesmakers.com/viewtopic.php?f=19&t=390
shootdathing:
LDY player1_object
CPY #$FF ;; if the player object is set to ff, he's dead.
BNE playerCanCreateProjectile
RTS
playerCanCreateProjectile:
lda guyweapon
cmp #0
bne continueshooting
rts
continueshooting:
lda weaponpool
cmp #0
bne continueshootingmore
rts
continueshootingmore:
; removing bullet from the weaponpool
ldx weaponpool
dex
stx weaponpool
;; 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
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