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

Username:   Password: 
 RegisterRegister   
 Having problem moving things
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheBboy




PostPosted: Fri Sep 21, 2012 9:57 pm   Post subject: Having problem moving things

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
<Answer Here>
My cloud is not moving properly

Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>
%Sky
drawfillbox (0, 70, 640, 400, 53) %Sky1
%Ground
drawfillbox (0, 0, 640, 50, 114) %dirt
drawfillbox (0, 50, 640, 70, 48) %grass

%Cloud 1
var x, x1, y, y1 : int
x := 320
y := 320
x1 := 20
y1 := 20
loop
    drawfilloval (x, y, x1, y1, white)
    delay (500)
    x := x + 3
    drawfilloval (x, y, x1, y1, 53)
    x := x + 3
    exit when x > 640
end loop



Please specify what version of Turing you are using
<Answer Here>
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Sat Sep 22, 2012 6:55 am   Post subject: RE:Having problem moving things

I don't have Turing anymore so I can't test this, but it looks like you're trying to draw a moon?

You're drawing a white oval in the sky, then a sky-colored (color: 53) oval 3 pixels right of it. Your white and sky-colored balls are leap-frogging across the sky. Also, you never erase anything (unless that's what the color 53 ball is there for and you're not trying to draw a moon).

You should never change an X value more than once in an animation loop. Not at this stage of your learning anyway. So get rid of one of them (yes, it matters which, figure it out).

If that color 53 circle is supposed to erase the white one, get rid of it completely. You might as well do this right.

Put all your drawfillboxes into your loop. After your delay, clear the screen. That's the last thing you should do before your 'exit when' line. Otherwise, you'll run into all sorts of trouble down the road.

If you've done everything right up to this point, your animation is going to flicker. A lot. I won't tell you how to fix that though. Use the website's search feature and read any one of the hundreds of threads about it.
Aange10




PostPosted: Sat Sep 22, 2012 11:07 am   Post subject: RE:Having problem moving things

It is a pretty simple fix. You are erasing the wrong spot.
QuantumPhysics




PostPosted: Sun Sep 23, 2012 1:03 am   Post subject: RE:Having problem moving things

you are moving 1 x value... What about the other one? It will stay at the initial position. Take that note
Insectoid




PostPosted: Sun Sep 23, 2012 7:56 am   Post subject: Re: RE:Having problem moving things

QuantumPhysics @ Sun Sep 23, 2012 1:03 am wrote:
you are moving 1 x value... What about the other one? It will stay at the initial position. Take that note


x1/y1 is the radius of the oval. It should not change.
QuantumPhysics




PostPosted: Sun Sep 23, 2012 10:07 pm   Post subject: RE:Having problem moving things

Sorry for that. Didn't seem to notice. But I may be blind where is x1/y1 in the code?

RE: Oooh. Just looked it over again, sorry for that. Haha my mistake. I dun goofed
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  [ 6 Posts ]
Jump to:   


Style:  
Search: