NEED HELP SCRIPTING

About advanced scenes, and the Thyme scripting language used in Algodoo.

NEED HELP SCRIPTING

Postby jessebax129 » Wed Apr 21, 2010 7:05 pm

hii i need some help woith scripting, i know angle calculations and stuff, i am making a gun that shoots balls, the balls just get spawned with a velocity ( (e)=>{vel:= [300,0]; the rest} onlaserhit ) but the gun has to move (so it does) but the balls keep going straight to the right, how to i make it so it follows where the gun is pointing?
jessebax129
 
Posts: 34
Joined: Tue Jan 05, 2010 6:32 pm

Re: NEED HELP SCRIPTING

Postby Rideg » Wed Apr 21, 2010 9:11 pm

Code: Select all
(e)=>{vel := 300 * e.normal}
this will send it 300 m/s at the side of the collision. Velocity is set with x and y. ex:
Code: Select all
(e)=>{vel:= [10,10]; the rest}
will send it diagonally 45 degrees.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: NEED HELP SCRIPTING

Postby jessebax129 » Wed Apr 21, 2010 9:30 pm

Rideg wrote:
Code: Select all
(e)=>{vel := 300 * e.normal}
this will send it 300 m/s at the side of the collision. Velocity is set with x and y. ex:
Code: Select all
(e)=>{vel:= [10,10]; the rest}
will send it diagonally 45 degrees.


haha okeej thanks but i found out myself today :thumbup: it uses the (0) and (1) between 2 variables *150 is the speed :lol:
jessebax129
 
Posts: 34
Joined: Tue Jan 05, 2010 6:32 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 3 guests