+atari2600land Posted October 4, 2006 Share Posted October 4, 2006 (edited) Why won't variable i keep adding by 1 until it gets to 60 and then go to line 110 in this example? 230 if collision(player0,playfield) then goto 232 231 goto 240 232 byte2=$00 score=score-10000 byte2=$AA 233 i=i+1 if i>1 then AUDV0=6 : AUDC0=6 : AUDF0=12 if i=60 then AUDV0=0 : i=0 : goto 234 goto 233 234 goto 110 I tried it without the line "goto 233" and I tried "if i<60" and it still won't work. It must be something simple and I'm missing it. The timer (i) indicates whether the sound is playing or not (it's a temporary lose-life sound.) Edited October 4, 2006 by atari2600land Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/ Share on other sites More sharing options...
potatohead Posted October 4, 2006 Share Posted October 4, 2006 Why won't variable i keep adding by 1 until it gets to 60 and then go to line 110 in this example? 230 if collision(player0,playfield) then goto 232 231 goto 240 232 byte2=$00 score=score-10000 byte2=$AA 233 i=i+1 if i>1 then AUDV0=6 : AUDC0=6 : AUDF0=12 if i=60 then AUDV0=0 : i=0 : goto 234 goto 233 234 goto 110 I tried it without the line "goto 233" and I tried "if i<60" and it still won't work. It must be something simple and I'm missing it. The timer (i) indicates whether the sound is playing or not (it's a temporary lose-life sound.) Seems to me, you have tied the playing of the sound to the collision between the player and the playfield. Does this remain the case the entire time your sound is supposed to play? It's a whole second, probably not. You probably should seperate the two, so that the sound can be playing no matter what happens to the player object. That way, if you animate it, or move it in response to the collision, then the sound can run it's course. Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148464 Share on other sites More sharing options...
SeaGtGruff Posted October 4, 2006 Share Posted October 4, 2006 Why won't variable i keep adding by 1 until it gets to 60 and then go to line 110 in this example? I don't know, on first glance it looks like it should work. But I don't see where you ever initialize i, so you could start by setting "i = 0" right after you "goto 232". And where you say "if i = 60" you might want to change it to say "if i > 59" (just in case i has somehow gotten to be more than 60). MR Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148544 Share on other sites More sharing options...
+atari2600land Posted October 4, 2006 Author Share Posted October 4, 2006 I played around with this a little, and it seems like it cuts the sound off because I hear a tiny "blip" before it goes to 235. 230 if collision(player0,playfield) then goto 232 if collision(player0,player1) then goto 269 231 goto 170 232 i=0 233 i=i+1 if i<59 then AUDV0=6 : AUDC0=6 : AUDF0=12 if i>59 then AUDV0=0 : i=0 : goto 235 234 goto 233 235 byte2=$00 score=score-10000 byte2=$AA 236 goto 110 Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148710 Share on other sites More sharing options...
s0c7 Posted October 4, 2006 Share Posted October 4, 2006 You don't appear to be issuing a DRAWSCREEN at any point during the iteration of i. Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148718 Share on other sites More sharing options...
+atari2600land Posted October 4, 2006 Author Share Posted October 4, 2006 Here's the whole code. What I'm trying to do here is create a Tapeworm-like game called Apples & Oranges in which the apple is going after the orange squares and the round Orange is the "shark". If the apple runs into either the orange or the playfield, I want the screen to freeze for a second ("60") and a sound to play. If the apple gets missile1, I want a short sound (half a second, or "30") to play while the apple and orange are still moving around. apple.bas.bin apple.bas Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148822 Share on other sites More sharing options...
SeaGtGruff Posted October 5, 2006 Share Posted October 5, 2006 If the apple runs into either the orange or the playfield, I want the screen to freeze for a second ("60") and a sound to play. If the apple gets missile1, I want a short sound (half a second, or "30") to play while the apple and orange are still moving around. I think s0c7 hit the nail on the head when he observed that you aren't doing a drawscreen in the loops where the sounds are supposed to be playing. I think those two lines should look like this: 233 if i<60 then i=i+1 : AUDV0=6 : AUDC0=12 : AUDF0=12 : drawscreen : goto 233 270 if h<29 then h=h+1 : AUDV0=6 : AUDC0=12 : AUDF0=24 : drawscreen : goto 270 MR Quote Link to comment https://forums.atariage.com/topic/94596-the-timer-wont-work/#findComment-1148971 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.