Help with left scrolling in Platformer

Danger X

New member
Hi I just started making my first game a few days ago and I encountered a problem with left scrolling, I used both left scrolling and right scrolling scripts from the modules I found in game makers, here are my scripts
--left

; LDA ScreenFlags00
; AND #%00100000
; BEQ +doActivateScrollByte
; LDA scrollByte
; AND #%00111111
; STA scrollByte
; RTS
;+doActivateScrollByte:
LEFT_SCROLL_PAD = #$60
LDX player1_object
LDA Object_x_hi,x
SEC
SBC camX
CMP #LEFT_SCROLL_PAD
BEQ +doActivateScrollByte
BCC +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS
+doActivateScrollByte
LDA scrollByte
AND #%01000000
BEQ +notChangingCamDirectionForUpdate
LDA scrollByte
ORA #%00000010
+notChangingCamDirectionForUpdate

AND #%00111111
ORA #%10000000 ;; bit one forces an update.
STA scrollByte
;;; just like movement byte of a player.
;;; bit 7 indicates horizontal movement of a player
;;; bit 6 indicates 0 for left, 1 for right.

rts


--right
; LDA ScreenFlags00
; AND #%00010000
; BEQ +doActivateScrollByte
; LDA scrollByte
; AND #%00111111
; STA scrollByte
; RTS
;+doActivateScrollByte:
RIGHT_SCROLL_PAD = #$90
LDX player1_object
LDA Object_x_hi,x
SEC
SBC camX
CMP #RIGHT_SCROLL_PAD
BEQ +doActivateScrollByte
BCS +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS
+doActivateScrollByte
LDA scrollByte
AND #%01000000
BNE +notChangingCamDirectionForUpdate
LDA scrollByte
ORA #%00000010
+notChangingCamDirectionForUpdate
AND #%00111111
ORA #%11000000
STA scrollByte
;;; just like movement byte of a player.
;;; bit 7 indicates horizontal movement of a player
;;; bit 6 indicates 0 for left, 1 for right.

RTS


the problem is when I go to left if scrolls to right (the right scrolls is working properly thou) and I'm sure I linked the right script to my directional pad, can anyone help, is there a setting I have to do somewhere else?
 

TheRetroBro

Active member
If using built in scrolling

for inputs you want
Hold right input do scroll right
hold left input do scroll left

make sure your edges are set. For example when you warp into screen or your first screen you want to set the screen to "left edge for scroll"
 
Hi I just started making my first game a few days ago and I encountered a problem with left scrolling, I used both left scrolling and right scrolling scripts from the modules I found in game makers, here are my scripts
--left

; LDA ScreenFlags00
; AND #%00100000
; BEQ +doActivateScrollByte
; LDA scrollByte
; AND #%00111111
; STA scrollByte
; RTS
;+doActivateScrollByte:
LEFT_SCROLL_PAD = #$60
LDX player1_object
LDA Object_x_hi,x
SEC
SBC camX
CMP #LEFT_SCROLL_PAD
BEQ +doActivateScrollByte
BCC +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS
+doActivateScrollByte
LDA scrollByte
AND #%01000000
BEQ +notChangingCamDirectionForUpdate
LDA scrollByte
ORA #%00000010
+notChangingCamDirectionForUpdate

AND #%00111111
ORA #%10000000 ;; bit one forces an update.
STA scrollByte
;;; just like movement byte of a player.
;;; bit 7 indicates horizontal movement of a player
;;; bit 6 indicates 0 for left, 1 for right.

rts


--right
; LDA ScreenFlags00
; AND #%00010000
; BEQ +doActivateScrollByte
; LDA scrollByte
; AND #%00111111
; STA scrollByte
; RTS
;+doActivateScrollByte:
RIGHT_SCROLL_PAD = #$90
LDX player1_object
LDA Object_x_hi,x
SEC
SBC camX
CMP #RIGHT_SCROLL_PAD
BEQ +doActivateScrollByte
BCS +doActivateScrollByte
LDA scrollByte
AND #%00111111
STA scrollByte
RTS
+doActivateScrollByte
LDA scrollByte
AND #%01000000
BNE +notChangingCamDirectionForUpdate
LDA scrollByte
ORA #%00000010
+notChangingCamDirectionForUpdate
AND #%00111111
ORA #%11000000
STA scrollByte
;;; just like movement byte of a player.
;;; bit 7 indicates horizontal movement of a player
;;; bit 6 indicates 0 for left, 1 for right.

RTS


the problem is when I go to left if scrolls to right (the right scrolls is working properly thou) and I'm sure I linked the right script to my directional pad, can anyone help, is there a setting I have to do somewhere else?
My suggestion is to use this camera script by @SciNEStist : http://www.nesmakers.com/index.php?...ther-4-5-9-dohandlecamera-updates-fixes.7929/
It'll help a LOT
 
Hi, I saw in another of your posts that you use L2R, which is a left to right only -scrolling platform.
You may need to switch to the metroidvania module, which supports scrolling backwards and forwards.
Or use "Lets improve scrolling" thread as suggested above.

I recommend switching to metroidvania, anyways. It is slightly more modernly built.
And it is the one that most people use. ie most of the articles in the forums are written for it.
They are similar, but there are differences scattered throughout the various scripts.
 

dale_coop

Moderator
Staff member
Make sure you assign correctly the input script (like shown in the tutorial) and that you have set a player's bounding box.
 

Danger X

New member
Hi, I saw in another of your posts that you use L2R, which is a left to right only -scrolling platform.
You may need to switch to the metroidvania module, which supports scrolling backwards and forwards.
Or use "Lets improve scrolling" thread as suggested above.

I recommend switching to metroidvania, anyways. It is slightly more modernly built.
And it is the one that most people use. ie most of the articles in the forums are written for it.
They are similar, but there are differences scattered throughout the various scripts.
ok I switched to Metroidvania now help me set the scroll with this module
 

Danger X

New member
I have another problem now my hud is acting like it's part of the background and doesn't follow the screen, also it have no background (hud tiles background)

 

TheRetroBro

Active member

Danger X

New member
Thanks that solved my problem I made the hud appear but I have another problem, when I get his I get pushed back and can't control myself, what it happens I think it's after you get hit you enter the damage state where you get pushed back but the module doesn't have damage time out or should I say call the next state after the damage state it's over, so I get locked in this state and can't do anything, can anyone help please, how to recover from damage state?

 

TheRetroBro

Active member
Thanks that solved my problem I made the hud appear but I have another problem, when I get his I get pushed back and can't control myself, what it happens I think it's after you get hit you enter the damage state where you get pushed back but the module doesn't have damage time out or should I say call the next state after the damage state it's over, so I get locked in this state and can't do anything, can anyone help please, how to recover from damage state?

You need to change your hurt state timer and animation time in your action step (beleive it's action step 7)
 

Danger X

New member
1710443223437.png
I found the recoil code in the script, instead of making a left or right recoil I would like for one on the up direction, also I will paste the script bellow, I can't find the timer for the animation to be canceled either :(



;;;;;;;;;;;;;;;;;; Presumes there is a variable called myLives defined in user variables.
;;;;;;;;;;;;;;;;;; You could also create your own variable for this.

LDA gameHandler
AND #%10000000
BEQ +canHurtPlayer
JMP +skipHurt
+canHurtPlayer:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;; is the monster below our feet?
;;;;;;;;;; and are we moving downward?

+doHurtPlayer
TXA
STA temp
GetActionStep temp
CMP #$07
BNE +canHurtPlayer
JMP +skipHurt
+canHurtPlayer
;;; will presume there is a variable myHealth
;;; and that player hurt state is action state 3.
GetActionStep player1_object
CMP #$03 ;; hurt state.
BEQ +notAlreadyInHurtState
DEC myHealth

BMI +healthBelowZero
BEQ +healthBelowZero
JMP +notDeadYet
+healthBelowZero

JMP +playerHealthIsZero
+notDeadYet
UpdateHudElement #$02
ChangeActionStep player1_object, #$03
;; recoil
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
LDA xPrev
STA Object_x_hi,x
LDA yPrev
STA Object_y_hi,x
+notAlreadyInHurtState
LDA Object_x_hi,x
CLC
ADC self_center_x
STA tempA
LDA Object_y_hi,x
CLC
ADC self_center_y
STA tempB
TXA
PHA
LDX otherObject
LDA Object_x_hi,x
CLC
ADC other_center_x
STA tempC
LDA Object_y_hi,x
CLC
ADC other_center_y
STA tempD
PLA
TAX

;;; RECOIL L/R
;+recoilHor
LDA tempA
CMP tempC
BCS +recoilRight
LDA Object_direction,x
AND #%00001111
ORA #%10000000
STA Object_direction,x
JMP +skipHurt

+recoilRight
LDA Object_direction,x
AND #%00001111
ORA #%11000000
STA Object_direction,x
JMP +skipHurt

+playerHealthIsZero:

LDA continueMap
STA warpMap

LDA continueX
STA newX
LDA continueY
STA newY

LDA continueScreen
STA warpToScreen
STA camScreen


LDA myMaxHealth
STA myHealth



WarpToScreen warpToMap, warpToScreen, #$02
;; arg0 = warp to map. 0= map1. 1= map2.
;; arg1 = screen to warp to.
;; arg2 = screen transition type - most likely use 1 here.
;; 1 = warp, where it observes the warp in position for the player.


+skipHurt
 
Top Bottom