This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-08-07 20:30:20

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

tough scrolling problem

I'm making a project that involves a car driving along the roads. I know how to scroll from side to side easy. In it I have the car build up mph by acceleration and I got it to work fine with the scenes. But I've reached a problem that involves slopes.

So what I want it to do is have the car point in the direction of the ground in other words have the car at the exact angle of the ground. I've also done this part but here's the hard part. I don't know how to have the car change its y position while driving up the hill.

Right now what the car does is point in the direction of the ground and the go right through the ground. Here's the link to my project. http://scratch.mit.edu/projects/bullelk12/2719124

Hope the link worked.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#2 2012-08-07 22:56:35

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: tough scrolling problem

change y by (([cos v] of (direction)) * (speed))


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#3 2012-08-08 00:00:30

henley
Scratcher
Registered: 2008-06-21
Posts: 1000+

Re: tough scrolling problem

Well there you go.


"I've worked so hard for you and you give me nothing in return. Do you need help... Or do I?"

Offline

 

#4 2012-08-08 12:50:07

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: tough scrolling problem

I'll try it.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#5 2012-08-08 12:57:37

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: tough scrolling problem

Wow thanks. I have no idea how that works but it does.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

#6 2012-08-08 13:07:10

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: tough scrolling problem

bullelk12 wrote:

Wow thanks. I have no idea how that works but it does.

It works like the steps block does, but steps uses sin to change the x as well, it's based on a circle, how far up you have to go to get the the same level as a point on a circle, the point being where your angle points.


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#7 2012-08-08 13:33:25

bullelk12
Scratcher
Registered: 2012-05-26
Posts: 100+

Re: tough scrolling problem

Oh, I can see that. How far y to go versus how far x to go depending on the angle of the sprite.


http://mag.racked.eu/cimage/i6000/Achievement++get%21/Scratcher+love+minecraft%21/mca.png

Offline

 

Board footer