A. This does not belong here
B. You need to be prepared to use trigonometry
C. Make 2 sprites for the wheels and make them turn
D. Use trig functions to set the position of the two wheels according to direction of car.
Offline
Just make 2 sprites for the wheels, then make each of them go to the y and x position of the car, minus or plus a certain amount depending on how big the car is and where the sprite centre is.
Offline
coolstuff wrote:
It really depends: will the car be rotating? If so, you'll need to do some tricks with Trigonometry. Otherwise, follow colorfusion's advice.
I'm not too put off by the trigonometry, I think it could be interesting to apply my knowledge from maths class. I hope to apply rotation and possibly even suspension to the car so trigonometry is probably the way to go. If there are any examples of trigonometry applied to a scratch program could you please post them here.
Offline
There are plenty of examples of Trigonometry being applied to a Scratch program, actually. Perhaps what you're looking for is Paddle2See's demonstration of a Motorcycle... It's probably most similar to what you're looking for.
Offline
First you need the following sprites : One car and two wheels
I solved the problem by using the following code:
Stage:
<when green flag clicked>
<forever if><key[ right ]pressed?>
<broadcast[ goright
<end>
Code for: Wheel 1 , Wheel 2 and car :
<when I receive[ goright
<point in direction( 90 )
<move( 3 )steps>
<end>
This will make the car and wheels move at exactly the same speed all in the same direction. Now drag and drop the wheels into the right position and run your program.
Now all you need to do is do the same for going left (but just change the broadcast to goleft and <point in direction( 90 ) to <point in direction( -90 ).
I hope this helps.
OB6160
__________________________
See ALL my projects at: http://scratch.mit.edu/users/ob6160
See my blog at: oliverspcpages.blogspot.com
Offline
ob6160 wrote:
First you need the following sprites : One car and two wheels
I solved the problem by using the following code:
Stage:
<when green flag clicked>
<forever if><key[ right ]pressed?>
<broadcast[ goright
<end>
Code for: Wheel 1 , Wheel 2 and car :
<when I receive[ goright
<point in direction( 90 )
<move( 3 )steps>
<end>
This will make the car and wheels move at exactly the same speed all in the same direction. Now drag and drop the wheels into the right position and run your program.
Now all you need to do is do the same for going left (but just change the broadcast to goleft and <point in direction( 90 ) to <point in direction( -90 ).
I hope this helps.
OB6160
__________________________
See ALL my projects at: http://scratch.mit.edu/users/ob6160
See my blog at: oliverspcpages.blogspot.com[/blocks]
Interesting solution! However, I don't believe it'll work if the car needs to rotate, which is why Trigonometry is the answer
Offline