I have programmed a bit on the NES and it seems to be a fun project to create a game from scratch, so i tried to program a little platformer with my own collision detection scheme (i have not looked at how other games do the detection, it might totally differ from how it would normally be done).
I have created a file which holds my level data as a nametable, and it is also used in order to detect any collision. for the moment i have only programmed when a sprite hits ground, it should stop falling. it does work as intended, i can let the sprite fall from any position to any ground on any hight, it would stop the sprite as soon as it detects the ground (actually it checks if the sprite is in empty space and lets it fall down as long as empty space is detected).
My problem is that my sprite is 4 pixels deep in the ground in any situation, and i can not tell why that is.
i hope someone can look into my code and tell what the issue is. the file is for asm6
thanks in advance
a bit further explanation on my program:
every nmi the sprite is moved to the right and an animation routine is executed, so there is an actual animation.
i later will also implement controller button detection.
the main routine checks for the tile 8 pixels (1 tile) below the lower sprite tile(feet) and checks if it is air (empty tile #$07), if so, it will set a flag to tell another routine to execute (which is within NMI), which will then lower the sprites by one pixel.
this is executed until the tile below the lower sprite is something else than #$07. if this is the case, no flag will be set and therefore there is no fall routine executed in NMI.
if further explanation is needed, i can give more.
I have created a file which holds my level data as a nametable, and it is also used in order to detect any collision. for the moment i have only programmed when a sprite hits ground, it should stop falling. it does work as intended, i can let the sprite fall from any position to any ground on any hight, it would stop the sprite as soon as it detects the ground (actually it checks if the sprite is in empty space and lets it fall down as long as empty space is detected).
My problem is that my sprite is 4 pixels deep in the ground in any situation, and i can not tell why that is.
i hope someone can look into my code and tell what the issue is. the file is for asm6
thanks in advance
a bit further explanation on my program:
every nmi the sprite is moved to the right and an animation routine is executed, so there is an actual animation.
i later will also implement controller button detection.
the main routine checks for the tile 8 pixels (1 tile) below the lower sprite tile(feet) and checks if it is air (empty tile #$07), if so, it will set a flag to tell another routine to execute (which is within NMI), which will then lower the sprites by one pixel.
this is executed until the tile below the lower sprite is something else than #$07. if this is the case, no flag will be set and therefore there is no fall routine executed in NMI.
if further explanation is needed, i can give more.