Hi All,
I'm stumped at the best approach for the following situation:
I've created a non-scrolling level of 32x28 8x8tiles to fill the screen, and I have stored the existence of a platform tile as a 00000001 or a 00000000 for each of these 896 tiles starting at address 0xa00. (Yes, big waste of memory using a whole byte on each tile, but trying to keep it simple for now).
Anyways, my sprite has its x and y position stored at $0900 and $0901 respectively and am trying to implement the below macro:
My first instinct to locate in memory the address of the tile below me is along the lines of the following
If ($0901+1)*32+$0900+0xa00 is 1 then $0902 set to 0; o/w 1.
I've added 1 to $0901 so that we're talking one tile "row" down from my current position.
However I am stumped on how to implement this in asm without tons of complicated asl sort of deals.
Alas, Is this style even acceptable for collision detection?
Any help is appreciated!
I'm stumped at the best approach for the following situation:
I've created a non-scrolling level of 32x28 8x8tiles to fill the screen, and I have stored the existence of a platform tile as a 00000001 or a 00000000 for each of these 896 tiles starting at address 0xa00. (Yes, big waste of memory using a whole byte on each tile, but trying to keep it simple for now).
Anyways, my sprite has its x and y position stored at $0900 and $0901 respectively and am trying to implement the below macro:
Code:
.macro BoolDown
; Input: X and Y co-ordinates
; Output: Result if legal move stored in $0902
; Purpose: Given X and Y position, if there is a platform tile below
; the current position then $0902 is 1, otherwise 0.
ldx $0900 ; load x position
ldy $0901 ; load y position
lda #(????)
cmp #%00000001
bne +
lda #1
sta $0902
+
lda #0
sta $0902
.endm
; Input: X and Y co-ordinates
; Output: Result if legal move stored in $0902
; Purpose: Given X and Y position, if there is a platform tile below
; the current position then $0902 is 1, otherwise 0.
ldx $0900 ; load x position
ldy $0901 ; load y position
lda #(????)
cmp #%00000001
bne +
lda #1
sta $0902
+
lda #0
sta $0902
.endm
My first instinct to locate in memory the address of the tile below me is along the lines of the following
If ($0901+1)*32+$0900+0xa00 is 1 then $0902 set to 0; o/w 1.
I've added 1 to $0901 so that we're talking one tile "row" down from my current position.
However I am stumped on how to implement this in asm without tons of complicated asl sort of deals.
Alas, Is this style even acceptable for collision detection?
Any help is appreciated!