Making Secondary Melee Weapon I cant locate or alter draw location

TolerantX

Active member
I'm making a secondary melee weapon for the 2nd player to use and not use the player 1 weapon. Using Dale's 2 player Platformer Module.

I wrote a script that basically was create melee but altered things that were causing redundant errors:

; load the playerX_object (current inputs):
JSR PlayerXobjectInputs

createWeaponMelee2:
;; if on a cutscene:
LDA screenFlags
AND #%00000010
BEQ +
RTS
+
;TXA
;STA playerX_object
LDA gameHandler
AND #%00100000
BEQ notNPCstate_weapon2
JMP doneCreatingWeaponMelee2
notNPCstate_weapon2:
LDA weaponsUnlocked
AND #%00000010
BNE canCreateWeaponMelee2
JMP doneCreatingWeaponMelee2
canCreateWeaponMelee2:
;LDA limitWeapon
;BNE continueCreatingWeaponMelee2
;RTS
continueCreatingWeaponMelee2:

LDA Object_physics_byte,x
AND #%00000001 ;; is it on the ground?
BNE notCurrentyJumping2
JMP doneCreatingWeaponMelee2
notCurrentyJumping2:

;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN ATTACKING, comment out the following 3 lines:
;;; check if already attacking (assuming the attack action step is 03)
GetCurrentActionType playerX_object
CMP #$03
BNE notAlreadyCreatingWeaponMelee2
JMP doneCreatingWeaponMelee2
notAlreadyCreatingWeaponMelee2:
;;; IF YOU WANT TO USE AN SPECIFIC ANIMATION / ACTION STEP WHEN ATTACKING, comment out the following 1 line:
;;; if not already attacking, change it's action step (assuming the attack action step is 03)
ChangeObjectState #$03, #$02

;;; if you want your player stops when he's attacking, comment out the following lines:
LDA Object_movement,x
AND #%00001111
ORA #%00000010
STA Object_movement,x
LDA #$00
STA Object_h_speed_hi,x
STA Object_h_speed_lo,x
STA Object_v_speed_hi,x
STA Object_v_speed_lo,x

;; if was already attacking
wasAlreadyCreatingWeaponMelee2:

LDA Object_movement,x
AND #%00000111
STA temp2
TAY

LDA Object_x_hi,x
SEC
SBC #$08 ;; <<-- HERE, width of weapon
STA temp

LDA temp
;;; offset x for creation
CLC
ADC weaponOffsetTableX,y
STA temp
LDA temp3
ADC #$00
STA temp3

LDA Object_y_hi,x
CLC
ADC weaponOffsetTableY,y
sec
sbc #$08 ;; <<-- HERE, height of weapon
STA temp1


CreateObject temp, temp1, #OBJECT_PLAYER_MELEE2, #$00, currentNametable

;DEC limitWeapon

;;;; x is now the newly created object's x.
LDA Object_movement,x
ORA temp2
STA Object_movement,x
LDY temp2
LDA directionTable,y
ORA Object_movement,x
STA Object_movement,x

PlaySound #SND_SLASH
doneCreatingWeaponMelee2:
RTS


The problem I'm having is I set it to weapon 03 and in the objects thing it only lets you change the projectile (object #$02) and melee (object #$01) how would I change this objects draw location to line up better with my player? Thank you
 

dale_coop

Moderator
Staff member
You could use one Melee object but with different Action Steps.
- Action 0 (animation / graphics) for weapon Player 1
- Action 1 (animation / graphics) for weapon Player 2

In the "b_create_melee_object.asm" script, replace the line:
Code:
	CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, #$00, currentNametable

With those lines:
Code:
	LDA #$00
	STA tempy
	CPX player2_object
	BNE +
	INC tempy
	+   
	CreateObject temp, temp1, #OBJECT_PLAYER_MELEE, tempy, currentNametable
 
Top Bottom