keitaro Posted November 18, 2015 Share Posted November 18, 2015 Hi everyone.I'm starting to learn the basics with Batari Basic.I used collision detection betweeen player shots and playfield, but I don't know how to implement this case:- Turn off part of the playfield when a player shot was impacted. Looking at commands, there is pfhline, so I think pfhline xpos ypos flip could work.But while value ranges are 0-31 for xpos and 0-11 for ypos, I can't determine it refering player shot position (with has a range up to about 136 for x-basis in my sample).So, is there a way to flip off part of playfield depending of player shot position?I attach the .bas file, sorry for very dirty code (copy-pastes from here and there, wasting space with too many variables, using for-next for timing etc etc, I'm still experimenting). My objetive later will be make my own sample (with cleaner code) with the basic elements only (that's playfield, player and missiles, without clone sprites etc).Regards! beamduel_151118_1555.bas Quote Link to comment Share on other sites More sharing options...
ScumSoft Posted November 19, 2015 Share Posted November 19, 2015 Been a long while since I touched bB, but I think we needed to divide the players X position by 5 to get the playfield X offsets. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted November 19, 2015 Share Posted November 19, 2015 You might want to post future batari Basic questions in the batari Basic forum: atariage.com/forums/forum/65-batari-basic/ If I understand your post correctly, you want to convert your missile coordinates to playfield coordinates. When using a sprite, something similar to the following is used: (player0x-15)/4 ((player0y-1)/8)-1 You'd replace the sprite in that example with the missile and play with the numbers until you get it right (for example, -15 will probably need to be changed). For testing, it helps to draw pixels under the missile using pfpixel to see if you have things lined up properly. Quote Link to comment Share on other sites More sharing options...
keitaro Posted November 19, 2015 Author Share Posted November 19, 2015 many thanks to both. excellent, I get to work after some value adjustment as you said. I attach files, still need to be polished, there is still very 'rush code'. also playfield scroll on/off can be controlled by switches now. Thanks again! beaminvader_151119_1615.bas.bin beaminvader_151119_1615.bas 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.