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

Username:   Password: 
 RegisterRegister   
 Launching Animation
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dragsz




PostPosted: Mon Jan 26, 2015 10:19 pm   Post subject: Launching Animation

What is it you are trying to achieve?
Create an animation of a spaceship launching off.


What is the problem you are having?
Before the actual lift off, I want to have looped grass that
continuously changes until the user presses a button to
start the animation. I don't know how to add colour to this
part of the code.


Describe what you have tried to solve this problem
I tried continously drawing a fill in the grass through a loop, but it produces a black screen.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>
loop

%Launch Pad
drawline (100, 20, 100, 50, black)
drawline (539, 20, 539, 50, black)
drawline (100, 50, 539, 50, black)

%Ship
drawarc (287, 275, 75, 125, 0, 65, black)
drawarc (351, 275, 75, 125, 115, 180, black)
drawline (276, 277, 276, 97, black)
drawline (362, 277, 362, 97, black)
drawarc (319, 100, 44, 20, 180, 0, black)

%Ship Details
drawarc (319, 315, 25, 30, 0, 180, black)
drawarc (319, 308, 25, 30, 0, 180, black)
drawarc (319, 350, 25, 27, 15, 165, black)

%Ship sides
drawline (276, 200, 226, 125, black)
drawline (276, 195, 226, 120, black)
drawline (226, 125, 226, 70, black)
drawline (226, 70, 276, 100, black)

drawline (362, 200, 412, 125, black)
drawline (362, 195, 412, 120, black)
drawline (412, 125, 412, 70, black)
drawline (412, 70, 362, 100, black)

%Ship Propeller
drawline (290, 85, 305, 65, black)
drawline (348, 85, 333, 65, black)
drawline (305, 65, 333, 65, black)

%Changing Grass
var Tip, Bottom, minTip, maxTip : int
exit when hasch
Bottom := 0
minTip := 0
maxTip := 19
for i : 0 .. 32
    randint (Tip, minTip, maxTip)
    drawline (Bottom, 20, Tip, 30, black)
    Bottom := Bottom + 20
    drawline (Tip, 30, Bottom, 20, black)
    minTip := minTip + 20
    maxTip := maxTip + 20
end for
delay (500)
cls

end loop

%Colour that I want to add
drawfill(319, 1, green, black)
drawfill (319, 40, black, black)
drawfill (319, 344, black, black)
drawfill (319, 380, black, black)
drawfill (364, 196, black, black)
drawfill (319, 70, black, black)





Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Sun Feb 01, 2015 1:30 pm   Post subject: Re: Launching Animation

To solve your problem, lets consider the drawfill() procedure you are using. In the Keyword Reference for Turing the following information is given to us:

Syntax: drawfill (x, y : int, fillColor, borderColor : int)
Description: The drawfill procedure is used to color in a figure that is on the screen. Starting at (x, y), the figure is filled with fillColor to a surrounding border whose color is borderColor.

If you can answer these questions, you can solve your problem:

1) How does the drawfill procedure know which color to use when filling a shape?
2) How does the drawfill procedure know the perimeter of a shape?
3) What happens if the drawfill procedure tries to fill a shape whose sides are not connected?

The following program may also come in handy for visualizing how drawfill() works.
Turing:

/*  This program is made to illustrate what happens when the drawfill
    procedure is used on an open shape */

% Notice the pattern is to draw a line and then pause.
drawline (15, 15, 45, 15, black)
    delay (750)
drawline (45, 15, 45, 45, black)
    delay (750)
drawline (45, 45, 15, 45, black)
    delay (750)
drawline (15, 45, 15, 15, black)
    delay (1500) % A slightly longer pause
drawfill (16, 16, green, black) % The first drawfill
    delay (750)
drawline (215, 215, 245, 215, black)
    delay (750)
drawline (245, 215, 245, 245, black)
    delay (750)
drawline (245, 245, 215, 245, black)
    delay (750)
drawline (215, 245, 215, 220, black)
    delay (1500)
drawfill (216, 216, green, black) % The final drawfill


Good luck!
amz_best




