
-----------------------------------
asianrandy
Fri Dec 26, 2008 8:40 pm

help with animation
-----------------------------------
i help with animation because i have a problem. first lm trying to do is making robot moves first than move the tanks.

% Randy Phalla TIK 20 - Computer and Information Science Culminationg Activity
%
setscreen ("graphics:1010;670")
View.Set ("offscreenonly")
var background : int;

% Background
drawfillbox (0, 0, maxx, maxy, black)

% Field
drawfillbox (1, 150, 1010, 1, red)

% Tank
drawfillbox (60, 20, 140, 4, green) % bottom Body
drawfillbox (70, 50, 110, 20, green) % top
drawfillbox ( 70, 50, 150, 40, green) % Cannon

% 2 tank
drawfillbox ( 400, 83, 300, 100, green) % Bottom body
drawfillbox ( 350,100, 310, 130, green) % middle
drawfillbox ( 420,130, 310, 140, green) % Cannon

% City
drawfillbox (1000, 300, 950, 10, gray)
drawfillbox (880, 300, 830, 10, gray)
drawfillbox (950, 100, 880, 10, gray)

% Windows
drawfillbox (900, 70, 840, 100, yellow)


background := Pic.New (0, 0, maxx, maxy)
for i : 0 .. 50
    cls
     Pic.Draw (background, 0, 0, picCopy)
%Transfomer
drawfillbox (800-i*2, 300, 670-i*2, 500, red) %body
drawfillbox (540-i*2, 470, 670-i*2, 500, blue)  % right arm
drawfillbox (800-i*2, 470, 920-i*2, 500, blue)  % left arm
drawfillbox (770-i*2, 570, 700-i*2, 500, black) % Head
drawfillbox (770-i*2, 600, 790-i*2, 500, blue) % ears
drawfillbox (700-i*2, 600, 677-i*2, 500, blue) %ears
drawfillbox (730-i*2, 170, 670-i*2, 300, blue) %right leg
drawfillbox (740-i*2, 170, 800-i*2, 299, blue) % left leg
drawfillbox (770-i*2, 575, 700-i*2, 571, gray) %top of the head  
drawfillbox (700-i*2, 530, 770-i*2, 500, gray)% Month
drawfillbox (770-i*2, 505, 700-i*2, 500, black)
drawfillbox (770-i*2, 510, 700-i*2, 515, black)
drawfillbox (770-i*2, 525, 700-i*2, 520, black)
drawfillbox (670-i*2, 180, 730-i*2, 170, gray)% left foot
drawfillbox (740-i*2, 180, 800-i*2, 170, gray)% left foot
View.Update
            delay (90)
        end for

-----------------------------------
BigBear
Fri Dec 26, 2008 9:36 pm

Re: help with animation
-----------------------------------
Make a seperate loop to move the tanks the same way you moved the robot

-----------------------------------
asianrandy
Sat Dec 27, 2008 8:47 pm

RE:help with animation
-----------------------------------
i got an error.

% Randy Phalla TIK 20 - Computer and Information Science Culminationg Activity
%
setscreen ("graphics:1010;670")
View.Set ("offscreenonly")
var background : int;

% Background
drawfillbox (0, 0, maxx, maxy, black)

% Field
drawfillbox (1, 150, 1010, 1, red)

% Tank
drawfillbox (60, 20, 140, 4, green) % bottom Body
drawfillbox (70, 50, 110, 20, green) % top
drawfillbox (70, 50, 150, 40, green)  % Cannon

% 2 tank
drawfillbox (400, 83, 300, 100, green)  % Bottom body
drawfillbox (350, 100, 310, 130, green) % middle
drawfillbox (420, 130, 310, 140, green) % Cannon

% City
drawfillbox (1000, 300, 950, 10, gray)
drawfillbox (880, 300, 830, 10, gray)
drawfillbox (950, 100, 880, 10, gray)

% Windows
drawfillbox (900, 70, 840, 100, yellow)


