Square Root Thyme Function/Script
12 posts • Page 1 of 1
Square Root Thyme Function/Script
I would like to ask for the function of square rooting a number in thyme, as i am about to make a speed reader with the speed of the x-axis and the y-axis.
I would also like to ask if there is a thyme script called (readable(e.geom)).vel(0) and (readable(e.geom)).vel(1) like app.mousepos(0) and app.mousepos(1)
I would also like to ask if there is a thyme script called (readable(e.geom)).vel(0) and (readable(e.geom)).vel(1) like app.mousepos(0) and app.mousepos(1)
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
use x^0.5
or Math.sqrt(x)
where x is your variable
or Math.sqrt(x)
where x is your variable
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Square Root Thyme Function/Script
Thanks! I'll try it out.
How about the position thing?
How about the position thing?
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
Hey, this is weird.
I used both the functions:
onHitByLaser:
and:
but neither worked! What is going on?!
I used both the functions:
onHitByLaser:
- Code: Select all
{scene.my.a ^ 0.5}
and:
- Code: Select all
{Math.sqrt(scene.my.a)
but neither worked! What is going on?!
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
When i put this in the console
and put
in size, i get [4,2] (observed)
if i put
in the console i get a square. (geom resizes)
so it works with me (2.1.0 b12)
- Code: Select all
scene.my.var:=16
and put
- Code: Select all
{[scene.my.var^0.5,2]}
in size, i get [4,2] (observed)
if i put
- Code: Select all
scene.my.var=4
in the console i get a square. (geom resizes)
so it works with me (2.1.0 b12)
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Square Root Thyme Function/Script
The function on 2.1.0 b12 does the job.
- Code: Select all
math.vec.len(x)
-

carl00s01 - Posts: 24
- Joined: Fri Nov 26, 2010 7:03 pm
- Location: Brazil
Re: Square Root Thyme Function/Script
hey people...i use v2.0.1...and i think the v2.0.2 b4 and v2.1.0 b12 are rather unreliable, so i still use v2.0.1. so what's the function for that?
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
The functions i said are in from the first algodoo versions (possibly even phun for Math.sqrt()), so you should have them, you probably typed incorectly or didn't declare the variable.
Upload the scene to algobox and show it here so we can see the problem and help you.
Upload the scene to algobox and show it here so we can see the problem and help you.
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Square Root Thyme Function/Script
yeah sure...here it is.
oh damn. how to I put the scene up her?!!

oh damn. how to I put the scene up her?!!
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
wait. here it is
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
Re: Square Root Thyme Function/Script
- Code: Select all
(e)=>{
Math.sqrt(scene.my.a)
}
I can make from this that you are trying to use the square root every collide, however your problem is that nothing actually saves. You have to say x=y, now you do y, where y just stays y and doesn't change. Try the next code:
- Code: Select all
(e)=>{
scene.my.a=Math.sqrt(scene.my.a)
}
Now every collision scene.my.a gets saved as Math.sqrt(scene.my.a) resulting in the root of scene.my.a (after some collisions it should come near to 0)
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-

monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Square Root Thyme Function/Script
ahh...i've updated to version 2.1.0, so i'll check:
if you have any alternatives, do say about them!
- Code: Select all
math.vec.len(x)
if you have any alternatives, do say about them!
Some science teacher said one day,'Remember to leave the water dry...'
-

BAZOOKA - Posts: 22
- Joined: Fri Oct 26, 2012 5:45 pm
12 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests




