Browse Search Popular Register Upload Rules User list Login:
Search:
SpeedMeter

Image:
screenshot of the scene

Author: MMGISS

Group: Default

Filesize: 22.8 kB

Date added: 2016-12-18

Rating: 5

Downloads: 329

Views: 100

Comments: 2

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0

Tags:

Scene tag

This is a meter
just a meter
only a meter

You can use it without credit
Last edited at 2016/12/19 07:36:16 by MMGISS
Please log in to rate this scene
edit
Similar scenes
Title: Proton Exora Car Test Drive
Rating: 5.625
Filesize: 416.98 kB
Downloads: 796
Comments: 6
Ratings: 2
Date added: 2010/08/28 15:58:20
Made with: Phun
Rating: rated 5.6
download
Title: SpeedMeter
Rating: 5
Filesize: 30.4 kB
Downloads: 125
Comments: 0
Ratings: 1
Date added: 2018/10/14 16:02:50
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: railroad minigame
Rating: 5
Filesize: 366.84 kB
Downloads: 335
Comments: 0
Ratings: 1
Date added: 2014/08/14 22:34:55
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: New generation subway car(test car)
Rating: 5
Filesize: 0.55 MB
Downloads: 1015
Comments: 0
Ratings: 1
Date added: 2018/11/16 23:12:27
Made with: Algodoo v2.1.0
Rating: rated 5
download
*meter

You could've written:

text = {math.toInt(math.vec.len(vel)) * 3.6 + " km/h"}

and THAT ONE line does the same than all your script, without any scene.my.variables

math.vec.len calculates the module of the vector velocity ((x^2+y^2)^0.5), and math.toInt makes the number an integer (0, -1, 5).

In case you want to work only on one object you can also use _variables, that work just like scene.my.variables with the exception that you can only read or write them from the same object where they are declared (you CAN do those things from somewhere else but it's too complex)

For example, you want to declare a variable called _v1, one called _v2 and one called _v3:

First you go to the Script menu and find this box:
http://puu.sh/sTxMA/0b45bdd642.png
Now you have to write the name of the variable (always with a _ at the front!) and the initial value you want to give to it like this

_v1 = 0.0

Hit Enter and the variable will appear. Do the same with the others and now you can rewrite your script in a far more efficient way:

onHitByLaser = (e)=>{_v1 = vel(0); _v2 = vel(1)}
text = {(_v1 ^2 + _v2 ^2)^0.5}
Also if you want your script to be always on you can put it in postStep