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

#1 2012-12-20 18:24:04

mrn0body
Scratcher
Registered: 2012-12-11
Posts: 37

x and y velocity

It seems alot of people use x and y velocity in their scripts. I know the script for it and what it does but can anyone give me ideas of what it can be used for? This is the script for it below.

when gf clicked
forever
if < key [right arrow v] pressed >
change (x velocity) by (0.1)
end
if < key [left arrow v] pressed >
change (x velocity) by (-0.1)
end
change x by (x velocity)
end
Its the same with y velocity


Why Fit In When You Were Born To Stand Out

Offline

 

#2 2012-12-20 18:54:47

12three
Scratcher
Registered: 2008-06-12
Posts: 1000+

Re: x and y velocity

for you know... moving

Offline

 

#3 2012-12-20 18:56:49

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: x and y velocity

It makes motion that feels more natural than just instantly stopping and starting.  The moving sprite feels like it has inertia.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2012-12-20 20:15:31

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: x and y velocity

mrn0body wrote:

It seems alot of people use x and y velocity in their scripts. I know the script for it and what it does but can anyone give me ideas of what it can be used for? This is the script for it below.

when gf clicked
forever
if < key [right arrow v] pressed? >
change [x velocity v] by (0.1)
end
if < key [left arrow v] pressed? >
change [x velocity v] by (-0.1)
end
change x by (x velocity)
set [x velocity v] to ((x velocity) * (0.98))
end
Its the same with y velocity

Fixed

Last edited by Firedrake969 (2012-12-20 20:15:43)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#5 2012-12-21 23:48:09

mrn0body
Scratcher
Registered: 2012-12-11
Posts: 37

Re: x and y velocity

Thanks guys


Why Fit In When You Were Born To Stand Out

Offline

 

#6 2012-12-22 01:28:30

Ideas
Scratcher
Registered: 2012-10-07
Posts: 100+

Re: x and y velocity

Hello welcome to scratch, Velocity you could use it for practically any sprite you wish to use a realistic movement such as wall jumping and things of that nature.


http://img685.imageshack.us/img685/2010/screenshot20121110at132.pngI think that you must CLICK above

Offline

 

Board footer