Ongoinggamer
Member
Hi, a tutorial of how to make a 2 player game using Nesmaker would be fantastic? Please.
LDX #$01
LDA Object_x_hi,x
CLC
ADC #$10
STA Object_x_hi,x
LDA controllerNumber_hold ;which controller is being pressed?
BNE +controller2 ; 0 = controller1, 1=controller2
;; we are checking controller 1.
LDA gamepad
+controller2:
;;we are checking controller 2
LDA gamepad2
LDA controllerNumber_hold
BNE +weAreCheckingCOntroller2
;; we are checking controller 1.
LDA gamepad
AND #%11110000
BEQ changeToStop_NoDpadPressed
RTS
weAreCheckingCOntroller2:
LDA gamepad2
AND #%11110000
BEQ changeToStop_NoDpadPressed
RTS
changeToStop_NoDpadPressed:
ChangeActionStep temp, #$00 ;; assumes that "walk" is in action 1
;arg0 = what object?
;arg1 = what behavior?
RTS
;; Only can jump if the place below feet is free.
SwitchBank #$1C
LDY Object_type,x
LDA ObjectBboxTop,y
CLC
ADC ObjectHeight,y
sta temp2
LDA Object_x_hi,x
CLC
ADC ObjectBboxLeft,y
STA temp
JSR getPointColTable
LDA Object_y_hi,x
CLC
ADC #$02
CLC
ADC temp2
STA temp1
CheckCollisionPoint temp, temp1, #$01, tempA ;; check below feet to see if it is solid.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +checkMore
JMP +doJump
+checkMore
CheckCollisionPoint temp, temp1, #$07, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +checkMore
JMP +doJump
+checkMore
CheckCollisionPoint temp, temp1, #$09, tempA ;; check below feet to see if it is prize block .
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BNE +dontDoJump
JMP +doJump
+dontDoJump
;; check second point.
LDY Object_type,x
LDA ObjectWidth,y
CLC
ADC temp
STA temp
JSR getPointColTable
CheckCollisionPoint temp, temp1, #$01, tempA ;; check below feet to see if it is solid.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
CheckCollisionPoint temp, temp1, #$07, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
CheckCollisionPoint temp, temp1, #$09, tempA ;; check below feet to see if it is jumpthrough platform.
;;; if it is (equal), can jump.
;;; if not, skips jumping.
BEQ +doJump
; Partie qui check si on peut faire un double saut. Le code en commentaire sert à checker si on à récupèrer l'objet nésséssaire
; Pour pouvoir faire un double Jump (On à du créer une variable "doubleJumpCounter" dans project setting Objet Variable pour que
; ca fonctionne
JMP +checkIfCanDoubleJump
+checkIfCanDoubleJump
; LDA weaponsUnlocked
; AND #%00000010
BNE +doubleJumpUnlocked
JMP +skipJumping
+doubleJumpUnlocked
LDA doubleJumpCounter
CMP #$02
BEQ +skipJumping
JMP +doJumpNoReset
+doJump:
LDA #$00
STA doubleJumpCounter
+doJumpNoReset
TXA
STA temp ;; assumes the object we want to move is in x.
;PlaySound #sfx_thump
LDY Object_type,x
LDA ObjectJumpSpeedLo,y
EOR #$FF
STA Object_v_speed_lo,x
LDA ObjectJumpSpeedHi,y
EOR #$FF
STA Object_v_speed_hi,x
TXA
STA temp ;; assumes the object we want to move is in x.
; change the object's action so that he is in jump mode.
INC doubleJumpCounter
ReturnBank
RTS
+skipJumping:
ReturnBank
RTS
HTML clipboard LDX player1_object
LDA Object_v_speed_lo,x
CLC
ADC #$00
LDA Object_v_speed_hi,x
ADC #$00
BPL skipVarJump
LDA Object_v_speed_hi,x
CMP #$01
BCC skipVarJump
LDA #$00
SEC
SBC #$01
STA Object_v_speed_hi,x
skipVarJump:
RTS
+checkIfCanDoubleJump
; LDA weaponsUnlocked
; AND #%00000010
BNE +doubleJumpUnlocked
JMP +skipJumping
+checkIfCanDoubleJump
; LDA weaponsUnlocked
; AND #%00000010
; BNE +doubleJumpUnlocked
; JMP +skipJumping
+checkIfCanDoubleJump
LDA weaponsUnlocked
AND #%00000010
BNE +doubleJumpUnlocked
JMP +skipJumping