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

Username:   Password: 
 RegisterRegister   
 Heeeelllp
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
taron123




PostPosted: Fri Mar 30, 2012 11:19 am   Post subject: Heeeelllp

why dosnt the drawins works after my rain and star?



setscreen ("graphics:max;max,nobuttonbar")
%rain
type rain :
record
x : array 1 .. 500 of int
y : array 1 .. 500 of int
hspd : array 1 .. 500 of int
vspd : array 1 .. 500 of int
dist : array 1 .. 500 of int
end record

var r : rain

for i : 1 .. 500
randint (r.x (i), -300, 1200)
randint (r.y (i), 0, 900)
randint (r.hspd (i), 1, 3)
randint (r.vspd (i), 5, 10)
end for

loop
drawfillbox(0,1,maxx,maxy, black )
for i : 1 .. 500
drawline (r.x(i), r.y(i), r.x(i) + r.hspd(i), r.y(i) - r.vspd(i), white )
r.x(i) += r.hspd(i)
r.y(i) -= r.vspd(i)
if r.y(i)<0 then
r.y(i):=900
randint(r.x(i),-300,1200)
end if
end for
%star
var starx, stary,starx2, stary2, starsize:array 0..100 of int
var star,starvalue:int:=0
var drawstara,starnumber,starcolor:int:=0
var mousex,mousey,mouset:int
star:=star+1
if star>10 then
star:=0
end if
for stars:0..100
randint (drawstara,0,100)

randint (starx2(drawstara),0,maxx)
randint (stary2(drawstara),400,maxy)
starvalue:=1
randint (starsize(drawstara),1,15)
randint (starcolor,9,14)
starx:=starx2
stary:=stary2
drawfillstar (starx(drawstara)-1,stary(drawstara)-1,starx(drawstara)+starsize(drawstara)+1,stary(drawstara)+starsize(drawstara)+1,yellow)
drawfillstar (starx(drawstara),stary(drawstara),starx(drawstara)+starsize(drawstara),stary(drawstara)+starsize(drawstara),yellow)

end for

delay ( 5)
View.Update

end loop






% Draws the Grass
drawfillbox (0, 0, 1010, 180, green)


% Draws the moon
drawfilloval (200, 550, 60, 60, white)
drawfilloval (235, 570, 60, 60, black)

% Creates the clouds
drawfilloval (200, 450, 95, 48, 24)
drawfilloval (150, 460, 100, 50, 24)
drawfilloval (250, 450, 95, 48, 24)
drawfilloval (290, 460, 100, 45, 24)

drawfilloval (600, 500, 95, 48, 24)
drawfilloval (640, 480, 100, 50, 24)
drawfilloval (685, 500, 95, 48, 24)
drawfilloval (255, 470, 100, 45, 24)

drawfilloval (980, 510, 95, 48, 24)
drawfilloval (1020, 490, 100, 50, 24)
drawfilloval (1020, 530, 100, 50, 24)



drawfillbox (1300, 0, 1010, 900, white)



drawfillbox (620, 180, 840, 500, grey)



drawfillbox (650, 470, 690, 420, yellow)
drawfillbox (710, 470, 750, 420, black)
drawfillbox (770, 470, 810, 420, black)

drawfillbox (650, 400, 690, 350, black)
drawfillbox (710, 400, 750, 350, yellow)
drawfillbox (770, 400, 810, 350, black)

drawfillbox (650, 330, 690, 280, yellow)
drawfillbox (710, 330, 750, 280, yellow)
drawfillbox (770, 330, 810, 280, black) %

drawfillbox (650, 230, 690, 190, yellow)


% Creates a door
drawfillbox (710, 245, 810, 180, white)

drawfillbox (710, 245, 712, 180, brown)
drawfillbox (810, 245, 808, 180, brown)
drawfillbox (710, 245, 810, 243, brown)

drawfillbox (760, 242, 760, 180, black) %

drawfilloval (750, 208, 2, 2, black)
drawfilloval (770, 208, 2, 2, black)



% Creates the tree trunk
drawfillbox (200, 180, 215, 300, brown)


% Creates the leafs of the tree
drawfilloval (210, 310, 65, 50, green)
drawfilloval (220, 310, 65, 50, green)
drawfilloval (190, 310, 65, 50, green)




only rain and stars show
Sponsor
Sponsor
Sponsor
sponsor
Dreadnought




PostPosted: Fri Mar 30, 2012 11:29 am   Post subject: Re: Heeeelllp

Here's how your code works.

1 - setup some variables
2- After that start to draw rain and stars in an infinite loop
3- Once the infinite loop ends draw more stuff

Can you see why this wont work? The loop never ends, therefore, any statements after the loop will not be executed.
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 1  [ 2 Posts ]
Jump to:   


Style:  
Search: