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

Username:   Password: 
 RegisterRegister   
 Amimation not exactly working. Please advise.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Honsly




PostPosted: Wed May 01, 2013 8:29 pm   Post subject: Amimation not exactly working. Please advise.

What is it you are trying to achieve?
I am trying to animate multiple stick figures to move at the same time.


What is the problem you are having?
One man will start moving, this is good. Next a new man will appear when the first man reaches the half-way point, this is also good.
The problem I cannot solve is that I would like the next man to start moving as soon as he appears, not wait until the first man disappears.


Describe what you have tried to solve this problem
I have tried using some if statements to move the second man as soon as he appears, but it does not work.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Can someone please help me move the second man as soon as he appears?
The code is underneath so you can have a better understanding of what I am saying.
Please feel free to modify anything and repost it so I may try it out and appreciate.


Turing:

setscreen ("graphics:max;max")
drawfillbox (0,0,maxx,maxy, 53)%Sets the sky
drawfillbox (0,0,maxx,maxy div 5, green)%Sets the grass
loop
    var lleg,larm : int := 460
    var rleg,rarm : int := 490
    var stick2 : int := 475
    drawline (lleg,127,stick2,150, black)%Student left leg
    drawline (rleg,127,stick2,150, black)%Student right leg
    drawline (stick2,150,stick2,170, black)%Student body
    drawline (larm,147,stick2,170, black)%Student left arm
    drawline (rarm,147,stick2,170, black)%Student right arm
    drawfilloval (stick2,180,10,10, black)%Student head
    loop
        drawline (lleg,127,stick2,150, black)%Student left leg
        drawline (rleg,127,stick2,150, black)%Student right leg
        drawline (stick2,150,stick2,170, black)%Student body
        drawline (larm,147,stick2,170, black)%Student left arm
        drawline (rarm,147,stick2,170, black)%Student right arm
        drawfilloval (stick2,180,10,10, black)%Student head
        lleg := lleg + 1
        rleg := rleg + 1
        larm := larm + 1
        rarm := rarm + 1
        stick2 := stick2 + 1
        delay (10)
        drawline (lleg - 1,127,stick2 - 1,150, 53)%Student left leg
        drawline (rleg - 1,127,stick2 - 1,150, 53)%Student right leg
        drawline (stick2 - 1,150,stick2 - 1,170, 53)%Student body
        drawline (larm - 1,147,stick2 - 1,170, 53)%Student left arm
        drawline (rarm - 1,147,stick2 - 1,170, 53)%Student right arm
        drawfilloval (stick2 - 1,180,10,10, 53)%Student head
        exit when stick2 = maxx
        if stick2 = maxx div 2 then
            drawline (460,127,475,150, black)%Student left leg
            drawline (490,127,475,150, black)%Student right leg
            drawline (475,150,475,170, black)%Student body
            drawline (460,147,475,170, black)%Student left arm
            drawline (490,147,475,170, black)%Student right arm
            drawfilloval (475,180,10,10, black)%Student head
        end if
    end loop
end loop




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




PostPosted: Wed May 01, 2013 9:54 pm   Post subject: RE:Amimation not exactly working. Please advise.

follow your code line by line, and imagine it running on a computer. You'll be waiting for the inside loop to exit, before turning to the outside loop.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: