Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Compression of a while loop

Author
Message
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 4th Sep 2007 09:08
I have a bunch of 2d commands in a while loop and to be honest I'm looking for a cleaner looking way to do this..can I use an array? I have the code right here.



I would appreciate any insight on this.

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 4th Sep 2007 11:27 Edited at: 4th Sep 2007 13:20
Your sync should be inside the While loop
Using WAIT like that is horrible, what are you trying to do with this loop?

Here's my version of it, I didn't like sitting around for 3 seconds waiting for the circles to be drawn
What was the purpose of the WAITs?



If you do want the waits then there are three ways of going about it, one of the main rules in programming is never do the same thing twice.

A: Completely random circles


B: Programmed circles (circles that can be mathematically produced)


C: Preset Circles (If you want those exact circles to be drawn)

This one will make each of your circle pop up in sequence, but a quick change of the sync position will make them all appear at once.


Don't make the user wait so long for anything to appear or they'll get bored before the program has started.
Hope this helps

[edit]
I've taken out all the waits from my examples because I don't like them

[edit]
I've put the wait back into the random one because the circles were moving too quickly.
CLS
The visually pleasing thing about putting CLS at the end of the loop is that when the mousebutton is released, the screen is cleared before the loop returns to the WHILE condition, and finding the condition no longer true, the program ends on a blank screen. Nice and tidy

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 5th Sep 2007 02:46
Obese-Wow man thank you so much for taking the time to write that all out..it felt like I was on the edge of something but just couldn't get it working. I was just playing around with db but I love those small random programs because its always fun to watch.

Thank you again for taking the time to type all of that out, have a good one.

Zombie

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Sep 2007 02:54
glad to help

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 5th Sep 2007 03:13 Edited at: 5th Sep 2007 03:14
I love the ones with sin and cos..takes me back to geometry class haha. thanks..what I'm looking to do is draw a circle and say click it a lot and when it gets to say 20 clicks it goes away and says "Boom it popped" just silly progs. Thank you again Obese.


And thank you for doing one with arrays..that was most helpful, I love playing around with the 2d commands..its so much fun.

Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 5th Sep 2007 06:59
OBESE!!! check it out..I just wrote the coolest code I've ever done besides the card I made for my mommy! I don't know if you were here for that one.



I'm so proud of myself for some reason but I'm not sure why haha.

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Sep 2007 14:24 Edited at: 5th Sep 2007 14:31
Nice, I've put in an extra sync so that the user can see the cube at the start. It's important to show the user what's going on
I've also replaced the WHILE loop with an IF statement; since you have a DO loop the program is checking for mouse clicks all the time anyway
Now can you make the cube come back?



[edit]
Oops, that sync wasn't working so well so I put it in the repeat loop. Works fine now.

In programming, nothing exists
Zombie 20
18
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 5th Sep 2007 23:32
Well I'm sure I can..can't wait to get back on my compy tonight and do some coding! I want to texture up a matrix for this and make it like a sightseeing tour...I went with set camera to follow but so many paramaters to figure out it was a tad overwhelming.

Login to post a reply

Server time is: 2025-05-31 19:22:52
Your offset time is: 2025-05-31 19:22:52