
-----------------------------------
andxdreamxixdo
Sat Jan 08, 2005 5:17 pm

Animation Help
-----------------------------------
I am working on a project for my computer class, and after hours of staring blankly at the screen and asking for help from many people I have come here. I keep getting an error and I'm not too sure what it's about, so if anyone can help me, that would be great.

Draw.Line (10, 1, 25, 50, 25)  
Draw.Line (100, 100, 25, 50, 25)  
Draw.Line (25, 50, 25, 100, 25) 
Draw.Line (10, 75, 40, 100, 25) 
Draw.FillOval (25, 125, 25, 25, 25) 


fr1 := Pic.New (0, 0, 600, 600)  
Draw.Cls 

Draw.Line (25, 1, 25, 50, 155)  
Draw.Line (25, 100, 25, 50, 155)  
Draw.Line (25, 50, 25, 100, 155)  
Draw.Line (10, 100, 40, 75, 155)  
Draw.FillOval (25, 125, 25, 25, 155)  

fr2 := Pic.New (0, 0, 600, 600)  
Draw.Cls  

 

% Frame 3
Draw.Line (45, 1, 45, 50, 155)
Draw.Line  (45, 50, 10, 95, 155) 
Draw.Line (45, 50, 45, 100, 155)  
Draw.Line (30, 100, 65, 75, 155)  
Draw.FillOval (45, 125, 25, 25, 155) 

fr3 := Pic.New (0, 0, 600, 600)
Draw.Cls

%Frame 4
Draw.Line (45, 1, 45, 50, 7)
Draw.Line (45, 1, 45, 50, 7)
Draw.Line (45, 50, 45, 100, 7)
Draw.Line (30, 100, 65, 50, 7)
Draw.FillOval (45, 125, 25, 25, 7)

fr4 := Pic.New (0, 0, 600, 600)
Draw.Cls




loop 
    for i : 0 .. 600 by 25 
        Pic.Draw (fr1, i, 0, picCopy) 
        Time.Delay (100) 
        Pic.Draw (fr2, i, 0, picCopy) 
        Time.Delay (100) 
        Draw.Cls 
    end for 
    
% Animate the frames to make the stick man move back to where he started 

    for decreasing i : 600 .. 0 by 25 
        Pic.Draw (fr1, i, 0, picCopy) 
        Time.Delay (100) 
        Pic.Draw (fr2, i, 0, picCopy) 
        Time.Delay (100) 
        Draw.Cls 
    end for 

end loop



Based on a program from the turring submissions forum of this site.

-----------------------------------
Cervantes
Sat Jan 08, 2005 6:11 pm


-----------------------------------
(I'm assuming that's the entire code, and that there is not View.Set or setsceen anywhere before the code you posted.)
You're getting the error because the picture (taken by Pic.New) was not successfully created, as Turing kindly tells you.  Now, the reason it was not successfully created is because you are trying to take nothing and put it into a picture.  Apparently, Turing doesn't like having nothing in a picture.  The "nothing" I am talking about is not white background, but actually nothing.  See, you are taking a picture of (0,0,600, 600).  But, the screen only goes from (0,0) to (639, 339) (at least on my computer).  So, you are trying to take a picture of stuff (nothing) that is off the screen.
In short, to solve the problem, change:

fr1 := Pic.New (0, 0, 600, 600)

to

fr1 := Pic.New (0, 0, maxx, maxy)


-----------------------------------
andxdreamxixdo
Sat Jan 08, 2005 6:46 pm


-----------------------------------
hey thanx alot your a life saver.
