These samples are fantastic! Thanks for making these available.
M.
Code Snippets & Samples for bB Beginners
|
Posted Fri Sep 18, 2009 9:56 PM
|
|
I know this is probably going to be complicated, but I am making a Galxian/Space Invaders game called Earth Invaders, and I have my ship, I have the play field, I have the missile . . . well I don't have the missile working yet but hope to soon.
Here is what I have yet to figure out, how exactly do I make the enemys??? Also if someone could send me a link that explains frames that would be helpful!!!! Thanks Disjaukifa This post has been edited by disjaukifa: Fri Sep 18, 2009 9:56 PM |
|
|
Posted Wed Mar 10, 2010 8:22 AM
|
|
Posted Wed Mar 10, 2010 2:23 PM
|
|
Posted Fri Mar 12, 2010 6:01 PM
|
|
I added another sample to the first post (#15). This one demostrates collision detection for a player sprite inside of a room from all directions. It's really simple and efficient. The code was actually pulled from the old "move around rooms" demo from SeaGtGruff - it's great code and I've used it in several of my games.
Steve |
|
|
Posted Wed Mar 17, 2010 10:43 PM
|
|
Anyone happen to have an example of a sound system subroutine that can be called from a main loop? The only way I can think of doing this would be to have the sound registers, a duration, the voice it belongs to (0 or 1)and then having it do something like
subroutine if a = 1 then read data : load sound registers for voice if a=duration variable then turn off audv0 or audv1 : a = 0 : return a = a + 1 return This seems like it would work, but I figured I would ask before trying it and wasting time (and bytes). Any other ideas? Cliff |
|
|
Posted Yesterday, 4:52 PM
|
|
Anyone happen to have an example of a sound system subroutine that can be called from a main loop? The only way I can think of doing this would be to have the sound registers, a duration, the voice it belongs to (0 or 1)and then having it do something like subroutine if a = 1 then read data : load sound registers for voice if a=duration variable then turn off audv0 or audv1 : a = 0 : return a = a + 1 return This seems like it would work, but I figured I would ask before trying it and wasting time (and bytes). Any other ideas? Cliff You mean like the kind of thing that the Music and Sound Editor can create? Right now it creates code using sdata, based on the Music Starter using sdata, but after the next update it will also create code that uses regular data if you want that will look like this: rem ***************************************************** rem * rem * Music Starter using data rem * rem * Based on code posted in the Ballblazer thread at AtariAge: rem * http://www.atariage.com/forums/index.php?s=&showtopic=130990&view=findpost&p=1615280 rem * rem * Code adapted by Duane Alan Hahn (Random Terrain) rem * rem * Explanation: rem * This has a 256-byte limitation. rem * rem ***************************************************** set smartbranching on rem ***************************************************** rem * Create aliases for variables rem ***************************************************** dim duration=a dim rand16=z rem ***************************************************** rem * Variable descriptions rem ***************************************************** rem * duration - how long each note plays rem * x - data counter rem * rand16 - makes better random numbers rem * Volume off AUDV0=0 AUDV1=0 rem * Initialize duration and data counter duration = 1 : x = 0 rem ***************************************************** rem * rem * Main game loop starts here. rem * rem ***************************************************** MainLoop goto GetMusic GotMusic drawscreen goto MainLoop rem ***************************************************** rem * Music rem ***************************************************** GetMusic rem * Check for end of current note duration = duration - 1 if duration>0 then GotMusic rem * Retrieve channel 0 data temp4 = musicData[x] : x = x + 1 temp5 = musicData[x] : x = x + 1 temp6 = musicData[x] : x = x + 1 rem * Check for end of data if temp4=255 then duration = 1 : x = 0 : goto GotMusic rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Retrieve channel 1 data temp4 = musicData[x] : x = x + 1 temp5 = musicData[x] : x = x + 1 temp6 = musicData[x] : x = x + 1 rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration duration = musicData[x] : x = x + 1 goto GotMusic rem ***************************************************** rem * Music Data Block rem ***************************************************** rem * Format: rem * v,c,f (channel 0) rem * v,c,f (channel 1) rem * d rem * rem * Explanation: rem * v - volume (0 to 15) rem * c - control [a.k.a. tone, voice, and distortion] (0 to 15) rem * f - frequency (0 to 31) rem * d - duration data musicData 8,12,29 0,0,0 15 2,12,29 0,0,0 8 8,12,19 0,0,0 15 2,12,19 0,0,0 8 8,12,17 0,0,0 15 2,12,17 0,0,0 8 255 end goto GotMusic |
|
|
Posted Yesterday, 10:34 PM
|
|
Anyone happen to have an example of a sound system subroutine that can be called from a main loop? The only way I can think of doing this would be to have the sound registers, a duration, the voice it belongs to (0 or 1)and then having it do something like subroutine if a = 1 then read data : load sound registers for voice if a=duration variable then turn off audv0 or audv1 : a = 0 : return a = a + 1 return This seems like it would work, but I figured I would ask before trying it and wasting time (and bytes). Any other ideas? Cliff You mean like the kind of thing that the Music and Sound Editor can create? Right now it creates code using sdata, based on the Music Starter using sdata, but after the next update it will also create code that uses regular data if you want that will look like this: rem ***************************************************** rem * rem * Music Starter using data rem * rem * Based on code posted in the Ballblazer thread at AtariAge: rem * http://www.atariage.com/forums/index.php?s=&showtopic=130990&view=findpost&p=1615280 rem * rem * Code adapted by Duane Alan Hahn (Random Terrain) rem * rem * Explanation: rem * This has a 256-byte limitation. rem * rem ***************************************************** set smartbranching on rem ***************************************************** rem * Create aliases for variables rem ***************************************************** dim duration=a dim rand16=z rem ***************************************************** rem * Variable descriptions rem ***************************************************** rem * duration - how long each note plays rem * x - data counter rem * rand16 - makes better random numbers rem * Volume off AUDV0=0 AUDV1=0 rem * Initialize duration and data counter duration = 1 : x = 0 rem ***************************************************** rem * rem * Main game loop starts here. rem * rem ***************************************************** MainLoop goto GetMusic GotMusic drawscreen goto MainLoop rem ***************************************************** rem * Music rem ***************************************************** GetMusic rem * Check for end of current note duration = duration - 1 if duration>0 then GotMusic rem * Retrieve channel 0 data temp4 = musicData[x] : x = x + 1 temp5 = musicData[x] : x = x + 1 temp6 = musicData[x] : x = x + 1 rem * Check for end of data if temp4=255 then duration = 1 : x = 0 : goto GotMusic rem * Play channel 0 AUDV0 = temp4 AUDC0 = temp5 AUDF0 = temp6 rem * Retrieve channel 1 data temp4 = musicData[x] : x = x + 1 temp5 = musicData[x] : x = x + 1 temp6 = musicData[x] : x = x + 1 rem * Play channel 1 AUDV1 = temp4 AUDC1 = temp5 AUDF1 = temp6 rem * Set duration duration = musicData[x] : x = x + 1 goto GotMusic rem ***************************************************** rem * Music Data Block rem ***************************************************** rem * Format: rem * v,c,f (channel 0) rem * v,c,f (channel 1) rem * d rem * rem * Explanation: rem * v - volume (0 to 15) rem * c - control [a.k.a. tone, voice, and distortion] (0 to 15) rem * f - frequency (0 to 31) rem * d - duration data musicData 8,12,29 0,0,0 15 2,12,29 0,0,0 8 8,12,19 0,0,0 15 2,12,19 0,0,0 8 8,12,17 0,0,0 15 2,12,17 0,0,0 8 255 end goto GotMusic Thanks. This will definitely do what I want. I was hoping to maybe reduce the data size per note to 5 being v,c,f,voice,d, but I can see potential issues with syncing the voices if I do that. Better to do it the way you have. Have you thought about posting this to the front of the thread? This is definitely something people could use. Thanks again. Cliff |
|

Sign In
Register
Help


MultiQuote





