Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 drawing rectangle help!
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mike200015




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Naveg




PostPosted: Mon Mar 14, 2005 7:31 pm   Post subject: (No subject)

hey mikes, msn me for the answer
mike200015




PostPosted: Mon Mar 14, 2005 7:35 pm   Post subject: (No subject)

Very Happy thnx Vlads
Naveg




PostPosted: Mon Mar 14, 2005 7:45 pm   Post subject: (No 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
ssr




PostPosted: Mon Mar 14, 2005 10:05 pm   Post subject: (No 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
Flikerator




PostPosted: Tue Mar 15, 2005 2:01 pm   Post subject: (No 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
mike200015




PostPosted: Tue Mar 15, 2005 8:40 pm   Post subject: (No subject)

jus cuz i only wanted it certain colours
atrain




PostPosted: Tue Mar 15, 2005 10:09 pm   Post subject: (No 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...
Sponsor
Sponsor
Sponsor
sponsor
Bacchus




PostPosted: Wed Mar 16, 2005 12:09 am   Post subject: (No 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
[Gandalf]




PostPosted: Wed Mar 16, 2005 2:42 pm   Post subject: (No 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...
Bacchus




PostPosted: Wed Mar 16, 2005 4:27 pm   Post subject: (No 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
mike200015




PostPosted: Wed Mar 16, 2005 5:35 pm   Post subject: (No 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
atrain




PostPosted: Wed Mar 16, 2005 6:49 pm   Post subject: (No 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...
Cervantes




PostPosted: Wed Mar 16, 2005 7:15 pm   Post subject: (No 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.
MysticVegeta




PostPosted: Sun Mar 20, 2005 11:52 am   Post subject: (No subject)

Our teacher cuts marks for redundant/xtra code... When we ask her why, she reminds us to KISS (Keep It Simple Student)
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 19 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: