2nd projectile type?

WillElm

New member
I want a second projectile type after I accidentally made my turret fire monsters that I had already made. Here are the steps I took with my current understanding of NESMaker:

I copied ShootTowardsPlayer,

In the copied script (ShootTowardPlayerSTRAIGHT), I changed #OBJ_MONSTER_PROJECTILE to #OBJ_MONSTER_PROJECTILESTRAIGHT

I assigned it to AI Action 11 by navigating there in settings and selecting the script, ShootTowardPlayerSTRAIGHT

I made a constant called #OBJ_MONSTER_PROJECTILESTRAIGHT and assigned it to an object slot that was set up for it.

I want to be able to have 2 different monsters, each that fire a different projectile type.

I feel like I'm on the right track but that I either need to change some values in the copied script, or maybe put both codes in one script and make them work somehow. Am I warm? Here's the original code, all I changed was the reference to the constant.

Code:
;; shoot towards player.

	TXA
	STA tempx
	
	;; get offset
    LDA Object_x_hi,x
	;CLC
	;ADC #$04 ;; arbitrary...would put an 8x8 proj in the center of a 16x16 object
    STA temp1
	
    LDA Object_y_hi,x
	CLC
	ADC #$10
    STA temp2
	LDA Object_scroll,x
	STA temp
    CreateObject temp1, temp2, #OBJ_MONSTER_PROJECTILE, #$00, temp ;; maybe use a different state for ignore physics?
	LDA #$00
	STA Object_movement,x
	;; we will skip traditional movement 
	;; and use direct speed instead.
	;; will this cause deacceleration?
	;; what we need is a bit to "ignore physics engine" which will ignore acc/dec
	
	LDA Object_x_hi,x
	sec
	sbc xScroll

	STA temp
	LDA Object_y_hi,x

	STA temp2
	TXA
	STA tempz ;; store the newly created object's x
	;; shoot at player one - if there are two players, will we randomize somhow?
	LDX player1_object
	LDA Object_x_hi,x
	sec
	sbc xScroll
	STA temp1
	LDA Object_y_hi,x
	STA temp3
	LDX tempz ;; restore newly created projectile object.

	JSR MoveTowardsPlayer 
	LDX tempz

	LDA myHvel
	
	STA Object_h_speed_lo,x
	LDA #$00
	STA Object_h_speed_hi,x
	LDA myVvel
	STA Object_v_speed_lo,x
	LDA #$00
	STA Object_v_speed_hi,x
	
	
gotVAimSpeeds:	
	
	
	LDX tempx
 

dale_coop

Moderator
Staff member
You are on the right way...
I'd just rename the "gotVAimSpeeds" label to another thing. You can't have a label more than once in the project.... and this one is already used for the normal shootstraight script.
So for example, in your script, rename all the "gotVAimSpeeds" to "gotVAimSpeedsStraight" (or remove this line, because it's not used, in this script, in fact).
 
Top Bottom