Drew and animated car, has to drive foreward, flip and back
Author |
Message |
Leftover
![](http://www.analogwry.com/images/other/loc/leftover.jpg)
|
Posted: Sat Nov 13, 2004 12:00 am Post subject: Drew and animated car, has to drive foreward, flip and back |
|
|
Ok, I'm sure someone knows here. I'm supposed to draw a car, make it drive forewards, flip, then drive back and loop. Bonus was to make the wheels look like their spinning but I don't really care about that part, I'm sure I could do it but I'm crunched for time. Anyhow, I have the animation going back and forth, but it isn't flipping properly (or rather, I'm not entering the flip commands correctly) and it's frustrating me. Curious if anyone can help? Don't laugh at my ugly retro like car
code: |
setscreen ("graphics:800;200,nobuttonbar")
var picture : int
% Body
Draw.FillOval (100, 100, 100, 25, 12)
Draw.FillOval (190, 100, 8, 5, 0)
Draw.FillOval (3, 108, 3, 10, 12)
% Tires
Draw.FillOval (50, 75, 22, 22, 0)
Draw.FillOval (50, 75, 20, 20, 255)
Draw.FillOval (50, 75, 2, 2, 236)
Draw.FillOval (150, 75, 22, 22, 0)
Draw.FillOval (150, 75, 20, 20, 255)
Draw.FillOval (150, 75, 2, 2, 236)
% Cab
Draw.ThickLine (50, 120, 70, 150, 4, 12)
Draw.ThickLine (150, 120, 130, 150, 4, 12)
Draw.ThickLine (130, 150, 70, 150, 4, 12)
Draw.ThickLine (100, 120, 100, 150, 4, 12)
Draw.Line (99, 75, 99, 152, 0)
Draw.FillOval (60, 115, 4, 1, 0)
Draw.FillOval (110, 115, 4, 1, 0)
picture := Pic.New (0, 0, 220, 199)
Draw.Cls
loop
for i : 0 .. 600 by 10
Pic.Draw (picture, 0 + i, 0, picCopy)
Time.Delay (30)
Draw.Cls
end for
%had the crappy flipping in right here if that matters any
for decreasing i : 600 .. 1 by 10
Pic.Draw (picture, 0 + i, 0, picCopy)
Time.Delay (30)
Draw.Cls
end for
end loop
|
Anyhow any help would be aprecieated, as it is really stumping me right now. Thanks, Leftover |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
|
|
|
![](images/spacer.gif) |
Leftover
![](http://www.analogwry.com/images/other/loc/leftover.jpg)
|
Posted: Sun Nov 14, 2004 10:56 pm Post subject: (No subject) |
|
|
Holy crap tony, you rock. Thanks again bud. |
|
|
|
|
![](images/spacer.gif) |
Martin
![](http://www.compsci.ca/wiki/images/4/46/CanadianStickUp.jpg)
|
Posted: Mon Nov 15, 2004 7:57 am Post subject: (No subject) |
|
|
To make the wheels look like they are moving, draw a line from the middle of each wheel:
Draw.Line (wheelx, wheely, wheelx + wheelradius*cos(theta), wheely + wheelradius*sin(theta), colour)
Then just update theta every frame. |
|
|
|
|
![](images/spacer.gif) |
Leftover
![](http://www.analogwry.com/images/other/loc/leftover.jpg)
|
Posted: Tue Nov 16, 2004 1:09 am Post subject: (No subject) |
|
|
Ya lost me on that one I know I should know that but wow it's too late... Anyhow, I gave it a try, and it worked in my head, but not on turing's screen. Too late to hand er in now, but I'm damn curious to know how to make that work.
I basically drew 1 wheel 4 times (didn't touch second wheel yet) with lines going through them and in order so it will look like its spinning, like:
It kinda worked, but not really...
code: |
setscreen ("graphics:800;200,nobuttonbar")
var picture, fr1, fr2, fr3, fr4 : int
Draw.FillOval (50, 75, 22, 22, 0)
Draw.FillOval (50, 75, 20, 20, 255)
Draw.FillOval (50, 75, 2, 2, 236)
Draw.Line (50, 55, 50, 95, 0)
fr1 := Pic.New (50, 55, 95, 95)
Draw.Cls
Draw.FillOval (50, 75, 22, 22, 0)
Draw.FillOval (50, 75, 20, 20, 255)
Draw.FillOval (50, 75, 2, 2, 236)
Draw.Line (30, 55, 70, 95, 0)
fr2 := Pic.New (50, 55, 95, 95)
Draw.Cls
Draw.FillOval (50, 75, 22, 22, 0)
Draw.FillOval (50, 75, 20, 20, 255)
Draw.FillOval (50, 75, 2, 2, 236)
Draw.Line (30, 75, 75, 75, 0)
fr3 := Pic.New (50, 55, 95, 95)
Draw.Cls
Draw.FillOval (50, 75, 22, 22, 0)
Draw.FillOval (50, 75, 20, 20, 255)
Draw.FillOval (50, 75, 2, 2, 236)
Draw.Line (30, 95, 70, 55, 0)
fr4 := Pic.New (50, 55, 95, 95)
Draw.Cls
% Body
Draw.FillOval (100, 100, 100, 25, 12)
Draw.FillOval (190, 100, 8, 5, 0)
Draw.FillOval (3, 108, 3, 10, 12)
% Cab
Draw.ThickLine (50, 120, 70, 150, 4, 12)
Draw.ThickLine (150, 120, 130, 150, 4, 12)
Draw.ThickLine (130, 150, 70, 150, 4, 12)
Draw.ThickLine (100, 120, 100, 150, 4, 12)
Draw.Line (99, 75, 99, 152, 0)
Draw.FillOval (60, 115, 4, 1, 0)
Draw.FillOval (110, 115, 4, 1, 0)
picture := Pic.New (0, 0, 220, 199)
Draw.Cls
loop
for i : 0 .. 600 by 10
Pic.Draw (picture, 0 + i, 0, picCopy)
Pic.Draw (fr1, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr2, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr3, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr4, 0 + i, 0, picCopy)
Draw.Cls
Time.Delay (20)
Draw.Cls
end for
picture := Pic.Mirror (picture)
for decreasing i : 600 .. 0 by 10
Pic.Draw (picture, 0 + i, 0, picCopy)
Pic.Draw (fr1, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr2, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr3, 0 + i, 0, picCopy)
Draw.Cls
Pic.Draw (fr4, 0 + i, 0, picCopy)
Draw.Cls
Time.Delay (20)
Draw.Cls
end for
picture := Pic.Mirror (picture)
end loop
|
|
|
|
|
|
![](images/spacer.gif) |
Viper
![](http://compsci.ca/v3/uploads/user_avatars/20678142424cb7690e076fe.jpg)
|
Posted: Fri Nov 26, 2004 3:34 pm Post subject: (No subject) |
|
|
check out ma truck in the submissions page i got spinners on it <Ma pimpin truck> |
|
|
|
|
![](images/spacer.gif) |
|
|