PostPosted: Mon Feb 02, 2015 7:59 pm   Post subject: RE:Launching Animation

Use Draw.ThickLine (x, y, x2, y2, lineThickness, lineColor). This will keep the filling inside the Shapes.
Dragsz




PostPosted: Tue Mar 17, 2015 6:23 pm   Post subject: RE:Launching Animation

Well I'm done with this animation. Here's the code for fun Smile

Turing:

%Name: ----- ---- **************Spaceship Launch********************
%Date: --/--/---- *****************Animation************************


setscreen ("graphics:640;400") %Sets graphics screen to 640x400 pixels
View.Set ("offscreenonly")
%Variables
var ship : int %Stores the ship drawing
var x, y, star, whitestar : int %Location of stars, (x,y) and draw the stars in each frame
var fire : array 1 .. 2 of int %var Fire (1) & (2) used to draw fire
var fires : int %Stores the fire drawing

%Fonts
var font1 := Font.New ("Bauhaus 93:30")
var font2 := Font.New ("Bauhaus 93:12")
var font3 := Font.New ("Times:12")

%Draws the Spaceship
drawarc (287, 275, 75, 125, 0, 65, black)
drawarc (351, 275, 75, 125, 115, 180, black)
drawline (276, 277, 276, 97, black)
drawline (362, 277, 362, 97, black)
drawarc (319, 100, 44, 20, 180, 0, black)
drawarc (319, 315, 25, 30, 0, 180, black)
drawarc (319, 308, 25, 30, 0, 180, black)
drawarc (319, 350, 25, 27, 15, 165, black)
drawline (276, 200, 226, 125, black)
drawline (276, 195, 226, 120, black)
drawline (226, 125, 226, 70, black)
drawline (226, 70, 276, 100, black)
drawline (362, 200, 412, 125, black)
drawline (362, 195, 412, 120, black)
drawline (412, 125, 412, 70, black)
drawline (412, 70, 362, 100, black)
drawline (290, 85, 305, 65, black)
drawline (348, 85, 333, 65, black)
drawline (305, 65, 333, 65, black)
drawfill (319, 100, 30, black)
drawfill (236, 125, 30, black)
drawfill (402, 125, 30, black)
drawfill (319, 344, 15, black)
drawfill (319, 380, 15, black)
drawfill (274, 196, 15, black)
drawfill (364, 196, 15, black)
drawfill (319, 70, 15, black)

%Draws a star
drawfillstar (1, 1, 5, 5, yellow)

%Draws a whitestar
drawfillbox (10, 10, 12, 12, white)

%Stores the pictures of the ship, star, and whitestar to the corresponding vars
ship := Pic.New (226, 65, 412, 390)
star := Pic.New (1, 1, 5, 5)
whitestar := Pic.New (10, 10, 12, 12)
cls
%----------------------------------------1st Frame------------------------------
loop %Loops frame until key is pressed

    %Background
    for decreasing C : 9 .. 0 %C used to determine y and colour
        drawfilloval (319, C * 40, 400, 100, C + 90) %Draws different colour ovals at 40 pixels higher each time
    end for
    exit when hasch %Exits when button is pressed

    %Launch Pad
    drawline (100, 20, 100, 50, black)
    drawline (539, 20, 539, 50, black)
    drawline (100, 50, 539, 50, black)

    %Changing Grass
    var grass : array 1 .. 3 of int := init (0, 0, 19)
    var Tip : int
    for i : 0 .. 32
        randint (Tip, grass (2), grass (3)) %Assigns values from 0-19 for the value of tip
        drawline (grass (1), 20, Tip, 30, black) %Draws from the base to the tip of the grass
        grass (1) := grass (1) + 20 %Moves over 20 pixels and redraws
        drawline (Tip, 30, grass (1), 20, black) %Draws from the tip to the base of the grass
        grass (2) := grass (2) + 20 %Moves over 20 pixels and redraws
        grass (3) := grass (3) + 20 %Moves over 20 pixels and redraws
    end for

    %Ship
    Pic.Draw (ship, 226, 75, picMerge) %Draws the pic of the ship stored in var ship, at the stated coordinates.

    %Colour
    drawfill (319, 1, green, black) %Colours the grass
    drawfill (319, 40, black, black) %Colours the launch pad

    %Words
    Font.Draw ("Spaceship Animation", 140, 200, font1, red)
    Font.Draw ("By: Anson Tran", 160, 180, font2, red)
    Font.Draw ("<<Press any key to begin>>", 230, 10, font3, yellow)

    View.Update
    delay (500) %Delays each frame
    cls %Clears screen
