
-----------------------------------
coderselite
Thu Dec 13, 2018 7:09 pm

Quitting Program
-----------------------------------
What is the command for halting a program in the middle of the screen. I want the boat to stop at the shore without exiting the background. Also, I need help with buffering in this animation. A comment would be more than greatly appreciated!

Code:

%make the fourth background of a boat landing on the shore%the boat has started off in America and is now about to reach India
View.Set ('graphics,offsreenonly')

for i : 1 .. maxx by 1

    %draw the background light blue colour
    Draw.FillBox (0, 0, maxx, maxy, 78)

    %add water to about half the scenen for the boat to land in India and finally reach shore
    drawfillbox (340, 59, 0, 0, blue)

    %draw a tree
    drawfillbox (380, 85, 410, 167, 112)
    drawfillbox (356, 148, 436, 222, green)

    %a cloud can be made by using multiple drawfillovals command
    drawfilloval (95, 363, 15, 15, 30)
    drawfilloval (118, 347, 15, 15, 30)
    drawfilloval (98, 341, 15, 15, 30)
    drawfilloval (150, 359, 15, 15, 30)
    drawfilloval (133, 380, 15, 15, 30)
    drawfilloval (134, 360, 15, 15, 30)
    drawfilloval (111, 389, 15, 15, 30)
    drawfilloval (148, 342, 15, 15, 30)
    drawfilloval (176, 361, 20, 20, 30)
    drawfilloval (159, 381, 20, 20, 30)
    drawfilloval (203, 381, 20, 20, 30)
    drawfilloval (180, 388, 10, 10, 30)
    drawfilloval (218, 356, 20, 20, 30)
    drawfilloval (197, 352, 15, 15, 30)
    drawfilloval (110, 374, 20, 20, 30)
    drawfilloval (70, 355, 20, 20, 30)
    drawfilloval (74, 379, 20, 20, 30)
    drawfilloval (94, 393, 15, 15, 30)
    drawfilloval (135, 392, 15, 15, 30)

    %add a shore and a beach effect up close for the boat to land on
    Draw.FillArc (560, 0, 250, 120, 360, 180, brown)

    %draw the back of the boat
    drawline (i + 24, 65 + 10, i + 34, 49 + 10, 114)
    drawline (i + 24, 65 + 10, i + 19, 95 - 20, 114)
    drawline (i + 19, 65 + 10, i + 9, 77 + 10, 114)
    drawline (i + 9, 77 + 10, i + 1, 77 + 10, 114)
    drawline (i + 1, 77 + 10, i, 86 + 10, 114)

    %draw the bottom of the boat
    drawline (i + 198, 49 + 10, i + 34, 49 + 10, 114)

    %draw the front of the boat(hull)
    drawline (i + 198, 49 + 10, i + 195, 98 + 10, 114)
    drawline (i + 195, 86 + 10, i + 195, 98 + 10, 114)
    drawline (i + 195, 86 + 10, i, 86 + 10, 114)

    %draw a flag on top of the boat
    drawline (i + 115, 86 + 10, i + 115, 143 + 10, 114)
    drawline (i + 115, 143 + 10, i + 142, 130 + 10, 114)
    drawline (i + 115, 118 + 10, i + 142, 130 + 10, 114)

    %draw fill the boat

    drawfill (i + 119, 70 + 10, 114, 114)
    drawfill (i + 124, 129 + 10, red, 114)

    View.Update
    delay (15)
    cls
    exit when (i = 130)

end for

-----------------------------------
coderselite
Thu Dec 13, 2018 7:26 pm

Re: Quitting Program
-----------------------------------
That above is only for Turing by the way. Wanted to mention to minimize confusions Waiting for a reply, Thanks :D  :lol:

-----------------------------------
Srlancelot39
Mon Dec 17, 2018 8:33 am

RE:Quitting Program
-----------------------------------
What do you mean by "halting" the program?  And why do you need it to halt?

Also, use the code tags around your code to format it for easier reading.
Example:
This:
[.code] %code here [./code] (Remove '.')
produces:
[code] %code here [/code]

-----------------------------------
Insectoid
Mon Dec 17, 2018 5:37 pm

RE:Quitting Program
-----------------------------------
You can easily do this by modifying your for loop. Where is the middle of the screen? You clearly know about the Maxx command. I'd guess the middle of the screen is somewhere between 0 and maxx, wouldn't you?

You shouldn't use 'exit when' in a for loop. That's the point of a for loop, it ends when you want it to. 'for i : 1..maxx' means stop at Maxx, so why would you need to exit when i=130? If you want to stop at 130 then run for i : 1..130. There's no need for both.
