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

Username:   Password: 
 RegisterRegister   
 Help me please
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
taron123




PostPosted: Mon Apr 02, 2012 9:36 am   Post subject: Help me please

i cant draw anything after my star and rain loop ..


code :

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) % <=Black oval to give the moon a curve shape


% Creates the clouds
drawfilloval (200, 450, 95, 48, 24) % <= Clouds infront of the moon
drawfilloval (150, 460, 100, 50, 24)
drawfilloval (250, 450, 95, 48, 24)
drawfilloval (290, 460, 100, 45, 24)

drawfilloval (600, 500, 95, 48, 24) % <= Clouds behind the building
drawfilloval (640, 480, 100, 50, 24)
drawfilloval (685, 500, 95, 48, 24)
drawfilloval (255, 470, 100, 45, 24)

drawfilloval (980, 510, 95, 48, 24) % <= Clouds right of the building
drawfilloval (1020, 490, 100, 50, 24)
drawfilloval (1020, 530, 100, 50, 24)


% Creates a white screen on the far left to cover 1/2 of the clouds
drawfillbox (1300, 0, 1010, 900, white)


% Create the Apartment
drawfillbox (620, 180, 840, 500, grey)


% Creates the Windows
drawfillbox (650, 470, 690, 420, yellow)
drawfillbox (710, 470, 750, 420, black)
drawfillbox (770, 470, 810, 420, black) % <= 4th story windows

drawfillbox (650, 400, 690, 350, black)
drawfillbox (710, 400, 750, 350, yellow)
drawfillbox (770, 400, 810, 350, black) % <= 3rd story windows

drawfillbox (650, 330, 690, 280, yellow)
drawfillbox (710, 330, 750, 280, yellow)
drawfillbox (770, 330, 810, 280, black) % <= 2nd story windows

drawfillbox (650, 230, 690, 190, yellow) % <= 1st story windows


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

drawfillbox (710, 245, 712, 180, brown) % <= Door framing
drawfillbox (810, 245, 808, 180, brown)
drawfillbox (710, 245, 810, 243, brown)

drawfillbox (760, 242, 760, 180, black) % <= Door separation

drawfilloval (750, 208, 2, 2, black) % <= left door knob
drawfilloval (770, 208, 2, 2, black) % <= right door knob




% 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)





i cant draw anything after the star, someone please help me
Sponsor
Sponsor
Sponsor
sponsor
poll262




PostPosted: Mon Apr 02, 2012 11:20 am   Post subject: RE:Help me please

setscreen ("graphics:max;max,nobuttonbar")
View.Set ("offscreenonly")
%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

procedure stars
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

end stars





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


% Draws the moon
drawfilloval (200, 550, 60, 60, white)
drawfilloval (235, 570, 60, 60, black) % <=Black oval to give the moon a curve shape


% Creates the clouds
drawfilloval (200, 450, 95, 48, 24) % <= Clouds infront of the moon
drawfilloval (150, 460, 100, 50, 24)
drawfilloval (250, 450, 95, 48, 24)
drawfilloval (290, 460, 100, 45, 24)

drawfilloval (600, 500, 95, 48, 24) % <= Clouds behind the building
drawfilloval (640, 480, 100, 50, 24)
drawfilloval (685, 500, 95, 48, 24)
drawfilloval (255, 470, 100, 45, 24)

drawfilloval (980, 510, 95, 48, 24) % <= Clouds right of the building
drawfilloval (1020, 490, 100, 50, 24)
drawfilloval (1020, 530, 100, 50, 24)


% Creates a white screen on the far left to cover 1/2 of the clouds
drawfillbox (1300, 0, 1010, 900, white)


% Create the Apartment
drawfillbox (620, 180, 840, 500, grey)


% Creates the Windows
drawfillbox (650, 470, 690, 420, yellow)
drawfillbox (710, 470, 750, 420, black)
drawfillbox (770, 470, 810, 420, black) % <= 4th story windows

drawfillbox (650, 400, 690, 350, black)
drawfillbox (710, 400, 750, 350, yellow)
drawfillbox (770, 400, 810, 350, black) % <= 3rd story windows

drawfillbox (650, 330, 690, 280, yellow)
drawfillbox (710, 330, 750, 280, yellow)
drawfillbox (770, 330, 810, 280, black) % <= 2nd story windows

drawfillbox (650, 230, 690, 190, yellow) % <= 1st story windows


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

drawfillbox (710, 245, 712, 180, brown) % <= Door framing
drawfillbox (810, 245, 808, 180, brown)
drawfillbox (710, 245, 810, 243, brown)

drawfillbox (760, 242, 760, 180, black) % <= Door separation

drawfilloval (750, 208, 2, 2, black) % <= left door knob
drawfilloval (770, 208, 2, 2, black) % <= right door knob




% 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)

delay (5)
View.Update

end loop

Here is how I would do it. I just put the drawing of the stars into a procedure and then looped it while it draws the other stuff.
Raknarg




PostPosted: Mon Apr 02, 2012 11:41 am   Post subject: RE:Help me please

@Poll I hope you realize that that is minimal help. Next time, don't deliver a direct answer.
Gadd




PostPosted: Thu Apr 05, 2012 4:06 pm   Post subject: RE:Help me please

Well that and the fact that if the person is to take the code and not learn anything and take the credit for it. Sure he may be the cool kid in the class but really hes getting nothing from it. It's his job to take that code and learn what it means... but you're right :3
Raknarg




PostPosted: Thu Apr 05, 2012 5:01 pm   Post subject: RE:Help me please

Perhaps, but it's not our job to perpetuate it.
Gadd




PostPosted: Thu Apr 05, 2012 5:33 pm   Post subject: RE:Help me please

ya thats why I agreed with what you had to say prior to my post Smile But hey, if he wants to take this seriously he can learn that.. I can't believe the amount of people who start with doing put, .. then are like meh loops and then go HERES MY GAME. It's just funny to see them browsing (collision) and copying code 10 minutes later Smile
Raknarg




PostPosted: Thu Apr 05, 2012 6:43 pm   Post subject: RE:Help me please

What do you think libraries are? Razz
Gadd




PostPosted: Thu Apr 05, 2012 7:19 pm   Post subject: RE:Help me please

Libraries!! NOOOOOOO
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Thu Apr 05, 2012 8:14 pm   Post subject: RE:Help me please

Wink I wrote a collision library! Smile
Gadd




PostPosted: Thu Apr 05, 2012 8:30 pm   Post subject: RE:Help me please

And I read it.. on your post, and 2 of my friends games Very Happy Wink
Raknarg




PostPosted: Fri Apr 06, 2012 12:36 pm   Post subject: RE:Help me please

Of course, I don't think there's any good substitute to making your own libraries/code
Aange10




PostPosted: Fri Apr 06, 2012 3:50 pm   Post subject: Re: RE:Help me please

Raknarg @ 6/4/2012, 11:36 am wrote:
Of course, I don't think there's any good substitute to making your own libraries/code


I agree and disagree.

I agree that you should make your own libraries and code, so that you can learn how to do things yourself / how things work behind the scenes.

However do keep in mind that once you know how to do these things for yourself (not just collision, but everything really) libraries become a much better alternative (unless you need a specific design) because people (generally) spend many hours on libraries, and tend to implement algorithms that would offer some benefits. It also keeps your code clean, and if the libraries are documented, it helps keep your code documented too.
smool




PostPosted: Fri Apr 06, 2012 4:36 pm   Post subject: RE:Help me please

I personally agree that making your own libraries is way better. That way you know exactly whats happening in your program, and you get the experience of writing it. Plus its fun! I have personally written my own classes/modules for pretty much everything. I just feel like cheating kind of, if i make a program and use someone else's code, the program just doesn't feel 100% mine.
Gadd




PostPosted: Fri Apr 06, 2012 8:42 pm   Post subject: Re: RE:Help me please

smool @ Fri Apr 06, 2012 4:36 pm wrote:
if i make a program and use someone else's code, the program just doesn't feel 100% mine.


Agreed.
Raknarg




PostPosted: Sat Apr 07, 2012 9:26 am   Post subject: RE:Help me please

Exactly. The other issue would be that you understand your own code much better than anyone else could, especially once it reaches a huge size. This means that to make any changes or updates, doing that to your own code is exponentially easier than trying to do it on someone elses. Maybe if the code is only a few hundred lines. What if its more than a few hundred? Or possibly thousand? or thousands?

Obviously it's time-consuming, but that doesnt change the benifits. And we're talking about highschool students using turing.
1) You have time on your hands (usually)
2) Turing is friggin easy
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  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: