swapd0 Posted February 15, 2021 Share Posted February 15, 2021 (edited) I've been playing a bit with 7800basic and I'm stuck with a weird error. I've a function to check collisions with a 8x8 tile map, but since I'm using 16pixels zones the collision it's a bit weird because the tiles are 8x16 but they represents 4x8 tiles. hit_tile_xxx are arrays of data with a bitmask to check if you have to collided with the tile. I've a big wall on the left side of the screen, if I move the sprite there and then move it vertically I get the background color changing, and it's weird because I'm testing with temp1 that holds x position and I'm not moving on x axis. temp & 8 and temp & 4 are used to test if I'm in the left/upper or right/lower part of the tile. It looks like temp1 it's smashed with temp2 somewhere... Quote ; parameters, x, y function tile_collision tx = temp1 / 8 ty = temp2 / 16 tile = peekchar(screen1map, tx, ty, 20, 12) if tile = 0 then return 0 tile = tile / 2. ; because of doublewide char1 = tile. ; debug if temp2 & 8 then hit = hit_tile_high[tile] else hit = hit_tile_low[tile]. ; A if hit && (temp1 & 4) then BACKGRND = $5f : hit = hit_tile_right[tile] else BACKGRND = $1f : hit = hit_tile_left[tile]. ; B return hit Edited February 15, 2021 by swapd0 Quote Link to comment Share on other sites More sharing options...
CloakeD Posted February 15, 2021 Share Posted February 15, 2021 (edited) https://www.randomterrain.com/7800basic.html#temporary_variables I was overwriting the temp variables,this helped me. Edited February 15, 2021 by CloakeD 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.