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

#1 2013-02-18 08:38:20

harmboy
Scratcher
Registered: 2012-07-09
Posts: 5

How do I make a sprite jump by climbing a ramp, while using gravity???

I am stuck on a project where i am trying to make a car jump off a ramp.  I can't get it to climb my ramp.  I have it programmed to drive and jump and then return to the ground by using gravity.  SOMEBODY PLEASE HELP ME!!!!!!!

Offline

 

#2 2013-02-18 10:55:39

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: How do I make a sprite jump by climbing a ramp, while using gravity???

Hmm... I haven't done this before, but you need a sort of ramp detection device. You can either do it manually, i.e program the car to jump at the coordinates of the ramp, but I highly inadvise you to do that because it is very easy to get bugs and if there was more than one ramp then you'll have to manually program another jump. So I think you should create another costume for the car, called "sensor" The car continuously switches between the "sensor" costum and the "car" costume. I believe that online the continuous switching will not register and it will look like a regular car. Color the bottom-front of the sensor some color, and say when that color is touching a ramp, then turn the car a number of degrees and raise the car a number of pixels. Then, to program it to land straight, color the bottom-back of the sensor a different color, and when this color touches the ground, set car direction to 90. Unfortunately, the smoothness of the car on the ramp will be really bad with my way of changing degrees and pixels, but unfortunately to make it smooth I believe you would need trigonometry. If you know trig, it's all good, but if you don't, then here is a starter idea.

Hope this helped.


http://i46.tinypic.com/3148ksz.gif

Offline

 

Board footer