end loop
cls
%-----------------------------------2nd Frame----------------------------------

%Background
for decreasing C : 9 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 91) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%----------------------------------3rd Frame----------------------------------
%Background
for decreasing C : 9 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 92) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%----------------------------------4th Frame----------------------------------

%Background
for decreasing C : 9 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 93) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%-----------------------------------5th Frame---------------------------------
%Background
for decreasing C : 9 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 94) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%----------------------------------6th Frame----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 8 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%----------------------------------7th Frame---------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 7 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------8th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 6 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------9th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 5 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------10th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 4 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------11th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 3 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------12th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 2 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------13th Frame-----------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 1 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%--------------------------------14th Frame------------------------------------
%Stars
drawfillbox (1, 1, maxx, maxy, black) %Draws space
for i : 1 .. 20 %Draws 20 stars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (star, x, y, picMerge)
end for
for i : 1 .. 40 %Draws 40 whitestars
    randint (x, 0, maxx)
    randint (y, 0, maxy)
    Pic.Draw (whitestar, x, y, picCopy)
end for

%Background
for decreasing C : 0 .. 0 %C used to determine y and colour
    drawfilloval (319, C * 40, 400, 100, C + 95) %Draws from top to bottom, the background, 40 pixels apart
end for

%Ship
Pic.Draw (ship, 226, 75, picMerge) %Draws ship ontop of the background

%Fire
randint (fire (1), 1, 5) %Randomizes the length of the fire
randint (fire (2), 30, 50) %Randomizes the thickness of the fire
drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
drawfill (319, 25 - fire (1), 40, black) %Colours the fire

View.Update
delay (500) %Delays 1/2 a second
cls %Clears screen
%---------------------------15th Frame---------------------------------------
loop
    %Fire
    randint (fire (1), 1, 5) %Randomizes the length of the fire
    randint (fire (2), 30, 50) %Randomizes the thickness of the fire
    drawarc (319, 25 - fire (1), fire (2), 50 + fire (1), 0, 180, black) %Draws Fire
    drawarc (319 - 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 20, 180, black) %Draws Fire
    drawarc (319 + 2 * fire (2) div 3, 25 - fire (1), fire (2) div 3, 20, 0, 160, black) %Draws Fire
    drawarc (319 - fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 0, 105, black) %Draws Fire
    drawarc (319 + fire (2) div 3, 15 - fire (1), fire (2) div 3, 20, 75, 180, black) %Draws Fire
    drawfill (319, 25 - fire (1), 40, black) %Colours the fire
    fires := Pic.New (319 - fire (2), 15 - fire (1), 319 + fire (2), 75)
    cls
    drawfillbox (1, 1, maxx, maxy, black)

    %Stars
    drawfillbox (1, 1, maxx, maxy, black) %Draws space
    for i : 1 .. 20 %Draws 20 stars
        randint (x, 0, maxx)
        randint (y, 0, maxy)
        Pic.Draw (star, x, y, picMerge)
    end for
    for i : 1 .. 40 %Draws 40 whitestars
        randint (x, 0, maxx)
        randint (y, 0, maxy)
        Pic.Draw (whitestar, x, y, picCopy)
    end for

    %Ship
    Pic.Draw (ship, 226, 75, picMerge) %Draws the ship

    %Fire
    Pic.Draw (fires, 319 - fire (2), 15 - fire (1), picMerge) %Draws the fire
    Pic.Free (fires)

    View.Update
    delay (500) %Delays 1/2 a second
    cls %Clears screen
end loop





Mod Edit: Please use the syntax tags.
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 1  [ 4 Posts ]
Jump to:   


Style:  
Search: