Lillapojkenpåön Posted October 7 Share Posted October 7 I've looked at all examples and read the manual, I'm just trying to fill the screen with a solid tile but only the sprite shows up, please point out why? MODE 0 DEFINE SPRITE 0, 1, happy_face DEFINE CHAR 10, 1, game_bitmaps DEFINE COLOR 10 ,1 , game_colors player_x = 50 player_y = 100 face_color = 10 #score = 0 GOSUB update_score SCREEN DISABLE GOSUB draw_level SCREEN ENABLE game_loop: IF cont1.up THEN player_y = player_y - 1 END IF IF cont1.down THEN player_y = player_y + 1 END IF IF cont1.left THEN player_x = player_x - 1 END IF IF cont1.right THEN player_x = player_x + 1 END IF SPRITE 0, player_y-1, player_x, 0, face_color #score = #score + 1 GOSUB update_score WAIT GOTO game_loop update_score: PROCEDURE PRINT AT 2, #score, "0" END draw_level: PROCEDURE 'The screen is a 32x24 grid located at the VRAM address $1800-$1aff. 'It can be accessed using VPOKE (writing) and VPEEK (reading). FOR #c = $1800 TO $1aff STEP 1 VPOKE #c, 10 NEXT #c END happy_face: BITMAP "......XXXX......" BITMAP "....XXXXXXXX...." BITMAP "...XXXXXXXXXX..." BITMAP "..XXXXXXXXXXXX.." BITMAP ".XXXXXXXXXXXXXX." BITMAP ".XXXXXXXXXXXXXX." BITMAP "XXXX..XXXX..XXXX" BITMAP "XXXX..XXXX..XXXX" BITMAP "XXXXXXXXXXXXXXXX" BITMAP "XXXXXXXXXXXXXXXX" BITMAP ".XXXXXXXXXXXXXX." BITMAP ".XXX..XXXX..XXX." BITMAP "..XXX......XXX.." BITMAP "...XXX....XXX..." BITMAP "....XXXXXXXX...." BITMAP "......XXXX......" game_bitmaps: BITMAP "XXXXXXXX" BITMAP "XXXXXXXX" BITMAP "XXXXXXXX" BITMAP "XXX..XXX" BITMAP "XXX..XXX" BITMAP "XXXXXXXX" BITMAP "XXXXXXXX" BITMAP "XXXXXXXX" game_colors: DATA BYTE $16 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/ Share on other sites More sharing options...
skywaffle Posted October 7 Share Posted October 7 From what I can see, you need to set your colors for each row of pixels in the tile defined in game_bitmaps: 11 hours ago, Lillapojkenpåön said: game_colors: DATA BYTE $16 If you change this to "DATA BYTE $16,$16,$16,$16,$16,$16,$16,$16" you'll have a black screen filled with red dots. 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545297 Share on other sites More sharing options...
Lillapojkenpåön Posted October 7 Author Share Posted October 7 2 hours ago, skywaffle said: From what I can see, you need to set your colors for each row of pixels in the tile defined in game_bitmaps: If you change this to "DATA BYTE $16,$16,$16,$16,$16,$16,$16,$16" you'll have a black screen filled with red dots. I tried it with both DEFINE COLOR 10 ,8 , game_colors and DEFINE COLOR 10 ,1 , game_colors it compiles successfully but it's still just a black background 😢 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545362 Share on other sites More sharing options...
+nanochess Posted October 7 Share Posted October 7 1 hour ago, Lillapojkenpåön said: I tried it with both DEFINE COLOR 10 ,8 , game_colors and DEFINE COLOR 10 ,1 , game_colors it compiles successfully but it's still just a black background 😢 You used color $16 (this is black for pixels set, and red for pixels clear). CVBasic clears the memory on start, and you only defined a single DATA BYTE $16. It isn't enough, you need to repeat eight times the value $16. I've changed that single line and it works just fine (see the screenshot with the DATA BYTE line selected) 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545421 Share on other sites More sharing options...
Lillapojkenpåön Posted October 7 Author Share Posted October 7 23 minutes ago, nanochess said: You used color $16 (this is black for pixels set, and red for pixels clear). CVBasic clears the memory on start, and you only defined a single DATA BYTE $16. It isn't enough, you need to repeat eight times the value $16. I've changed that single line and it works just fine (see the screenshot with the DATA BYTE line selected) Ok thanks, I give up then Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545438 Share on other sites More sharing options...
+nanochess Posted October 7 Share Posted October 7 50 minutes ago, Lillapojkenpåön said: Ok thanks, I give up then Haha you are doing something incredibly wrong. Do a comparison with this. test1.bas test1.rom 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545478 Share on other sites More sharing options...
Lillapojkenpåön Posted October 7 Author Share Posted October 7 (edited) 1 hour ago, nanochess said: Haha you are doing something incredibly wrong. Do a comparison with this. test1.bas 1.67 kB · 0 downloads test1.rom 1.53 kB · 0 downloads Oh, I see what's wrong.. Last time I cd to the examples folder, I forgot this time so my output ended up elsewhere and I was just running the same old rom over and over. I've never seen a more glorious background in my life 😄 Edited October 7 by Lillapojkenpåön 1 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5545517 Share on other sites More sharing options...
Lillapojkenpåön Posted October 10 Author Share Posted October 10 Is DEFINE CHAR a buffered command with limitations similar to intybasic, once per frame etc.? Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5546801 Share on other sites More sharing options...
+nanochess Posted October 10 Share Posted October 10 2 hours ago, Lillapojkenpåön said: Is DEFINE CHAR a buffered command with limitations similar to intybasic, once per frame etc.? No, in CVBasic the data is loaded into the VRAM immediately. Ony the sprites are buffered like in IntyBASIC. 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5546841 Share on other sites More sharing options...
Lillapojkenpåön Posted October 19 Author Share Posted October 19 I'm not used to static arrays, is this an acceptable way to create bullets? There seems to be slight slowdown after all 7 possible bullets are on screen, is that just the emulator, my code or some other restriction? CONST FALSE = 0 CONST TRUE = 1 CONST NOT_IN_USE = 5000 DIM #bullet_x(7) : UNSIGNED #bullet_x DIM #bullet_y(7) : UNSIGNED #bullet_y FOR temp1 = 0 TO 6 #bullet_y(temp1) = NOT_IN_USE #bullet_x(temp1) = $0000 NEXT '------------------------------------------ 'create bullet IF CONT1.BUTTON THEN IF fire_restrainer = FALSE THEN fire_restrainer = TRUE FOR temp1 = 0 TO 6 IF #bullet_y(temp1) = NOT_IN_USE THEN #bullet_y(temp1) = #player_y #bullet_x(temp1) = #player_x 'exit loop when free slot is found EXIT FOR END IF NEXT END IF ELSE fire_restrainer = FALSE END IF 'move bullets FOR temp1 = 0 TO 6 IF #bullet_y(temp1) <> NOT_IN_USE THEN #bullet_x(temp1) = #bullet_x(temp1) + $0100 END IF NEXT 'reset bullet for re-use when offscreen FOR temp1 = 0 TO 6 IF (#bullet_x(temp1) / 256) >= 255 THEN #bullet_y(temp1) = NOT_IN_USE END IF NEXT 'draw bullets starting with sprite 1 sprite_nr = 1 FOR temp1 = 0 TO 6 IF #bullet_y(temp1) <> NOT_IN_USE THEN SPRITE sprite_nr, (#bullet_y(temp1) / 256) - 1, (#bullet_x(temp1) / 256), 0, 10 sprite_nr = sprite_nr + 1 ELSE SPRITE sprite_nr, 0, 0, 0, 0 sprite_nr = sprite_nr + 1 END IF NEXT Also what syntax highlighting does people use when posting basic code on the forum? 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5551599 Share on other sites More sharing options...
Lillapojkenpåön Posted October 20 Author Share Posted October 20 It looks like this, the slowdown happens when I press against a wall with all bullets on screen, am I out of cycles allready or is it just in the emulator because I'm on an old laptop? bandicam 2024-10-20 13-57-47-891.mp4 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5551996 Share on other sites More sharing options...
Lillapojkenpåön Posted October 22 Author Share Posted October 22 I'm pretty convinced my code takes too long now.. bandicam 2024-10-22 17-48-45-133.mp4 Does any of the other consoles like SG1000 have more cycles available? Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5553212 Share on other sites More sharing options...
shaoth Posted October 22 Share Posted October 22 have you tried to reduce the number of projectiles? In those days you had to make compromises 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5553231 Share on other sites More sharing options...
Lillapojkenpåön Posted October 22 Author Share Posted October 22 (edited) 20 hours ago, shaoth said: have you tried to reduce the number of projectiles? In those days you had to make compromises I have, there's no slowdown then.. I just really like projectiles 🙂 After compromising as much as I can, and fixing a bug where all bullets collided with all enemies offscreen the slowdown is gone rot.mp4 Edited October 23 by Lillapojkenpåön Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5553237 Share on other sites More sharing options...
Lillapojkenpåön Posted October 29 Author Share Posted October 29 I'm having a hard time figuring out why this doesn't copy the sprite frame to the buffer like I want it to #temp16 = VARPTR player_idle(0) #player_buffer(0) = PEEK(#temp16 ) #player_buffer(1) = PEEK(#temp16 + 1) #player_buffer(2) = PEEK(#temp16 + 2) #player_buffer(3) = PEEK(#temp16 + 3) #player_buffer(4) = PEEK(#temp16 + 4) #player_buffer(5) = PEEK(#temp16 + 5) #player_buffer(6) = PEEK(#temp16 + 6) #player_buffer(7) = PEEK(#temp16 + 7) #player_buffer(8) = PEEK(#temp16 + 8) #player_buffer(9) = PEEK(#temp16 + 9) #player_buffer(10) = PEEK(#temp16 + 10) #player_buffer(11) = PEEK(#temp16 + 11) #player_buffer(12) = PEEK(#temp16 + 12) #player_buffer(13) = PEEK(#temp16 + 13) #player_buffer(14) = PEEK(#temp16 + 14) #player_buffer(15) = PEEK(#temp16 + 15) DEFINE SPRITE 0, 1, VARPTR #player_buffer(0) All my attempts result in a stripy graphic? Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5557071 Share on other sites More sharing options...
Kiwi Posted October 29 Share Posted October 29 (edited) 30 minutes ago, Lillapojkenpåön said: I'm having a hard time figuring out why this doesn't copy the sprite frame to the buffer like I want it to #temp16 = VARPTR player_idle(0) #player_buffer(0) = PEEK(#temp16 ) #player_buffer(1) = PEEK(#temp16 + 1) #player_buffer(2) = PEEK(#temp16 + 2) #player_buffer(3) = PEEK(#temp16 + 3) #player_buffer(4) = PEEK(#temp16 + 4) #player_buffer(5) = PEEK(#temp16 + 5) #player_buffer(6) = PEEK(#temp16 + 6) #player_buffer(7) = PEEK(#temp16 + 7) #player_buffer(8) = PEEK(#temp16 + 8) #player_buffer(9) = PEEK(#temp16 + 9) #player_buffer(10) = PEEK(#temp16 + 10) #player_buffer(11) = PEEK(#temp16 + 11) #player_buffer(12) = PEEK(#temp16 + 12) #player_buffer(13) = PEEK(#temp16 + 13) #player_buffer(14) = PEEK(#temp16 + 14) #player_buffer(15) = PEEK(#temp16 + 15) DEFINE SPRITE 0, 1, VARPTR #player_buffer(0) All my attempts result in a stripy graphic? Try using 8-bit variables instead. Right now your variables are 16 bit, so in binary for example, it's 0000000011010010 per variable and the Colecovision VDP graphic is 8-bit. I would recommend using 8-bit variables when possible when the z80 processor is 8-bit. The # in front of the variable name tells it that it is 16-bit, which is same for Intybasic. Removing that will make it 8-bit variable. Edited October 29 by Kiwi 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5557082 Share on other sites More sharing options...
Lillapojkenpåön Posted October 29 Author Share Posted October 29 (edited) 1 hour ago, Kiwi said: Try using 8-bit variables instead. Right now your variables are 16 bit, so in binary for example, it's 0000000011010010 per variable and the Colecovision VDP graphic is 8-bit. I would recommend using 8-bit variables when possible when the z80 processor is 8-bit. The # in front of the variable name tells it that it is 16-bit, which is same for Intybasic. Removing that will make it 8-bit variable. Thanks, it's not stripy anymore but the graphic is now only 8 pixels wide instead of 16 EDIT: Oh! player_buffer(16) = PEEK(#temp16 + 16) player_buffer(17) = PEEK(#temp16 + 17) player_buffer(18) = PEEK(#temp16 + 18) etc.. is the right side of the graphics, nice! Edited October 29 by Lillapojkenpåön 1 Quote Link to comment https://forums.atariage.com/topic/373478-my-cv-basic-questions/#findComment-5557096 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.