Mugi
Member
this took me a moment and gave me a headache, but it was rather simple at the end of the day.
make a new tile assembly (conveyorbelt.asm) and assign it to an unused tiletype in your game.
https://youtu.be/LWhVTddbecY
make a new tile assembly (conveyorbelt.asm) and assign it to an unused tiletype in your game.
Code:
; 11_ConveyorBelt
LDA #TILE_SOLID
STA tile_solidity
LDA Object_h_speed_lo,x ; load movement speed, we use lo to get any movement to count
BEQ setConveyorLeft01 ; we're not moving, set the conveyor to move you left
CMP #$01
BMI conveyorFunctionEnd ; we're moving already, dont mess it up by setting new values.
; hi and lo values here control the "resistance" of the conveyor belt when walking against it
; negative values are used because this is a left moving conveyor, for right moving one, use positive values.
LDA #$FE ; set movement speed to -2 (negative values move us left)
STA Object_h_speed_hi,x
LDA #$90 ; lo is used for finetuning the speed
STA Object_h_speed_lo,x
JMP conveyorFunctionEnd
setConveyorLeft01:
; hi and lo here are used to determine the speed that the belt moves you when you're idle.
; use positive values to move you right, and negative values to move you left
LDA #$FD
STA Object_h_speed_hi,x
LDA #$80
STA Object_h_speed_lo,x
conveyorFunctionEnd:
https://youtu.be/LWhVTddbecY