how to fix invisible wall at right of screen (adventure game)

Logana

Well-known member
ever since i have started working on my game/rpg for nes maker there has been this weird glitch on the right side of all screens where the character just walks against it instead of going to the next screen, as well this only happens on the right side of the screen, not the left or top or bottom, and im worrying that there might not be a way to fix it so if by chance you know how to fix this than please help
 

red moon

Member
Logana, can you share some screens of your screen layouts and you are using the adventure module correct?
 

SciNEStist

Well-known member
The problem I have noticed is that the collision is looking at the first column of blocks to determine the collision for the edge of the screen. This means that the collision for every screen is basically mirrored.

This is a big problem that I hope gets fixed, but for now if you make sure your left edge and right edge of your screen are the same collision pattern, it will at least seem natural.

EDIT: Looks like this was already explained and solved in an earlier post HERE

to save the next person some effort, here is the edited code for CheckPlayerCameraPosition.asm :

Code:
MACRO CheckPlayerCameraPosition	
	
	
	CPX player1_object
    BEQ notdoneWithCameraCheck
	JMP doneWithCameraCheck
notdoneWithCameraCheck:
	LDA gameHandler
	AND #%10000000
	BNE gameIsActive
	JMP doneWithCameraCheck
gameIsActive:

	;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;======== ALIGN SCREEN IF NOT LINED UP WITH NAMETABLE	
	;;; corrupts A
	;;; if value is 1, it will skip gravity
	;TXA
	;STA tempx
	;JSR AlignScreenToNametable

	;BEQ dontAlignScreens
	;JMP doneWithCameraCheck
;dontAlignScreens:
	;LDX tempx
;;;; END HANDLE ALIGN SCREENS
;;;;;;;;======================================	

;;;;; BOTTOM CHECK
	LDA Object_y_lo,x
	CLC
	ADC Object_v_speed_lo,x
	LDA Object_y_hi,x
	ADC Object_v_speed_hi,x
	CMP #BOUNDS_TOP
	BCS notAtBoundsTop
;	LDA xScroll
	;BNE +
	LDA #$00
	STA xScroll
	JSR doTopBounds_player
	RTS
;+:
	JMP notAtBoundsTop ;; comment out if you want to use align screen 
 ;; do alignment of screen if it wasn't aligned.
	;;; if player's scroll is the same as xScroll_hi, we need to reverse scroll.
	;;; otherwise, it should be forward scroll
	LDA Object_scroll,x
	CMP xScroll_hi
	BEQ + ;; need to reverse
	;; forward auto scroll
	LDA #%00000000
	JMP ++
+ ;; need to reverse
	LDA #%10000000
++
	ORA #$02
	STA align_screen_flag
	LDA #ALIGN_TIMER
	STA genericTimer
	LDA #$01
	STA prevent_scroll_flag
	JMP doneWithCameraCheck
notAtBoundsTop:
	LDA Object_y_lo,x
	CLC
	ADC Object_v_speed_lo,x
	LDA Object_y_hi,x
	ADC Object_v_speed_hi,x
	ADC Object_bottom,x
	CMP #BOUNDS_BOTTOM
	BCS atBottomBounds
	JMP notAtBottomBounds
atBottomBounds:
	CPX player1_object
	BEQ isPlayerAtBottomOfScrollingBounds
	;; is not player at scrolling bounds
	;;; check for gravity? if not player and is at bottom bounds, and is a platformer  
	DeactivateCurrentObject
	JMP notAtBottomBounds
isPlayerAtBottomOfScrollingBounds:
	;LDA xScroll
	;BNE +
	LDA #$00
	STA xScroll
	JSR doBottomBounds_player
	RTS
;+: ;; do alignment of screen if it wasn't aligned.
	JMP notAtBottomBounds ;; comment out if want to align screen
	LDA Object_scroll,x
	CMP xScroll_hi
	BEQ + ;; need to reverse
	;; forward auto scroll
	LDA #%00000000
	JMP ++
+ ;; need to reverse
	LDA #%10000000
++
	ORA #$01
	STA align_screen_flag
	LDA #ALIGN_TIMER
	STA genericTimer
	LDA #$01
	STA prevent_scroll_flag
	
	JMP doneWithCameraCheck
notAtBottomBounds:
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;; let's check to see if we're against the leftmost edge.
	
	LDA xScroll_hi
	BNE + ; not on screen 0
	;; is on screen zero
	LDA Object_h_speed_lo,x
	CLC
	ADC #$00
	LDA Object_h_speed_hi,x
	ADC #$00
	BPL + ;; not moving left.
	LDA Object_scroll,x
	BNE +
	LDA xScroll
	CMP xHold_hi
	BCS leftOfCameraForPlayer
	JMP checkRightEdge

+


    LDA nt_hold
    CMP xScroll_hi
    BCC leftOfCameraForPlayer

    BNE checkRightEdge
    LDA xHold_hi
    CMP xScroll
    BCC leftOfCameraForPlayer
    BEQ leftOfCameraForPlayer
    JMP checkRightEdge
leftOfCameraForPlayer:
    ;;; dont update position
    JMP doScrollingLeftBounds
checkRightEdge:
    LDA xScroll_hi
    CLC
    ADC #$01
    STA temp
    
    LDA xScroll
    SEC
    SBC Object_right,x
    STA temp1
    LDA temp
    SBC #$00
    STA temp
    
    
    CMP nt_hold
    BCC rightOfCameraEdgeForPlayer
    BNE doneWithCameraCheck
    LDA temp1
    CMP xHold_hi
    BCC rightOfCameraEdgeForPlayer
    BEQ rightOfCameraEdgeForPlayer
    JMP doneWithCameraCheck
rightOfCameraEdgeForPlayer:
    JMP doScrollingRightBounds
  
doScrollingLeftBounds:
    ;;; enter what should happen at bounds for player.
	;;; an RTS here will result in skipping position update.

	JSR doLeftBounds_player
    RTS    
    
doScrollingRightBounds:
    ;;; enter what should happen at bounds for player.
	;;; an RTS here will result in skipping position update.
	
	JSR doRightBounds_player
    RTS
	
doScrollingTopBounds:

	JSR doTopBounds_player
	RTS

doScrollingBottomBounds:
	JSR doBottomBounds_player
	RTS
doneWithCameraCheck:
    ENDM


Hunting down these bug fixes in the forum isn't very easy, but there's a goldmine in here.
 

Dirk

Member
I hope there will be a fix in the next NESmaker version. I think I have encountered this issue in the jump'n'run scrolling module.
 

SciNEStist

Well-known member
I edited my post with the fix from an earlier forum post. I tested it and it works!

all credit to Joe and stevenshepherd :D
 

Logana

Well-known member
welp never mind when trying to do one of the things someone told me to do in the code i made a misstake and now i gotta restart so rip
 

dale_coop

Moderator
Staff member
When you modify a script, make a copy of the original... like this if you have issues, you can always revert to the working one.
(Also, every scripts are available in the nesmaker4_1_5.zip file, if you know which script that causes the issue, you could get the original and replace yours)
 

dale_coop

Moderator
Staff member
make sure you installed the "Engine Patch 4.1.1" (by default, it's not in the 4.1.5... Joe forgot it).

1) Download that file and keep it zipped
2) In your NESmaker project, click on the Menu->Project->Run Project Script.
3) Choose the EnginePatch zip file that you just downloaded and validate all the messages.
 

Attachments

  • NESMaker4.1.1EnginePatch.zip
    2 KB · Views: 39
Top Bottom