Computer Science Canada

drawing rectangle help!

Author:  mike200015 [ Mon Mar 14, 2005 7:20 pm ]
Post subject:  drawing rectangle help!

in my game, i need to draw about 10 rows of small rectangles, and about 10 in each row, with space in between each rectangle, but im not quite sure how to do that easily, without having to actually draw each 1 seperately.

This is sort of what i want to make, but i need space in between each rectangle from the top and bottom. But also i want each rectangle like a different colour:
code:
for y : 0 .. 200 by 20
    drawline (150, y, 500, y, 255)
    drawline (150, 220, 500, 220, 255)
    for x : 150 .. 500 by 50
        drawline (x, y, x, y + 20, 255)
    end for
end for

If anyone knows how i could go about doin that id appreciate it. Smile

Author:  Naveg [ Mon Mar 14, 2005 7:31 pm ]
Post subject: 

hey mikes, msn me for the answer

Author:  mike200015 [ Mon Mar 14, 2005 7:35 pm ]
Post subject: 

Very Happy thnx Vlads

Author:  Naveg [ Mon Mar 14, 2005 7:45 pm ]
Post subject: 

for anyone else who may have been interested...

code:
var col : int
var colours : array 4 .. 14 of int := init (40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140)

for y : 0 .. 200 by 20
    for x : 150 .. 500 by 50
        randint (col, 4, 14)
        drawfillbox (x + 2, y + 2, x + 48, y + 18, colours (col))
    end for
end for

Author:  ssr [ Mon Mar 14, 2005 10:05 pm ]
Post subject: 

just learnt this
eh
save lines
code:

var colours : array 4 .. 14 of int := init (40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140)

for y : 0 .. 200 by 20
    for x : 150 .. 500 by 50
        drawfillbox (x + 2, y + 2, x + 48, y + 18, colours (Rand.Int (4, 14)))
    end for
end for
Very Happy Very Happy

Author:  Flikerator [ Tue Mar 15, 2005 2:01 pm ]
Post subject: 

ssr wrote:
just learnt this
eh
save lines
code:

var colours : array 4 .. 14 of int := init (40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140)

for y : 0 .. 200 by 20
    for x : 150 .. 500 by 50
        drawfillbox (x + 2, y + 2, x + 48, y + 18, colours (Rand.Int (4, 14)))
    end for
end for
Very Happy Very Happy


Why even have the colours var?

code:
for x : 20 .. 600 by 50
    for y : 140 .. maxy - 20 by 20
        Draw.FillBox (x + 2, y + 2, x + 48, y + 18, Rand.Int (1, 250))
    end for
end for

Author:  mike200015 [ Tue Mar 15, 2005 8:40 pm ]
Post subject: 

jus cuz i only wanted it certain colours

Author:  atrain [ Tue Mar 15, 2005 10:09 pm ]
Post subject: 

poke...

now im stealing ur code...
and u cant prove it!!!
if u try, ill edit this post...

Razz mine sucka!!! although its usless for my program anywayz....
ill leave it commented...

Author:  Bacchus [ Wed Mar 16, 2005 12:09 am ]
Post subject: 

hm.. not a good thing to say considering the fact that ppl can save screens and such... *hint hint* i hate cheating and will do my part to punish those who do cheat, if u edit ur post, it will be to late. if needed pm me and i will send the shot

Author:  [Gandalf] [ Wed Mar 16, 2005 2:42 pm ]
Post subject: 

but then he could say you edited the screenshot...

This would be useful for a game like arknoid? I forget what the general name for it is... not pong, not pinball, hmmm...

Author:  Bacchus [ Wed Mar 16, 2005 4:27 pm ]
Post subject: 

nah i dont think editing the screenshot would be that good of an excuse, it would be waaay to hard to do that and make it look real. and i think the game ur thinking of is Brix, or Blocks or watever the name is, when you hit the ball into the boxes and they disapear and the point is to get rid of them all

Author:  mike200015 [ Wed Mar 16, 2005 5:35 pm ]
Post subject: 

arni.. aka atrain.. since u pretty much steal all my stuff.. if ur program looks sumwhat like this ill clearly know u stole.. and also.. u cant really edit the screenshot 2 well.. if u did u would b able to tell that its been edited

Author:  atrain [ Wed Mar 16, 2005 6:49 pm ]
Post subject: 

dont worry, ur code has no use in my program anywayz...

im sticking it in comments, just to make my code longer and more sufisticated looking...

Author:  Cervantes [ Wed Mar 16, 2005 7:15 pm ]
Post subject: 

atrain wrote:

just to make my code longer

You know, for all intents and purposes, shorter code is better, given that it's doing the same thing.

Author:  MysticVegeta [ Sun Mar 20, 2005 11:52 am ]
Post subject: 

Our teacher cuts marks for redundant/xtra code... When we ask her why, she reminds us to KISS (Keep It Simple Student)

Author:  ssr [ Sun Mar 20, 2005 9:13 pm ]
Post subject: 

clean code man
I dont even include comments and space in my code to reduce it
and got 2 marks off because of that lol
btw, I thought the last S was supposed to be stupid lol

Author:  [Gandalf] [ Mon Mar 21, 2005 8:20 pm ]
Post subject: 

Alright, if editing doesn't look real then this following screenshot it real. Notice anything? Now I can say you both edited your post...

Posted Image, might have been reduced in size. Click Image to view fullscreen.

Sorry if its a bit off topic... Confused

*edit* you gotta love all those tabs open Razz

Author:  Bacchus [ Mon Mar 21, 2005 8:39 pm ]
Post subject: 

lol proved me wrong Razz

Author:  jamonathin [ Wed Mar 23, 2005 7:33 am ]
Post subject: 

hey, YOUR TEACHER IS A THIEF ... and a bad one...


: