drawline (x + 72, y - 15, x + 20, y + 15, 7) %tail bottom
drawline (x + 72, y + 15, x + 20, y - 15, 7) %tail top
drawline (x + 20, y + 15, x + 20, y - 15, 7) %Tail Back
drawfill (x + 100, y, 67, 7)
drawfill (x + 21, y, 67, 7)
end DrawFish
%Generate the fish
for move_forward : 1 .. 400
I hope I haven't given away to much but you seem to have a solid understanding of the draw commands.
If you understand this type of procedure then you should be able to modifiy it enough so that you can edit the bodyColor, outlineColor, and eyeColor of the fish.
pwnapple
Posted: Thu Dec 29, 2005 10:18 pm Post subject: (No subject)
thx for the help BUT
pavols way does not work
and i don't understand eliptical's way
chrispminis
Posted: Thu Dec 29, 2005 10:50 pm Post subject: (No subject)
pwnapple, neither pavol nor eliptical gave the full soure code that you need. They simply outlined the logic and basic programming needed. Try to figure out some of it on your own. I was thinking of doing Fishy as well
pwnapple
Posted: Thu Dec 29, 2005 11:26 pm Post subject: (No subject)
oh i see, could you possibly explain it?
Sponsor Sponsor
ecliptical
Posted: Thu Dec 29, 2005 11:45 pm Post subject: (No subject)
pwnapple,
like chrispminis said we just created the outline... and if you don't understand something play with it change things, change them back, check the reference, ask questions...etc.
It's a great way to learn !
And this forum is probably the best place you'll find the best of Turing is here.
ecliptical
Posted: Fri Dec 30, 2005 12:01 am Post subject: (No subject)
Here's how it works....
Lets say I want to draw a circle, not an oval that requires a x Radius and a y Radius just a circle. Currently turing doesn't have a built in "drawcircle"...that sucks... so lets MAKE ONE!
code:
procedure drawcircle
drawoval(maxx div 2, maxy div 2, 50,50,red)
end drawcircle
drawcircle
ok well that works pretty much in the same way that you fish does.
But what if I want to move this circle to draw it in a different location?
Does this mean I have to create a new procedure with a new location ?
NO!
Now some of this code is alright the circle (actually an oval - much like you fish isn't really a fish but a combination of arcs, lines and ovals..) is a circle that is it's perfectly round, so that concept will stay the same.
But we need to be able to draw it at different locations, and while we're at it draw it with different colors too!
code:
procedure drawcircle (x,y,circlecolor:int)
drawoval(x,y,50,50,circlecolor)
end drawcircle
drawcircle(200,100,red)
See what we did?
When we created the procedure we also gave it some values you can change...
So what this procedure is really saying is...
when the "drawcircle" procedure is called get the x,y, and color values from the user of where we draw the oval with a x and y radius of 50.
but of course we won't always want a circle that has a Radius of 50 will we... so lets make some additional changes so we have total control over drawing a circle.
code:
procedure drawcircle (x,y,size,circlecolor:int)
drawoval(x,y,size,size,circlecolor)
end drawcircle
drawcircle(200,100,10,red)
And THAT is all... now I can user drawcircle where ever I have included this procedure.
Mr. T
Posted: Fri Dec 30, 2005 12:45 am Post subject: Alex's Opinion
I've seen an animation like this before on compsci.
I think this code might be stolen.
ecliptical
Posted: Fri Dec 30, 2005 10:55 am Post subject: (No subject)
Or teachers could be handing out similair assignments... i know there are some Turing Teacher guides or something...so lets not assume the worst first.
Saad85
Posted: Fri Dec 30, 2005 11:10 am Post subject: (No subject)
does it really matter if its stolen? hes not trying to take credit for it, hes trying to learn from it
ecliptical
Posted: Fri Dec 30, 2005 3:37 pm Post subject: (No subject)
and the source code to a fish isn't all that of an impressive thing to steal anyway =)
jeo77
Posted: Sun Jan 01, 2006 3:13 pm Post subject: (No subject)
Here's ecliptical's way put into you'r source code, mabey it'll make more sence when you see it there
drawline (x + 72, y - 15, x + 20, y + 15, 7) %tail bottom
drawline (x + 72, y + 15, x + 20, y - 15, 7) %tail top
drawline (x + 20, y + 15, x + 20, y - 15, 7) %Tail Back
drawfill (x + 100, y, 67, 7)
drawfill (x + 21, y, 67, 7)
end DrawFish
%Generate the fish
%-----------
%BACKGROUND
%-----------
procedure drawBackground
%draw the waterline
for i : 0 .. (maxx div 20 + 1)
drawarc (i * 20, midy + 150, 10, 5, 180, 360, 7)
end for