I decided to code a dodge-the-falling-thing game for fun/experience, even though there are half a million of them out there. I'm running into flicker problems 'cause I have to clear the screen every so often.

Screenie:
https://sites.google.com/site/seanga2/dropbox/flicker.gif?attredirects=0&d=1

I can't output a space to the previous location because of complexity related to when the "asteroid" goes off the end of the screen and appears on the top.

The source is here:
https://sites.google.com/site/seanga2/dropbox/RUNNER.8Xp?attredirects=0&d=1
Here's the full code, btw:

Code:
8->X
1->H
0->S
Menu("RUNNER","START",1,"HIGH-SCORES",2,"HELP",3,"QUIT",4
Lbl 1
For(I,1,5
randInt(1,5->L1(I
randInt(1,16->L2(I
End
While H
getKey->G
If G=24 and X>1
X-1->X
If G=26 and X<16
X+1->X
ClrHome
Output(7,X,"^"
For(I,1,5
Output(L1(I),L2(I),"*"
L1(I)+1->L1(I
If L1(I)=7
Then
If X=L2(I
0->H
1->L1(I
randInt(1,16->L2(I
End
End
Output(8,1,S
S+100->S
End
ClrHome
Output(4,1,"YOUR SCORE WAS:"
8-int(1n/d2(log(S))->X
Output(5,X,S
Pause
ClrHome
Thanks for that, Merthsoft. Would it not be better to erase and redraw the "sprites" than clearing the screen and redrawing them?
Also, something to note, utilizing lists is going to cause a huge slow down.
Absolutely. You're using a total of ten elements split between your two lists, so it's absolutely within reason for the sake of speed to unroll your loops and use a set of 10 real variables (A-Z, theta) instead. Take a look at most BASIC homescreen "racing" games for good examples of that technique.
KermMartian wrote:
Thanks for that, Merthsoft. Would it not be better to erase and redraw the "sprites" than clearing the screen and redrawing them?


If I do that it results in unimaginable complexity when I redraw them at the top of the screen.

Quote:
Absolutely. You're using a total of ten elements split between your two lists, so it's absolutely within reason for the sake of speed to unroll your loops and use a set of 10 real variables (A-Z, theta) instead. Take a look at most BASIC homescreen "racing" games for good examples of that technique.


But I can't do that without unwrapping all my loops. (repetition galore- code grows by factor of 3 min.) My main focus here is flicker.
You have:
Code:
For(I,1,5
Output(L1(I),L2(I),"*"
[...]
End

Therefore, by unimaginable complexity, you mean 5 output statements. Very Happy And a bit of glue logic for all the bits that I [...]ed.

Edit: To address your edit: Then instead of your ClrHome, loop over your five X,Y pairs, and print a space. You'll have to save your coordinates so that you'll be able to erase with them on the next iteration.
Quote:
Edit: To address your edit: Then instead of your ClrHome, loop over your five X,Y pairs, and print a space. You'll have to save your coordinates so that you'll be able to erase with them on the next iteration.


That's what I mean. I tried that. I was f***in hard to save the coords when I wrapped around, w/o adding a ton of list gunk.
Or you could do it the fun way Very Happy (The way that I overuse a LOT). Strings! I could give an example if that actually seems feasible.
_player1537 wrote:
Or you could do it the fun way Very Happy (The way that I overuse a LOT). Strings! I could give an example if that actually seems feasible.
Actually, that's not a bad idea at all!
I have no Idea what you mean by using strings. (How to code et cetera) Can I get an example?
seana11 wrote:
I have no Idea what you mean by using strings. (How to code et cetera) Can I get an example?
I think tifreak8x wrote a tutorial on using strings for this sort of thing; I'll take a look for it later if no one beats me to it.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement