Craigery
Active member
I saw the other thread about Slopes Knietfeld made for the Platformer module, but I am trying to get Slope/Angled Walls to work in the Adventure Module. However this is not currently working, but I feel like I am on to something and maybe it will click with someone else.
THEORY
This will utilize multiple Tile Types; the top half of a slope and the bottom half for each Left \ and Right / slope (in theory 8 tiles). My player moves 1 Y pixel for every 2 X pixels moved. The player's Bottom Center point is compared against the following tables to determine slope collision.
I have 1 User Variables to save the X center, but I am not sure I actually need this when trying to STY.
playerCenterX
Hopefully this image helps explain it a bit.
CODE
I have just been trying to get 1 set working before moving on to the Diagonal directions.
Type 01
Left Slope \ Top Half
Type 02
Left Slope \ Bottom Half
My tables in ExtraTables.asm
So like I said I am not sure exactly I am going wrong, but maybe someone would see something obvious I am doing wrong or not considering.
THEORY
This will utilize multiple Tile Types; the top half of a slope and the bottom half for each Left \ and Right / slope (in theory 8 tiles). My player moves 1 Y pixel for every 2 X pixels moved. The player's Bottom Center point is compared against the following tables to determine slope collision.
- Player X is AND to 16 and is used to determine which X pixel of the current tile we are on.
- Player Y is compared against DiagValueY1_lo. Top half of slope Tile, pixels 0-7.
- Player Y is compared against DiagValueY1_hi. Bottom half of slope Tile, pixels 8-15.
I have 1 User Variables to save the X center, but I am not sure I actually need this when trying to STY.
playerCenterX
Hopefully this image helps explain it a bit.
CODE
I have just been trying to get 1 set working before moving on to the Diagonal directions.
Type 01
Left Slope \ Top Half
Code:
TXA
STA temp ;; assumes the object we want to move is in x.
LDA Object_x_hi,x ;;Load player X
AND #%11110000 ;;Center X position
AND #%00010000 ;;cull positions to 16
STY playerCenterX ;;Save players center X position into Y
CLC
LDA Object_y_hi,x ;;Load player Y
ADC #$10 ;;Add 16 pixels. Player is 16x16 so that would give us the bottom.
AND #%00010000 ;;cull position to 16
CMP DiagValueY1_lo,y ;;Compare to Upper half of Tile Y table (0-7)
BCS +playerStop ;;If Player Y is larger than the table then Stop Movement.
JMP +skip
+playerStop:
PlaySound #$01
StopMoving player1_object, #$FF
+skip
Type 02
Left Slope \ Bottom Half
Code:
TXA
STA temp ;; assumes the object we want to move is in x.
LDA Object_x_hi,x ;;Load player X
AND #%11110000 ;;Center X position
AND #%00010000 ;;cull positions to 16
STY playerCenterX ;;Save players center X position into Y
CLC
LDA Object_y_hi,x ;;Load player Y
ADC #$10 ;;Add 16 pixels. Player is 16x16 so that would give us the bottom.
AND #%00010000 ;;cull position to 16
CMP DiagValueY1_lo,y ;;Compare to Lower half of Tile Y table (8-15)
BCS +playerStop ;;If Player Y is larger than the table then Stop Movement.
JMP +skip
+playerStop:
PlaySound #$01
StopMoving player1_object, #$FF
+skip
My tables in ExtraTables.asm
Code:
DiagValueY1_lo:
.db #$00 , #$00 , #$01 , #$01 , #$02 , #$02 , #$03 , #$03 , #$04 , #$04 , #$05 , #$05 , #$06 , #$06 , #$07 , #$07
DiagValueY1_hi:
.db #$08 , #$08 , #$09 , #$09 , #$0A , #$0A , #$0B , #$0B , #$0C , #$0C , #$0D , #$0D , #$0E , #$0E , #$0F , #$0F
So like I said I am not sure exactly I am going wrong, but maybe someone would see something obvious I am doing wrong or not considering.
Last edited: