Posted: 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)
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
poll262
Posted: 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)
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
Posted: 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
Posted: 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
Posted: Thu Apr 05, 2012 5:01 pm Post subject: RE:Help me please
Perhaps, but it's not our job to perpetuate it.
Gadd
Posted: 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 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
Raknarg
Posted: Thu Apr 05, 2012 6:43 pm Post subject: RE:Help me please
What do you think libraries are?
Gadd
Posted: Thu Apr 05, 2012 7:19 pm Post subject: RE:Help me please
Libraries!! NOOOOOOO
Sponsor Sponsor
Aange10
Posted: Thu Apr 05, 2012 8:14 pm Post subject: RE:Help me please
I wrote a collision library!
Gadd
Posted: 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
Raknarg
Posted: 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
Posted: 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
Posted: 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
Posted: 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
Posted: 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