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.

The 20 Line Challenge / Tips for the 20 liner

Author
Message
RUCCUS
14
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 19th Apr 2005 22:06
Pretty bored lately so Im just writing up some tips on how to shrink your code for the 20 liner IMO. Mods feel free to delete, sticky or rape the post as you wish.

Line Tips

I like to put like or "similar" commands in each line. Probably obviouse but anyways here's how my layout usually is:

Game Settings (Sync on, Sync rate, hide mouse, fog on, Plus I set all the variables with their definitions here,etc. All that good stuff)

Object Settings (Make Obj, Colour Obj, Position Obj, Ghost Obj, etc. Any function you need to do to the object before the loop)

DO

The CHANGING line! (Anything that has to be increased, decreased, divided or whatever every loop would go in this line. Eg, if you need to increase the speed at which objects fly at you this would be the line to do it in. Any changes that occur every loop go here.)

Big Ass Code Lines (The last lines, the really important ones. I'd put as much commands as you could possible think of in the rest of the lines but make them as compact as possible (DUH)
For example, 1 line could have all the control checking commands, if keystate blah blah blah.. The next line could have all the for/next checks (Note, you can USUALLY compress a for next line to for:blah blah blah:
next blah

Then to top of you'd have your ever needed sync / do. Seperate lines ofcourse.


Guess it's pretty obvious what I said but like I said I have nothin' to do so I might as well try and contribute to the TGC. If you have something to add go for it.
Mods, rape away!

RUCCUS

Login to post a reply

Server time is: 2019-08-22 05:53:58
Your offset time is: 2019-08-22 05:53:58