2-Player Module 2nd Player Issues

vanderblade

Active member
This is for my boy Dale specifically, but here are the issues in my current game using Dale Coop's 2-player platformer module (which is magic).

First: The second player can't collect the Score tiles. They simply pass right through. How can we fix this?

Second: Related, and connected to the script for Trampoline Tiles on this forum, the 2nd player in the 2-player module simple falls through the trampoline tile. It currently has no effect on the 2nd player game object.

This is more about shoring up the 2nd player module, since it's brilliant, and should be built upon.

Dale, I love you. Please help.
 

dale_coop

Moderator
Staff member
Hey vanderblade :)

No problem, I can fix those scripts for you, could you share your
collectable for score script and your trampoline tile script ?

I'll check them
 

vanderblade

Active member
Sure!

Here's my Collectable_JustForScore_GivingExtraLife10 script:

Code:
;;blank
	CPX player1_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	

	AddValue #$02, myScore, #$01, #$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_myScore
		; STA DrawHudBytes
	UpdateHud HUD_myScore
	PlaySound #SND_GET
	
	
	;; extra life stuff:
    LDA myScore	;; checking the current unit digit of the score is "0" (it means 10, 20, ... 90)?
    BNE +		;; if not "0" we skip
    LDA myLives
    ADC #$01 ;add 1 to lives
    STA myLives    
    ;; update the count in hud
    STA hudElementTilesToLoad
    UpdateHud HUD_myLives

    ;; play 1UP sound:
    ; PlaySound #SND_1UP	(add a new "SND_1UP" sfx)
	+


    LDX tempx
	++

Here's the trampoline script:

Code:
;;BOUNCY TRAMPOLINE
;; trampoline
	CPX player1_object
	BNE notAPlayer_trampoline
	LDA Object_v_speed_hi
	BPL keepCheckingForTrampoline
	;; should behave like solid.
notAPlayer_trampoline:
	;;LDA #TILE_SOLID
	;;STA tile_solidity
	JMP doneWithTrampoline
keepCheckingForTrampoline:
	ChangeObjectState #$02, #$02
	LDA #$00
	SEC
	SBC #$02
	STA Object_v_speed_hi,x
doneWithTrampoline:
 

dale_coop

Moderator
Staff member
I see that in the scripts you are using, only the Player 1 is tested..
Here a fixed version of your scripts...


The Collectable_JustForScore_GivingExtraLife10 script:

Code:
;;blank
	CPX player1_object
	BEQ isPlayerForCollectableScore
	CPX player2_object
	BEQ isPlayerForCollectableScore
	JMP ++
isPlayerForCollectableScore:
	LDA tileCollisionFlag
	BEQ +
	JMP ++
+
	LDA #$01
	STA tileCollisionFlag
	ChangeTileAtCollision #$00, #$00
	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
	TXA
	STA tempx	

	AddValue #$02, myScore, #$01, #$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_myScore
		; STA DrawHudBytes
	UpdateHud HUD_myScore
	PlaySound #SND_GET
	
	
	;; extra life stuff:
    LDA myScore	;; checking the current unit digit of the score is "0" (it means 10, 20, ... 90)?
    BNE +		;; if not "0" we skip
    LDA myLives
    ADC #$01 ;add 1 to lives
    STA myLives    
    ;; update the count in hud
    STA hudElementTilesToLoad
    UpdateHud HUD_myLives

    ;; play 1UP sound:
    ; PlaySound #SND_1UP	(add a new "SND_1UP" sfx)
	+


    LDX tempx
	++


And for your Trampoline script:

Code:
;;BOUNCY TRAMPOLINE
;; trampoline
	CPX player1_object
	BEQ +
	CPX player2_object
	BEQ +
	JMP notAPlayer_trampoline
	+
	LDA Object_v_speed_hi
	BPL keepCheckingForTrampoline
	;; should behave like solid.
notAPlayer_trampoline:
	;;LDA #TILE_SOLID
	;;STA tile_solidity
	JMP doneWithTrampoline
keepCheckingForTrampoline:
	ChangeObjectState #$02, #$02
	LDA #$00
	SEC
	SBC #$02
	STA Object_v_speed_hi,x
doneWithTrampoline:
 

vanderblade

Active member
Thanks, Dale. I figured it was the missing check for the player-2 object. This should be helpful for others using the module, though.
 
Top Bottom