+Atarius Maximus Posted June 25, 2007 Share Posted June 25, 2007 (edited) I've had a few requests via private mail to help people out who are trying to learn bB, along with requests for code examples. I thought I'd post some very simple, short programs that demonstrate how to do some specific things in bB. I always learn best by looking at sample code... hopefully these will help someone out. I'd be happy to create additional examples if someone wants one. Here are some links to some good tutorials from other members: From CurtisP: Programming Tutorial From SeaGtGruff: Tutorial Session 1 | Tutorial Session 2 | Tutorial Session 3 Other downloads & links you'll want: Get the latest version of bB here. Get the latest version of Visual bB here. Get the latest verison of Stella here. Read the latest documentation here. Steve 1_DrawSprite.bas 1_DrawSprite.bin 2_AddPlayfield.bas 2_AddPlayfield.bin 3_MoveASprite.bas 3_MoveAsprite.bin 4_FireAMissile.bas 4_FireAmissile.bin 5_AnimateASprite.bas 5_AnimateASprite.bin 6_AnimateAplayfield.bas 6_AnimateAplayfield.bin 7_3DMovingSprite.bas 7_3DMovingSprite.bin 9_DetectCollisions.bas 9_Detectcollisions.bin 8_FlashColors.bas 8_FlashColors.bin 10_MoveAnAnimatedSprite.bas 10_MoveAnAnimatedSprite.bas.bin 11_AdventureLight.bas 11_AdventureLight.bin 12_SimpleTitlescreenDemo.bas 12_SimpleTitlescreenDemo.bin 13_BankswitchingDemo.bas 13_BankswitchingDemo.bin 14_MoveAnimateAndFire.bas 14_MoveAnimateAndFire.bin 15_MoveSpritewithPlayfieldBoundaries.bas 15_MoveSpritewithPlayfieldBoundaries.bin 16_MoveSpritewithEnemySpriteFollowing.bas 16_MoveSpritewithEnemySpriteFollowing.bin Edited June 14, 2014 by Atarius Maximus 11 3 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/ Share on other sites More sharing options...
Impaler_26 Posted June 25, 2007 Share Posted June 25, 2007 Thanks for those nice examples!!! They'll sure be useful for me when i get off my lazy butt and continue work on my game one day 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1321710 Share on other sites More sharing options...
+batari Posted June 25, 2007 Share Posted June 25, 2007 Great idea! I will pin this topic. If anyone knows of other good examples scattered around the forum, maybe they can be mirrored here. Or if anyone has requests, post 'em up. 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1321713 Share on other sites More sharing options...
Nognir Posted August 8, 2007 Share Posted August 8, 2007 Thanks for this lot of binaries and source codes! Finally I made my title screen working Hope that I can get something done in a few weeks 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1347930 Share on other sites More sharing options...
freehabitat Posted November 2, 2007 Share Posted November 2, 2007 Hi there,.. i have a problem with connecting the moving sprite sample with the animated sprite sample,.... can anyone post the code, it would help so much! thnx 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1399819 Share on other sites More sharing options...
SeaGtGruff Posted November 2, 2007 Share Posted November 2, 2007 Hi there,.. i have a problem with connecting the moving sprite sample with the animated sprite sample,.... can anyone post the code, it would help so much! thnx Do you mean how to move an animated sprite? Michael 2 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1399892 Share on other sites More sharing options...
freehabitat Posted November 2, 2007 Share Posted November 2, 2007 HI,.. sorry for my bad english. yes, i mean how to move a animated Sprite. and i also want to know how to programm diferent "layers", like a intro,... main part..., outro... credits.... oh, so many other questions, i will post them little by little if i cant find any conclution. thanx!! 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1399894 Share on other sites More sharing options...
SeaGtGruff Posted November 3, 2007 Share Posted November 3, 2007 HI,.. sorry for my bad english. yes, i mean how to move a animated Sprite. Your English is fine. I was 98% certain that was what you meant, but my real reason for asking was because I wasn't at home when I was reading the posts, and that meant your question wouldn't show up under "View New Posts" when I did get home later. I wanted to post *something* in the thread so it would show up under "My Posts" when I got home, to remind myself that I intended to reply to you. I could have just posted something like "I'll check on it later," but instead I decided to ask for verification of what you wanted, just to be certain. So don't worry about your English! Michael 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1400017 Share on other sites More sharing options...
SeaGtGruff Posted November 3, 2007 Share Posted November 3, 2007 Okay, here's a sample that combines "3_MoveASprite.bas" with "5_AnimateASprite.bas." I think perhaps the reason you were having trouble combining them is because they both use variable y, but they use y for two different things. There are two ways this new sample can be improved-- (1) animate the sprite only when it's being moved around with the joystick; and (2) have the sprite face in the opposite direction if it's being moved right-to-left. But those can be for later. Michael 10_MoveAnAnimatedSprite.bas 10_MoveAnAnimatedSprite.bas.bin 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1400039 Share on other sites More sharing options...
freehabitat Posted November 3, 2007 Share Posted November 3, 2007 Thanx, that helps a lot! what i still did not understand is your reply of the other question with going to other Levels (goto different Playfields if something happenes). anyway... in next time i´ll try to work with combinations of the samples in this tread. Its my problem that i do not exactly know how to use lot of different actions in on programm. i look forward to create new samples with your help, that would be very helpfull for the other new programmers here. for me it´s the best way to learn, looking at other peoples programs and putting out special events i like to use. thanx so far,.. Tom 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1400122 Share on other sites More sharing options...
Dan Iacovelli Posted November 5, 2007 Share Posted November 5, 2007 I recongize the playfield sample,I asked the question for that for my game I'm working on. Also the animate sprite sample helped me alot with my game. 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1401349 Share on other sites More sharing options...
+Atarius Maximus Posted November 5, 2007 Author Share Posted November 5, 2007 Okay, here's a sample that combines "3_MoveASprite.bas" with "5_AnimateASprite.bas." I think perhaps the reason you were having trouble combining them is because they both use variable y, but they use y for two different things. There are two ways this new sample can be improved-- (1) animate the sprite only when it's being moved around with the joystick; and (2) have the sprite face in the opposite direction if it's being moved right-to-left. But those can be for later. Michael I've updated the first post with your additions, Michael. I'll keep doing that when new samples are posted. Cheers! Steve 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1401409 Share on other sites More sharing options...
freehabitat Posted November 5, 2007 Share Posted November 5, 2007 (edited) I've updated the first post with your additions, Michael. I'll keep doing that when new samples are posted. Cheers! Steve fine,.. so i can continue with my patchwork programming,.. that helps a lot at the begin,.. thanx tom Edited November 5, 2007 by freehabitat 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1401457 Share on other sites More sharing options...
Fort Apocalypse Posted December 27, 2007 Share Posted December 27, 2007 In addition to examples, there is a great reference here that batari wrote and Random Terrain maintains: http://www.randomterrain.com/atari-2600-me...c-commands.html 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1433643 Share on other sites More sharing options...
Fort Apocalypse Posted December 27, 2007 Share Posted December 27, 2007 Link to the easter egg Michael found about shakescreen since it has a code sample for how to shake the screen. 2 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1433644 Share on other sites More sharing options...
yuppicide Posted July 23, 2008 Share Posted July 23, 2008 I looked at your animated playfield code. You have this: x=10 : rem Counter number - when to switch to frame 2 y=20 : rem Counter number - when to switch to frame 3 z=30 : rem Counter number - when to switch to frame 4 main COLUPF=28 COLUBK=0 b=b+1 if b>30 then b=0 if b=x then goto frame1 if b=y then goto frame2 if b=z then goto frame3 ETC, ETC Wouldn't it be better to just to this? main COLUPF=28 COLUBK=0 b=b+1 if b>30 then b=0 if b=10 then goto frame1 if b=20 then goto frame2 if b=30 then goto frame3 ETC, ETC I don't know if it saves you any ROM, but this way you're not wasting variables. 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1557215 Share on other sites More sharing options...
SeaGtGruff Posted July 24, 2008 Share Posted July 24, 2008 I looked at your animated playfield code. You have this: The only reason I can think of for using variables is to make the code more reusable within the program-- for example, if you want to speed up or slow down the animation rate by changing the values in the variables. Otherwise, constants help save RAM (which-- on the Atari 2600-- is more important than saving ROM, since RAM is more precious than ROM). Michael 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1557432 Share on other sites More sharing options...
+Atarius Maximus Posted July 25, 2008 Author Share Posted July 25, 2008 I looked at your animated playfield code. You have this: The only reason I can think of for using variables is to make the code more reusable within the program-- for example, if you want to speed up or slow down the animation rate by changing the values in the variables. Otherwise, constants help save RAM (which-- on the Atari 2600-- is more important than saving ROM, since RAM is more precious than ROM). Michael That is exactly why I did it - to allow for changing the animation rate. I suppose it wasn't necessary for the sample program, yuppicide's revision would work fine too. Steve 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1558353 Share on other sites More sharing options...
yuppicide Posted July 28, 2008 Share Posted July 28, 2008 Didn't think of that. Thanks. Good idea. That is exactly why I did it - to allow for changing the animation rate. I suppose it wasn't necessary for the sample program, yuppicide's revision would work fine too. Steve 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1559787 Share on other sites More sharing options...
yuppicide Posted July 31, 2008 Share Posted July 31, 2008 One thing we should do with the first post is make everything the same. Am I nitpicking? Unfortunately yes. Everything code snippet has two files with it. First one being .bas, and second being .bin. Except number 8. It's backwards. First is .bin. Not a big deal, but I couldn't find 8 to load in bB and I swore I downloaded it lol. Second, number 10 is named .bas.bin when every other one is .bin. Anyway, nice tutorials. I enjoyed them. I think there should be one for how to insert simple background music and one how to insert a sound effect. I'll be able to manage just fine I am sure, but still would be nice to read a tut. Thanks again for the tutorials! 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1561198 Share on other sites More sharing options...
yuppicide Posted August 7, 2008 Share Posted August 7, 2008 Here's my own code snippet. I was fooling around and thought maybe somebody could make some use of this. In this I show you how to use two player sprites combined to make one big player sprite. large_player_demo.bas large_player_demo.bas.bin 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1565491 Share on other sites More sharing options...
+Atarius Maximus Posted January 26, 2009 Author Share Posted January 26, 2009 I added another sample program to the first post. It's a sample program that shows how to make the 'light' sprite around your character to move around an invisible maze, just like the mazes in the original Adventure game. Thanks, Steve 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1667733 Share on other sites More sharing options...
+Atarius Maximus Posted March 17, 2009 Author Share Posted March 17, 2009 One more sample was added to the first post, by request: 12-SimpleTitlescreenDemo.bas. It shows how to make a simple titlescreen. From the titlescreen, press fire to start the game. Steve 2 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1704909 Share on other sites More sharing options...
RevEng Posted May 31, 2009 Share Posted May 31, 2009 (edited) One more example for the pot - how to use shared sprite data for player0 and player1. 13_SharedSpriteData.bas 13_SharedSpriteData.bas.bin (edit - fixed up the comments a bit) 13_SharedSpriteData.bas Edited May 31, 2009 by RevEng 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1761970 Share on other sites More sharing options...
Animan Posted June 30, 2009 Share Posted June 30, 2009 Can anyone show me how to make a scrolling playfield? 1 Quote Link to comment https://forums.atariage.com/topic/109288-code-snippets-samples-for-bb-beginners/#findComment-1783089 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.