Pos (Position) Scripting

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

Pos (Position) Scripting

Postby acerjojo12 » Sat Oct 29, 2011 12:55 am

I was working on a roket that comes out of an AA turret. But when the rokets spown the all come at pos := [-0.50000000, 5.2500000]; I want them to fallow the turrent and not spawn at the starting point after the turret is gone and left. Here is my code for give its extreem longness
Scene.addBox {
collideWater := true;
color := [0.63757920, 0.54548198, 0.55474502, 1.0000000];
onCollide := (e)=>{};
attraction := 0.00000000;
controllerAcc := 11.000000;
onHitByLaser := (e)=>{};
heteroCollide := false;
immortal := false;
opaqueBorders := true;
refractiveIndex := 1.5000000;
killer := false;
text := "";
friction := 0.50000000;
materialName := "";
restitution := 0.50000000;
drawBorder := true;
controllerInvertX := false;
controllerInvertY := false;
textFont := "Verdana";
edgeBlur := 0.00000000;
textFontSize := 32.000000;
controllerReverseXY := false;
resistivity := +inf;
ruler := false;
airFrictionMult := 1.0000000;
showVelocity := false;
density := 2.0000000;
textConstrained := true;
textureClamped := [false, false];
reflectiveness := 1.0000000;
textColor := [1.0000000, 1.0000000, 1.0000000, 1.0000000];
showMomentum := false;
textureMatrix := [1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000, 0.00000000, 0.00000000, 0.00000000, 1.0000000];
texture := "";
inertiaMultiplier := 1.0000000;
showForceArrows := false;
collideSet := 1;
materialVelocity := 0.00000000;
attractionType := 2;
textScale := 0.50000000;
entityID := 44;
zDepth := 17.000000;
layer := 0;
geomID := 4770;
pos := [-0.50000000, 5.2500000];
angle := 0.00000000;
vel := [0.00000000, 0.00000000];
angvel := 0.00000000;
size := [0.50000000, 4.0000000]
};
Scene.addPen {
geom := 4770;
relPoint := [0.00000000, -0.75000000];
color := [0.14000000, 0.055999998, 0.070659496, 1.0000000];
fadeTime := 1.5000000;
opaqueBorders := true;
followGeometry := true;
size := 0.31250000;
entityID := 192;
zDepth := 24.000000;
layer := 0;
rotation := 0.00000000
};
Scene.addThruster {
geom := 4770;
relPoint := [0.00000000, -1.5000000];
color := [1.0000000, 1.0000000, 1.0000000, 1.0000000];
force := 1100.0000;
opaqueBorders := true;
followGeometry := true;
size := 0.35848492;
entityID := 45;
zDepth := 18.000000;
layer := 0;
rotation := 1.5707964
};
Scene.addPen {
geom := 4770;
relPoint := [0.00000000, -0.25000000];
color := [0.79000002, 0.74771422, 0.70310003, 1.0000000];
fadeTime := 1.7500000;
opaqueBorders := true;
followGeometry := true;
size := 0.31250000;
entityID := 194;
zDepth := 23.000000;
layer := 0;
rotation := 0.00000000
};
Scene.addPen {
geom := 4770;
relPoint := [0.00000000, -1.2500000];
color := [0.81000000, 0.81000000, 0.068849981, 1.0000000];
fadeTime := 0.31000000;
opaqueBorders := true;
followGeometry := true;
size := 0.31250000;
entityID := 193;
zDepth := 25.000000;
layer := 0;
rotation := 0.00000000
}

So can anyone help me?

:crazy:
(Edit, Thanks for your posts, but I want the spown location to fallow the moving turret. I want to somehow have the spown cords to change as the cords of the turret do. Is there some code for that?)
Last edited by acerjojo12 on Sat Oct 29, 2011 3:05 pm, edited 1 time in total.
acerjojo12
 
Posts: 2
Joined: Sat Oct 29, 2011 12:40 am

Re: Pos (Position) Scripting

Postby monstertje3 » Sat Oct 29, 2011 9:11 am

pos := [-0.50000000, 5.2500000];
quoted from your script, you should alter this (into something like pos:= e.pos;)

Oh, and could you try to type regular english, really helps.
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.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL

Re: Pos (Position) Scripting

Postby Matten » Sat Oct 29, 2011 12:45 pm

It looks like you used the copy-paste method for spawning. You could try to learn some Thyme to write a spawn script from scratch, or try to make the rocket on the place you want, and then use the copy-paste method. To give the rocket velocity you can change the variable (vel := [10,0] for example).
Cave Johnson wrote:Do you know who I am? I'm the man who's gonna burn your house down! With the lemons! I'm gonna get my engineers to invent a combustible lemon that burns your house down!
User avatar
Matten
 
Posts: 435
Joined: Mon Apr 05, 2010 2:03 pm
Location: The Netherlands

Re: Pos (Position) Scripting

Postby acerjojo12 » Tue Nov 01, 2011 3:12 am

Thanks for your posts, but I want the spown location to fallow the moving turret. I want to somehow have the spown cords to change as the cords of the turret do. Is there some code for that? :wtf:
acerjojo12
 
Posts: 2
Joined: Sat Oct 29, 2011 12:40 am

Re: Pos (Position) Scripting

Postby TC42 » Tue Nov 01, 2011 3:41 am

The older (pre-v2.0) code scene.my.pos = e.pos will work--just keep in mind that you have to update it every step/frame; the best way to do this is with an alternating collider or with a laser.

Just for some context, e.pos is a relatively powerful command, and as its name suggests, gives you the position ('pos") of an event ("e").

I think there is a new way to read the position as of v2.0, but I still need to do my homework on the new additions to thyme.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests