TidusRenegade Posted April 6, 2018 Share Posted April 6, 2018 Hi all I've been having a go with Batari Basic and I've found a strange bug with my game that I don't know whether it is a limitation of the engine or something I'm doing stupid! I'm trying to scroll the enemy player from right to left and when it reaches the left-hand side of the screen, restart from the right at a random y position. It works - but sometimes, when the enemy sprite is scrolling right to left, it goes all the way to the side of the screen and sometimes it only gets 2/3s of the way there and then restarts. I used the code: if l=1 || player1x=0 then player1x=150: player1y=(rand&76)+9: goto jump2 player1x=player1x-1 Note l is just the loop iteration so starts the enemy sprite moving on first iteration player1 coordinates are not in the code anywhere else other than the initial locations which are outside of the game loop and defined up with the variables. Any idea why this is happening? Thanks for any help TR Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 6, 2018 Author Share Posted April 6, 2018 Attached some example code I've cut it down to the bear-minimum and its still occuring Example code.txt Quote Link to comment Share on other sites More sharing options...
bogax Posted April 6, 2018 Share Posted April 6, 2018 When l gets (up) to 1 player1x gets reset Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 7, 2018 Author Share Posted April 7, 2018 But l only ever equals 1 once in the example code - doesn’t it? Is there a maximum value for variables at which point they loop back to zero? That would explain it Thanks for the response btw Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 7, 2018 Author Share Posted April 7, 2018 Yep that was it, l was looping. So simple d'oh! Thanks Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 8, 2018 Author Share Posted April 8, 2018 Actually can somebody please help again - I'm tearing my hair out with this! So using the example above, I added a title screen - and that worked fine, but now I need to add more enemy sprites to make the game that I want to so I need to use either the multisprite kernel or DPC+ I got DPC+ working but the screen area shrunk dramatically and the missile for player0 did not work all of the time - and when it did work it was extremely flickery. I tried to change the screensize using DFxFRACINC but that seems to be more related to playfields than the screen size itself (not sure if I've got that right?). Is there any way to change the screensize to what it was pre-DPC+? So I tried multisprite kernel and came to conclusion that it won't work with title screens created with the title screen editor (?). So after ripping out my title screen, I'm still failing to compile my code and I'm now getting the error:2600 Basic compilation failed!LINE --> set kernel multisprite--VERBOSE ERROR MESSAGE --batari Basic v1.01dreveng40 ©2005-2017Cannot open multisprite.inc for reading I'm using BB.1.1d.reveng40.zip which had worked fine up until this point. I did try using 1.0 instead but that didn't work either. I'm sure I'm doing something stupid but I'm not sure what!! Could anyone please help? Thanks in advance for any help Quote Link to comment Share on other sites More sharing options...
Mountain King Posted April 8, 2018 Share Posted April 8, 2018 Can you post your code? Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 8, 2018 Author Share Posted April 8, 2018 (edited) This is my latest - might be a little bit of a mess as I was trying a lot of things to get it working Example.bas Edited April 8, 2018 by TidusRenegade Quote Link to comment Share on other sites More sharing options...
Mountain King Posted April 8, 2018 Share Posted April 8, 2018 I didn't see anything in this code that referred to the DPC+ code. You did have some typos I fixed and Your ship controls seem to be reversed. Do you have the DPC+ code? Example.bas Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 8, 2018 Author Share Posted April 8, 2018 Thank you Mountain King - that seems to compile now and has the multisprite kernel so hopefully that means I can this idea of a game working. However for some reason I seem to have lost the asteroid on screen in your fixed version, not sure why - I'll have a good look through the code. As for the DPC+ version, I was supposed to attach that as well. I did get that working but the screen size became very small I couldn't find a way to push it back to the standard 88 rows resolution. It should be attached now. Thanks again for your help on this. Example2.bas Quote Link to comment Share on other sites More sharing options...
bogax Posted April 8, 2018 Share Posted April 8, 2018 Mountain King's version of mutisprite Added rand16 _COLUP1 instead of COLUP1 player1x<9 player1y = (rand&63)+16 moved JUMP2 bytes are 8 bits bits 0..7 (right to left) are powers of 2 2^0 = 1 2^1 = 2 2^2 = 4 2^3 = 8 etc AND is (bits) 0 AND 0 = 0 0 AND 1 = 0 1 AND 0 = 0 1 AND 1 = 1 & is a bitwise AND (bytes a & b = c, bits a0 AND b0 = c0, a1 AND b1 = c1, etc) 63 = 00111111 = 32 + 16 + 8 + 4 + 2 + 1 76 = 01001100 = 64 + 8 + 4 you'll only get a bit where you've got two ones so ANDing something with 76 will only give you numbers that are the sum of three of 64, 8, 4, 0, 0, 0 (the corresponding power of 2 or 0, for each bit) that's 8 different possibilities (3 bits set, 2^3 = 8 possibilities) Example_MK.bas Quote Link to comment Share on other sites More sharing options...
TidusRenegade Posted April 9, 2018 Author Share Posted April 9, 2018 Thank you so much Bogax, thats exactly what I was looking for Really appreciate the help Hopefully I can start making something decent now 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.