
-----------------------------------
TheBboy
Fri Sep 21, 2012 9:57 pm

Having problem moving things
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?

My cloud is not moving properly

Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)





%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


-----------------------------------
Insectoid
Sat Sep 22, 2012 6:55 am

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
Sat Sep 22, 2012 11:07 am

RE:Having problem moving things
-----------------------------------
It is a pretty simple fix. You are erasing the wrong spot.

-----------------------------------
QuantumPhysics
Sun Sep 23, 2012 1:03 am

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
Sun Sep 23, 2012 7:56 am

Re: 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

x1/y1 is the radius of the oval. It should not change.

-----------------------------------
QuantumPhysics
Sun Sep 23, 2012 10:07 pm

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
