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

#1 2013-02-21 04:39:01

Bombguy2010
New Scratcher
Registered: 2013-02-08
Posts: 17

making sprites move in an arc

Whats a good way to make a sprite move in a parabola?

Offline

 

#2 2013-02-21 04:55:58

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: making sprites move in an arc

Well, a parabola is basically a trajectory of an object that is being accelerated, right? So one way to do it is to have variables called "X velocity" and "Y velocity", and in a forever loop move the sprite according to the velocities. In a separate script, simply continue decrementing the Y velocity by some constant.

Alternatively, use the equation: make the sprite always "set Y to" the square of its X position, for example.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#3 2013-02-21 06:50:30

numberonegamers
Scratcher
Registered: 2012-07-12
Posts: 100+

Re: making sprites move in an arc

Another way is to go to the sprites costume, and set the center to the very far right. Then, as a script turn it to the right to ark it!

Offline

 

#4 2013-02-21 16:40:43

piguillaud
Scratcher
Registered: 2010-06-19
Posts: 100+

Re: making sprites move in an arc

or you could use trig...

Offline

 

#5 2013-04-04 15:03:36

XndrK
New Scratcher
Registered: 2013-04-04
Posts: 2

Re: making sprites move in an arc

I think what he meant is a realistic jump. I'm having the same problem.

Offline

 

#6 2013-04-07 17:03:28

cauzality
New Scratcher
Registered: 2013-03-19
Posts: 44

Re: making sprites move in an arc

this is how the first thing Hardmath123 suggested would look:

when [space v] key pressed
glide [1] secs to x: [-100] y: [-120]
set [x speed v] to [10]
set [y speed v] to [50]
set [gravity v] to [-5]
repeat [21]
   change x by (x speed)
   change y by(y speed)
   change [y speed v] by (gravity)
   end
you can do something similar by defining just a time variable and making X proportional to time and Y proportional to time * time:

when [space v] key pressed
glide [1] secs to x: [-100] y: [-120]
set [time v] to [-10]
repeat [20]
   change [time v] by [1]
   go to x: ([10] * (time)) y: ([180] - ([3] * ((time) * (time))))
   end
these are like animations of jumps.

Offline

 

Board footer