TheSailor 2023-02-22 05:34
I was playing around with a dungeon game Was8bit used to show simple collisions with. Now my question is if I change the player to a Sprite and collide with coin pickup tiles the tile only flashes the new tile and reverts back to the coin tile instead of staying as the new tile.
Now am I right in thinking I need to POKE the tile into memory?
GAMELEGEND 2023-02-22 07:15 (Edited)
I'm guessing that this is the program.
https://lowresnx.inutilis.com/topic.php?id=1572
No, you do not have to POKE the memory.
To get good Sprite and Cell collision you should check all 4 corners of the sprite. I rewrote parts of the program so the player that is a sprite can pick up coins.
The way it works is CHKCORS(X, Y, R) calls CHKCELL(X, Y, R) 4 times and checks 1 pixel ahead of the sprite in the direction that it wants to move. IF R does not equal -1 than the player can't move. -1 is like true so that is why it is always set to -1 at the start of CHKCELLS.
TheSailor 2023-02-22 11:02
I see where I went wrong. I was doing the correct way of collision checks but I was clearing the screen and copying the BG to the current background in the loop. That's why it flashed the new tile and went back to the old tile. But I appreciate the help!
rilden 2023-02-22 12:24
You don't need to use POKE, you can change tiles using the CELL command.
GAMELEGEND 2023-02-22 14:14
@TheSalior oh yeah I was going say that you were copying the BG again and again but I think I fell asleep.