
-----------------------------------
Psyberius
Sat Apr 09, 2016 5:53 pm

Can't make my car move
-----------------------------------
What is it you are trying to achieve?
So im trying to make a car move that i created on my own, i have tried everything from for statements to loop's NOTHING works 


What is the problem you are having?
I can't get my car to move


Describe what you have tried to solve this problem
Looked on the internet and this website, iv tried loop 's and for 's but nothing works

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)


View.Set ("offscreenonly") 
proc car (var x : int) 
Draw.Oval (60, 50, 30, 30, black) 
Draw.Oval (200, 50, 30, 30, black) 
Draw.Oval (60, 50, 15, 15, black) 
Draw.Oval (200, 50, 15, 15, black) 
Draw.Line (90, 50, 170, 50, black) 
Draw.Line (230, 50, 250, 50, black) 
Draw.Line (250, 50, 250, 100, black) 
Draw.Line (250, 100, 220, 100, black) 
Draw.Line (220, 100, 170, 130, black) 
Draw.Line (170, 130, 70, 130, black) 
Draw.Line (70, 130, 40, 100, black) 
Draw.Line (40, 100, 10, 100, black) 
Draw.Line (10, 100, 10, 50, black) 
Draw.Line (10, 50, 30, 50, black) 
Draw.Fill (60, 50, blue, black) 
Draw.Fill (80, 50, black, black) 
Draw.Fill (200, 50, blue, black) 
Draw.Fill (220, 50, black, black) 
Draw.Line (170, 130, 170, 90, black) 
Draw.Line (170, 90, 120, 90, black) 
Draw.Line (120, 90, 120, 130, black) 
Draw.Fill (130, 100, 52, black) 
Draw.Oval (155, 110, 10, 10, 64) 
Draw.Fill (155, 110, 65, 64) 
Draw.Fill (180, 90, 40, black) 
Draw.Oval (160, 110, 2, 2, black) 
Draw.Fill (160, 110, black, black) 
end car 
var x := 60 
loop 
car (x) 
View.Update 
delay (5) 
exit when x > 550 
cls 
x += 1 
end loop 


Please specify what version of Turing you are using
4.1.1

-----------------------------------
lordroba
Sun Apr 10, 2016 12:38 am

Re: Can't make my car move
-----------------------------------
If you are trying to make something move in 2D space you need to somehow change the values of an object's 'X' and 'Y' coordinates.  You can start by adding the 'x' value from your loop to the x coordinate of your lines and ovals.  Just remember that the lines have two x values so you need to add it in two spots if you want to keep that length of the line constant.  

Here's an example

Draw.Oval (200 + x, 50, 15, 15, black)
Draw.Line (90 + x, 50, 170 + x, 50, black)

