ninjaboyjohn Posted April 19, 2006 Share Posted April 19, 2006 (edited) I'm trying to create some simple randomly generated "obstacles" for my game. These obstacles are just singular playfield pixels that I turn on in playfield row 11 so they will scroll down during the next draw. The pixels are being created and turned off correctly, and everything seems to be running at full speed. The problem is that playfield pixels (seemingly inbetween rows 10 and 11) flash randomly at the bottom of the screen. I've tried putting my pixeldrawing code after drawscreen and the same thing occured. Below is the extracted code for my background - even with just the background code running, the flickering continues. If I rem out the pfpixel call for my created pixel, the flickering stops! Please help a newb out! Thanks! init COLUPF = 36 COLUBK = 44 scorecolor = 14 rem --- stores rand to add to the playfield uses r dim pfadd = r pfadd = 10 rem --- draw the playfield borders pfvline 0 0 11 pfvline 1 0 11 pfvline 30 0 11 pfvline 31 0 11 pfpixel 2 0 on:pfpixel 29 0 on:pfpixel 2 1 on:pfpixel 3 1 on pfpixel 28 1 on:pfpixel 29 1 on:pfpixel 2 2 on:pfpixel 28 2 on pfpixel 29 2 on:pfpixel 29 3 on:pfpixel 2 4 on:pfpixel 2 5 on pfpixel 3 5 on:pfpixel 2 6 on:pfpixel 29 6 on:pfpixel 28 7 on pfpixel 29 7 on:pfpixel 2 8 on:pfpixel 29 8 on:pfpixel 2 9 on pfpixel 3 9 on:pfpixel 2 10 on:pfpixel 3 10 on:pfpixel 29 10 on rem --- vertical bar on sides PF0=128 mainloop rem --- randomize the playfield rem -- first clear out old pixels pfhline 4 11 27 off rem -- then generate new pixel in row 11 between columns 4 and 27 inclusive pfadd = rand if pfadd > 72 then goto skip if pfadd > 48 then pfadd = pfadd - 48 if pfadd > 24 then pfadd = pfadd - 24 pfadd = pfadd + 3 pfpixel pfadd 11 on skip pfscroll down drawscreen goto mainloop Edited April 19, 2006 by ninjaboyjohn Quote Link to comment Share on other sites More sharing options...
+batari Posted April 19, 2006 Share Posted April 19, 2006 I'm trying to create some simple randomly generated "obstacles" for my game. These obstacles are just singular playfield pixels that I turn on in playfield row 11 so they will scroll down during the next draw. The pixels are being created and turned off correctly, and everything seems to be running at full speed. The problem is that playfield pixels (seemingly inbetween rows 10 and 11) flash randomly at the bottom of the screen. I've tried putting my pixeldrawing code after drawscreen and the same thing occured. Below is the extracted code for my background - even with just the background code running, the flickering continues. If I rem out the pfpixel call for my created pixel, the flickering stops! Please help a newb out! Thanks! ... Playfield row 11 is only hidden when the system variable playfieldpos is 8. This is the default value upon startup. playfieldpos can be 1-8. pfscroll up will decrease playfieldpos, and pfscroll down will increase. You are scrolling down, so you can check playfieldpos for 7 and only place a block in this case. Basically, just add this line right after mainloop: if playfieldpos<>7 then skip Quote Link to comment Share on other sites More sharing options...
ninjaboyjohn Posted April 19, 2006 Author Share Posted April 19, 2006 That works! Thanks! 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.