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

Username:   Password: 
 RegisterRegister   
 Animation glitch?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
cycro1234




PostPosted: Wed Oct 27, 2004 6:37 pm   Post subject: Animation glitch?

Hello! I'm using Pic.Draw nd Pic.New to do some animations. However, I get a weird thing happening when my objects are moved in one direction. They dissapear when they get beyond a certain point. And it's not coz my for loop ends. The picture will move move move nd then start to disapear as if it is being erased. Ne ideas?
Sponsor
Sponsor
Sponsor
sponsor
cycro1234




PostPosted: Wed Oct 27, 2004 7:19 pm   Post subject: (No subject)

Plz...??? Ne1??? I really want to know how to fix it!
cycro1234




PostPosted: Wed Oct 27, 2004 7:24 pm   Post subject: (No subject)

Do I realy have to start talking to myself again??? Crying or Very sad
Mazer




PostPosted: Wed Oct 27, 2004 7:24 pm   Post subject: (No subject)

It'd help to see some code. Off the top of my head, I'm guessing that perhaps you are making the picture using Pic.New and specifying coordinates on the screen. And that you may have Pic.New in the loop so that the picture is being retaken each frame and it's only getting part of the picture because it has moved. Am I close?
cycro1234




PostPosted: Wed Oct 27, 2004 7:26 pm   Post subject: (No subject)

heres my file...remember im in gr 9 and have been workin wit turing for about 1 month!


my creation.t
 Description:
Animation

Download
 Filename:  my creation.t
 Filesize:  4.71 KB
 Downloaded:  122 Time(s)

Mazer




PostPosted: Wed Oct 27, 2004 7:41 pm   Post subject: (No subject)

You only need to make the picture once.
This section of code:
code:

var y : int
for z : 0 .. 97
    y := Pic.New (49, 199, 151, 301)
    delay (5)
    Pic.Draw (y, 50, 97 - z, picMerge)
end for

Would be better as:
code:

var y : int
y := Pic.New (49, 199, 151, 301)
for z : 0 .. 97
    delay (5)
    Pic.Draw (y, 50, 97 - z, picMerge)
end for


In fact, change the whole bounce part to this:
code:

var y : int
y := Pic.New (49, 199, 151, 301)
for z : 0 .. 97
    Pic.Draw (y, 50, 97 - z, picMerge)
    delay (5)
    drawfilloval (100, 250, 51, 51, yellow)
end for
var z : int
for a : 0 .. 100
    Pic.Draw (y, 50, 0 + a, picMerge)
    delay (5)
    drawfilloval (100, 250, 51, 51, yellow)
end for
var b : int
for decreasing x : 100 .. 0
    delay (25)
    Pic.Draw (y, 50, x, picMerge)
end for
cycro1234




PostPosted: Wed Oct 27, 2004 7:47 pm   Post subject: (No subject)

Wow dude ur a genious!! Thx so much!! But cud u plz explain what i was doing rong?? So that i cud do the rest of the animation myself?? Unles..u wana help me out? Laughing
Mazer




PostPosted: Wed Oct 27, 2004 8:18 pm   Post subject: (No subject)

Of course I'll explain what was wrong in order for you to continue writing the rest of the code!

Here's what you wanted to do:
-draw the basketball (once)
-make a picture (using Pic.New) of the ball
-loop, and move the picture of the ball

Here's kind of what you did:
-draw the basketball (once)
-loop, and:
-make a picture (using Pic.New) of the ball
-and move the picture of the ball

The problem was (besides the fact that you shouldn't need to make the picture every frame) that the location of where the ball was being drawn was changing, but the location it was looking to get the picture was stationary.

Here's what I did to it:
-draw the basketball (once)
-make a picture (using Pic.New) of the ball
-loop and:
-blank out the spot where the ball was (drawfilloval...)
-move and draw the ball

You also had some other problem with the part where the ball bounced up. Your for loop only went up to 14 or so, and the next for loop was starting at 100.
Sponsor
Sponsor
Sponsor
sponsor
cycro1234




PostPosted: Wed Oct 27, 2004 8:22 pm   Post subject: (No subject)

Thx a lot once again! Laughing
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  [ 9 Posts ]
Jump to:   


Style:  
Search: