turing city animation help
Author |
Message |
robbief384
|
Posted: Wed Jan 15, 2014 7:52 pm Post subject: turing city animation help |
|
|
I need help on this turing project which is a command animation. i have the background code but i need someone to help me with a car crash, clouds moving thats all here is the code i have right now
var ID1, ID2, x, y: int
setscreen ("graphics: 800, 600,")
drawfillbox (0, 0, 800, 600, 52)
drawline (0, 150, 800, 150, black)
drawfillbox (100, 150, 200, 400, 41)
drawfillbox (220, 150, 320, 300, blue)
drawfillbox (330, 150, 450, 500, grey)
drawfillbox (460, 150, 580, 500, grey)
drawfillbox (585, 150, 650, 250, red)
drawfillbox (660, 150, 790, 400, green)
drawfillbox (10, 150, 90, 300, green)
drawfillbox (0, 0, 800, 150, black)
for counter :160..380 by 30
drawfillbox (110, counter, 130,counter+20, yellow)
end for
for counter :160..380 by 30
drawfillbox (160, counter, 180, counter+20, yellow)
end for
for counter :160..260 by 30
drawfillbox (240, counter, 260, counter+20, yellow)
end for
for counter :160..260 by 30
drawfillbox (280, counter, 300, counter+20, yellow)
end for
for counter :160..480 by 30
drawfillbox (350, counter, 370, counter+20, yellow)
end for
for counter :160..480 by 30
drawfillbox (400, counter, 420, counter+20, yellow)
end for
for counter :160..480 by 30
drawfillbox (480, counter, 500, counter+20, white)
end for
for counter :160..480 by 30
drawfillbox (530, counter, 550, counter+20, white)
end for
for counter :160..230 by 30
drawfillbox (600, counter, 610, counter+20, yellow)
end for
for counter :160..230 by 30
drawfillbox (630, counter, 640, counter+20, yellow)
end for
for counter :160..380 by 30
drawfillbox (670, counter, 700, counter+20, black)
end for
for counter :160..380 by 30
drawfillbox (750, counter, 780, counter+20, black)
end for
for counter :160..270 by 30
drawfillbox (20, counter, 40, counter+20, grey)
end for
for counter :160..270 by 30
drawfillbox (65, counter, 85, counter+20, grey)
end for
for counter :25..775 by 30
drawfillbox (counter, 85, counter+20,75, yellow)
end for
%Car picture
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
GreatPumpkin
|
Posted: Wed Jan 15, 2014 9:19 pm Post subject: Re: turing city animation help |
|
|
Look into Pic.FileNew http://compsci.ca/holtsoft/doc/pic_filenew.html and Pic.Draw http://compsci.ca/holtsoft/doc/pic_draw.html to simplify drawing your city. You can draw the entire city as one in paint, save the image on your computer, and import it into turing for use.
Turing: |
View.Set ("graphics:800;600,offscreenonly") %% off screen only prevents flicker
%%%%%This sets up an array for the images and loads them into it%%%%
var backgroundPic : int %%new variable to hold the image file
backgroundPic := Pic.FileNew ("background.bmp") %backgroundPic is set to the image file
var carPic : int := Pic.FileNew ("car.bmp") % same as above but shortened to a single line
var carX : int := 0 %variable to hold the cars x coordinate
loop
%Draw
Pic.Draw (backgroundPic, 0, 0, picCopy) %%picCopy because we want the background redrawn out over everything on top
Pic.Draw (carPic, carX, 20, picMerge) %picMerge makes anything white in the image transparent
%%%%%%
%Movement
carX + = 1 %% increase carX by 1, resulting in the image to be drawn farther right on the screen
View.Update %updates screen
delay (20) % delays the loop by 50 milliseconds
end loop
|
Also look into collision detection, the concept can be used with two images.
http://compsci.ca/v3/viewtopic.php?t=13661
You will need to use an if statement to detect collision. If statements are the basis of all decisions made in a program.
Check out the Turing Walkthrough put together by members of this forum: http://compsci.ca/v3/viewtopic.php?t=8808
as well as the help file which came with turing: http://compsci.ca/holtsoft/doc/
Download the images and save them in the same folder as your turing file for this program.
Description: |
|
Filesize: |
73.18 KB |
Viewed: |
114 Time(s) |
|
Description: |
|
Filesize: |
1.83 MB |
Viewed: |
142 Time(s) |
|
|
|
|
|
|
|
|
|