Phun Guided Rocket

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

Phun Guided Rocket

Postby Blackonyx2234 » Sun Jan 02, 2011 12:09 am

I need some help to make a guided rocket for my Gravity rocket.
can someone give me a script to launch my rocket from one side of the scene to the other? My Gravity rocket's script is
an on collide script to make it a black hole.
Code: Select all
{e.this.density:= +inf ; e.this.attraction:= 10000; e.this.killer:= true}

this makes it into a black hole and i need the guided missile to complete the scene.
Last edited by Blackonyx2234 on Sun Jan 16, 2011 6:34 pm, edited 1 time in total.
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Sun Jan 02, 2011 12:10 am

I actually need the guided rocket script soon, because i am not going to work on this for long.
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby davidz40 » Thu Jan 06, 2011 5:14 pm

Rating: rated 7.1
Filesize: 10.94 kB
Comments: 6
Ratings: 6
download

Here You have simple phun compatible guidance.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Sat Jan 08, 2011 4:46 am

davidz40 wrote:
Rating: rated 7.1
Filesize: 10.94 kB
Comments: 6
Ratings: 6
download

Here You have simple phun compatible guidance.

I just wish it was more tutorial-like, it is awesome though...
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby davidz40 » Sun Jan 09, 2011 2:00 am

All the secret is one scripted box. It measures velocity, and then increases attraction if missile is too slow, and decreases when too fast. Attraction keeps pulling missile to target. Missile needs to be very light, so it's attraction won't affect target motion.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Sat Jan 15, 2011 3:37 am

davidz40 wrote:All the secret is one scripted box. It measures velocity, and then increases attraction if missile is too slow, and decreases when too fast. Attraction keeps pulling missile to target. Missile needs to be very light, so it's attraction won't affect target motion.

sorry for the long time span,
so the secret is in a scripted box... how would i script it to increase attraction and decrease attraction by measuring velocity?
what would the script be?

(I am fairly new to advanced scripting and basic scripting and well every type of scripting except collide set scripts...)
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby davidz40 » Sat Jan 15, 2011 12:15 pm

Basically, it uses texture matrix variables to store position, and then uses actual pos, and previously stored values to calculate velocity.

Here updated, simplier code that I'm going to use in my next missiles, feel free to use it.
Just put it on some alternating collider.
Code: Select all
(e)=>{texturematrix = [texturematrix(2) - e.pos(0), texturematrix(3) - e.pos(1), e.pos(0), e.pos(1), texturematrix(0) ^ 2 + texturematrix(1) ^ 2, 0, 0, 0, 0];         texturematrix(4) < 15 ? {attraction = attraction + 20} : {attraction = attraction * 0.98}}
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Sun Jan 16, 2011 6:31 pm

davidz40 wrote:Basically, it uses texture matrix variables to store position, and then uses actual pos, and previously stored values to calculate velocity.

Here updated, simplier code that I'm going to use in my next missiles, feel free to use it.
Just put it on some alternating collider.
Code: Select all
(e)=>{texturematrix = [texturematrix(2) - e.pos(0), texturematrix(3) - e.pos(1), e.pos(0), e.pos(1), texturematrix(0) ^ 2 + texturematrix(1) ^ 2, 0, 0, 0, 0];         texturematrix(4) < 15 ? {attraction = attraction + 20} : {attraction = attraction * 0.98}}

thanks this will come in handy
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Sun Jan 16, 2011 6:59 pm

Blackonyx2234 wrote:
davidz40 wrote:Basically, it uses texture matrix variables to store position, and then uses actual pos, and previously stored values to calculate velocity.

Here updated, simplier code that I'm going to use in my next missiles, feel free to use it.
Just put it on some alternating collider.
Code: Select all
(e)=>{texturematrix = [texturematrix(2) - e.pos(0), texturematrix(3) - e.pos(1), e.pos(0), e.pos(1), texturematrix(0) ^ 2 + texturematrix(1) ^ 2, 0, 0, 0, 0];         texturematrix(4) < 15 ? {attraction = attraction + 20} : {attraction = attraction * 0.98}}

thanks this will come in handy

crap it didn't work i must be doing something wrong...
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby davidz40 » Sun Jan 16, 2011 9:04 pm

The code is ok, I copied it from working missile. Just remember to keep missile very light, put the script box on the front, and put some stabilisation fins on the rear.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: Phun Guided Rocket

Postby Blackonyx2234 » Tue Jan 18, 2011 3:21 am

davidz40 wrote:The code is ok, I copied it from working missile. Just remember to keep missile very light, put the script box on the front, and put some stabilisation fins on the rear.

K ill see if it works, and also
can you explain the texture matrix a little more? i like to understand what i am coding in...(once again new to scripting and I have had several brain blocks whenever i try to script advanced topics. i am better at scripts when i know what i am doing) ex. scene.my.laserfade=10
scene.my.speedoflight=2
live to learn
learn to survive
survive to eventually die successful
User avatar
Blackonyx2234
 
Posts: 24
Joined: Sun Jan 31, 2010 5:12 am

Re: Phun Guided Rocket

Postby davidz40 » Tue Jan 18, 2011 7:05 pm

Texture matrix is set of numbers that control position,scale and rotation of texture. Full explanation what number does what is on this forum somewhere. If no textures are used, these numbers can be used for storage. I use them to save position, and difference between saved pos and current pos to calculate speed.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests