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

#1 2011-07-31 20:56:18

Filtaido
Scratcher
Registered: 2009-04-30
Posts: 33

Car Physics: HELP!!

I'm trying to figure out how to make a sprite accelerate and slow down like a car does using variables. Right now I'm stumped. Please help.



P.S.
I'm not very good at dissecting projects, so if you were to give me a link to one and tell me to look at the scripts, I most likely wouldn't learn much from it.


84% of teenagers own cell phones.  Add this to your signature if you like pop tarts.  tongue

Offline

 

#2 2011-07-31 21:03:06

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: Car Physics: HELP!!

Projects that have some sort of acceleration system utilize the idea of velocity - instead of directly changing the car's movement, it increases or decreases a variable, which in turn is the amount the car moves by. The result when using a basic "change velocity by ___" script is a linear increase in speed. From the wiki, here's an example of what a basic velocity script would look like:

http://wiki.scratch.mit.edu/images/Velocity_script.png

Feel free to check out the wiki article as well.

Last edited by Harakou (2011-07-31 21:03:50)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-07-31 21:05:20

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Car Physics: HELP!!

A script like this

/When Green Flag Clicked\
[Forever]
[]Move (variable) steps]
[end forever]

Then another script like

/When Green Flag Clicked\
[Forever]
[][if <up arrow key pressed>]
[][][change (variable) by (1)
[][else]
[][][change variable by (-0.5)]
[][end if, else]
[end forever]

Try that  big_smile

In the paint editor make sure that the car sprite is pointing right  wink


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#4 2011-07-31 21:05:25

silentslayer7
Scratcher
Registered: 2011-06-05
Posts: 100+

Re: Car Physics: HELP!!

good job again, Harakou. When are you a mod?


http://i51.tinypic.com/dzcwpe.gif Silentslayer7: Curator from Oct. 24 to Nov. 7

Offline

 

#5 2011-08-01 14:02:21

DigiTechs
Scratcher
Registered: 2011-04-30
Posts: 500+

Re: Car Physics: HELP!!

silentslayer7 wrote:

good job again, Harakou. When are you a mod?

Now, for me  big_smile  It says so. anyway


I'm back.
Maybe.

Offline

 

Board footer