background := Pic.New (0, 0, maxx, maxy)
for i : 0 .. 50
    cls
    Pic.Draw (background, 0, 0, picCopy)
    %Transfomer
    drawfillbox (800 - i * 2, 300, 670 - i * 2, 500, red) %body
    drawfillbox (540 - i * 2, 470, 670 - i * 2, 500, blue) % right arm
    drawfillbox (800 - i * 2, 470, 920 - i * 2, 500, blue) % left arm
    drawfillbox (770 - i * 2, 570, 700 - i * 2, 500, black) % Head
    drawfillbox (770 - i * 2, 600, 790 - i * 2, 500, blue) % ears
    drawfillbox (700 - i * 2, 600, 677 - i * 2, 500, blue) %ears
    drawfillbox (730 - i * 2, 170, 670 - i * 2, 300, blue) %right leg
    drawfillbox (740 - i * 2, 170, 800 - i * 2, 299, blue) % left leg
    drawfillbox (770 - i * 2, 575, 700 - i * 2, 571, gray) %top of the head
    drawfillbox (700 - i * 2, 530, 770 - i * 2, 500, gray) % Month
    drawfillbox (770 - i * 2, 505, 700 - i * 2, 500, black)
    drawfillbox (770 - i * 2, 510, 700 - i * 2, 515, black)
    drawfillbox (770 - i * 2, 525, 700 - i * 2, 520, black)
    drawfillbox (670 - i * 2, 180, 730 - i * 2, 170, gray) % left foot
    drawfillbox (740 - i * 2, 180, 800 - i * 2, 170, gray) % left foot
    View.Update
    delay (90)

    loop

        % Tank
        drawfillbox (60 - i * 2, 20, 140 - i * 2, 4, green)     % bottom Body
        drawfillbox (70 - i * 2, 50, 110 - i * 2, 20, green)     % top
        drawfillbox (70 - i * 2, 50, 150 - i * 2, 40, green)     % Cannon

        % 2 tank
        drawfillbox (400 - i * 2, 83, 300 - i * 2, 100, green)     % Bottom body
        drawfillbox (350 - i * 2, 100, 310 - i * 2, 130, green)     % middle
        drawfillbox (420 - i * 2, 130, 310 - i * 2, 140, green)     % Cannon
        View.Update
        delay (90)

    end for

-----------------------------------
revangrey
Mon Dec 29, 2008 12:01 am

Re: help with animation
-----------------------------------
I think you are supposed to put "end loop" somewhere...


and you spelled culminating wrong...

-----------------------------------
asianrandy
Mon Dec 29, 2008 12:27 am

RE:help with animation
-----------------------------------
i did and noting happened, there was no movement.

-----------------------------------
syntax_error
Mon Dec 29, 2008 3:02 am

RE:help with animation
-----------------------------------
Then trace through your code.

-----------------------------------
asianrandy
Mon Dec 29, 2008 2:12 pm

RE:help with animation
-----------------------------------
i did but it feel like no problem with it but the only problem their is no movement.

i put end loop and end for at the end.

-----------------------------------
Tony
Mon Dec 29, 2008 5:38 pm

RE:help with animation
-----------------------------------
What's happening inside the loop? When does the loop exit?

-----------------------------------
asianrandy
Mon Dec 29, 2008 7:05 pm

RE:help with animation
-----------------------------------
inside the loop, their are movement first l'm trying is making the transformer moved first and than moved the tank toward to the transformer. and that how the loop should end.

-----------------------------------
Tony
Mon Dec 29, 2008 7:18 pm

Re: RE:help with animation
-----------------------------------
and that how the loop should end.
A computer does not try to guess what you want it to do. It blindly executes all of the instructions, precisely, trusting you not to make it do anything stupid.

With that in mind, give the above questions another go.

-----------------------------------
asianrandy
Mon Dec 29, 2008 7:34 pm

RE:help with animation
-----------------------------------
i need help because their no movement, first the transformer moves first and then the tanks move after. when i start the program, their is no movement. Need some tips to improve this program. 


% Randy Phalla TIK 20 - Computer and Information Science Culminationg Activity
setscreen ("graphics:1010;670")
View.Set ("offscreenonly")
var background : int;

% Background
drawfillbox (0, 0, maxx, maxy, black)

% Field
drawfillbox (1, 150, 1010, 1, red)

% City
drawfillbox (1000, 300, 950, 10, gray)
drawfillbox (880, 300, 830, 10, gray)
drawfillbox (950, 100, 880, 10, gray)

% Windows
drawfillbox (900, 70, 840, 100, yellow)

background := Pic.New (0, 0, maxx, maxy)
for i : 0 .. 50
    cls
    Pic.Draw (background, 0, 0, picCopy)
    %Transfomer
    drawfillbox (800 - i * 2, 300, 670 - i * 2, 500, red) %body
    drawfillbox (540 - i * 2, 470, 670 - i * 2, 500, blue) % right arm
    drawfillbox (800 - i * 2, 470, 920 - i * 2, 500, blue) % left arm
    drawfillbox (770 - i * 2, 570, 700 - i * 2, 500, black) % Head
    drawfillbox (770 - i * 2, 600, 790 - i * 2, 500, blue) % ears
    drawfillbox (700 - i * 2, 600, 677 - i * 2, 500, blue) %ears
    drawfillbox (730 - i * 2, 170, 670 - i * 2, 300, blue) %right leg
    drawfillbox (740 - i * 2, 170, 800 - i * 2, 299, blue) % left leg
    drawfillbox (770 - i * 2, 575, 700 - i * 2, 571, gray) %top of the head
    drawfillbox (700 - i * 2, 530, 770 - i * 2, 500, gray) % Month
    drawfillbox (770 - i * 2, 505, 700 - i * 2, 500, black)
    drawfillbox (770 - i * 2, 510, 700 - i * 2, 515, black)
    drawfillbox (770 - i * 2, 525, 700 - i * 2, 520, black)
    drawfillbox (670 - i * 2, 180, 730 - i * 2, 170, gray) % left foot
    drawfillbox (740 - i * 2, 180, 800 - i * 2, 170, gray) % left foot
    View.Update
    delay (90)

    loop

        % Tank
        drawfillbox (60 - i * 2, 20, 140 - i * 2, 4, green)     % bottom Body
        drawfillbox (70 - i * 2, 50, 110 - i * 2, 20, green)     % top
        drawfillbox (70 - i * 2, 50, 150 - i * 2, 40, green)     % Cannon

        % 2 tank
        drawfillbox (400 - i * 2, 83, 300 - i * 2, 100, green)     % Bottom body
        drawfillbox (350 - i * 2, 100, 310 - i * 2, 130, green)     % middle
        drawfillbox (420 - i * 2, 130, 310 - i * 2, 140, green)     % Cannon
        View.Update
        delay (90)
        
    end loop
end for

-----------------------------------
Tony
Mon Dec 29, 2008 10:53 pm

RE:help with animation
-----------------------------------
Do you understand how for loop works?
Do you understand how loop works?
In your code, how many times will the loop run?

The answer to the last question will lead you towards the explanation why your program draws the same thing, in the same place.

-----------------------------------
syntax_error
Mon Dec 29, 2008 11:25 pm

RE:help with animation
-----------------------------------
You don't need the loop, remove it and try it again.

-----------------------------------
A.J
Tue Dec 30, 2008 1:17 pm

Re: help with animation
-----------------------------------
I'd really advise u to look into procedures, so that you can arrange your code into the smaller chunks of code with specific goals instead of drawing all the boxes in the main animation loop...

secondly, I'll advise u to not draw the boxes with specific numbers. Rather, try drawing them with respect to the center of the screen.

That way, it will be easier to figure out what direction to go, and it will also be easier to make changes (or debug).

-----------------------------------
asianrandy
Tue Dec 30, 2008 11:59 pm

RE:help with animation
-----------------------------------
i don't know how to use procedures like drawing boxes.

-----------------------------------
A.J
Wed Dec 31, 2008 4:21 am

Re: help with animation
-----------------------------------
well...look it up in the Turing Walkthrough...
