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

Username:   Password: 
 RegisterRegister   
 help with animation
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
asianrandy




PostPosted: Fri Dec 26, 2008 8:40 pm   Post subject: 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.

code:
% 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
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Fri Dec 26, 2008 9:36 pm   Post subject: Re: help with animation

Make a seperate loop to move the tanks the same way you moved the robot
asianrandy




PostPosted: Sat Dec 27, 2008 8:47 pm   Post subject: RE:help with animation

i got an error.

code:
% 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




PostPosted: Mon Dec 29, 2008 12:01 am   Post subject: Re: help with animation

I think you are supposed to put "end loop" somewhere...


and you spelled culminating wrong...
asianrandy




PostPosted: Mon Dec 29, 2008 12:27 am   Post subject: RE:help with animation

i did and noting happened, there was no movement.
syntax_error




PostPosted: Mon Dec 29, 2008 3:02 am   Post subject: RE:help with animation

Then trace through your code.
asianrandy




PostPosted: Mon Dec 29, 2008 2:12 pm   Post subject: 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




PostPosted: Mon Dec 29, 2008 5:38 pm   Post subject: RE:help with animation

What's happening inside the loop? When does the loop exit?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
asianrandy




PostPosted: Mon Dec 29, 2008 7:05 pm   Post subject: 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




PostPosted: Mon Dec 29, 2008 7:18 pm   Post subject: Re: RE:help with animation

asianrandy @ Mon Dec 29, 2008 7:05 pm wrote:
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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
asianrandy




PostPosted: Mon Dec 29, 2008 7:34 pm   Post subject: 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.


code:
% 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




PostPosted: Mon Dec 29, 2008 10:53 pm   Post subject: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
syntax_error




PostPosted: Mon Dec 29, 2008 11:25 pm   Post subject: RE:help with animation

You don't need the loop, remove it and try it again.
A.J




PostPosted: Tue Dec 30, 2008 1:17 pm   Post subject: 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




PostPosted: Tue Dec 30, 2008 11:59 pm   Post subject: RE:help with animation

i don't know how to use procedures like drawing boxes.
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 2  [ 16 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: