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 / easy way to make a checkerboard effect

Author
Message
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 03:05
i was playing around with matrices and a black and white tile effect to see how easily I could pull one off and this is what I can up with:



the & sign is a binary operator and when used in x & 1 returns a 1 if x is odd and 0 if even

There are only 10 kinds of people in the world, those who understand binary and those who dont
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 20th Jun 2009 03:27 Edited at: 20th Jun 2009 03:33
10x10?
checkers is 8x8 unless you was just makeing a checkered texture.
It's cool tho.

edit:

O, wait you never said checkers nm.

If at first you don't succeed-Pause-Go to last checkpoint
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 20th Jun 2009 03:36
rofl

the reason I did this was cause I have tried to make a checkered 2d background many times in the past and every time ive had either failure or a mess of code, but this seeems really efficient and easy

There are only 10 kinds of people in the world, those who understand binary and those who dont
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Jun 2009 04:18
nice code
It's not part of the routine but that last line could be sync : wait key there's no need for DB to be sync'ing over and over when nothing has changed. That just me being picky .

There is an eight letter word. You can insert a letter into it or remove a letter from it without changing its meaning. Answer
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jun 2009 04:25
quite true but if I did that I would probably forget to take the wait key off when I used it later

There are only 10 kinds of people in the world, those who understand binary and those who dont
Bluestar4
18
Years of Service
User Offline
Joined: 19th Dec 2005
Location: USA
Posted: 22nd Jun 2009 06:02
Quote: "the reason I did this was cause I have tried to make a checkered 2d background many times in the past and every time ive had either failure or a mess of code"


I am curious if you ever tried using plains. its slightly more messy than your current code, but far faster speedwise due to objects having less vertices.

bluestar4~
---Missle Might - Hero Battles - Zillipede --- which do you like the best ?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jun 2009 06:04
how do you figure objects (even plains) are faster than 2d paste image?

There are only 10 kinds of people in the world, those who understand binary and those who dont
BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 22nd Jun 2009 06:44
He meant faster than using a matrix

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 22nd Jun 2009 07:15
ok, i give you that

There are only 10 kinds of people in the world, those who understand binary and those who dont

Login to post a reply

Server time is: 2024-05-20 09:27:08
Your offset time is: 2024-05-20 09:27:08