Help for thyme scripts
			3 posts			 • Page 1 of 1		
	
Help for thyme scripts
I am currently making a chainreaction minigame, and I need help with following effects:
an script which makes the executing object scan it's surrounding area(radius 5) for the first-best circle(circles only, if a polygon or rectangle is nearby, it shouldnt scan it), and then saves the position of it in an local e.this._target variable so i can use it for the rest of the scripts.
An on-update script which alters the speed of an newly spawned object so it mooves in a spiral form around it's spawn point, becomming faster a short over time and thus distancing faster from the point the script was executed
If you have suggestions for one of these 2 scripts, please write them down in a comment. Use a general form(like (i)=>{}), and don't care to much about certain values. I will adjust the values inside the script to numbers that fit best for me
			
		an script which makes the executing object scan it's surrounding area(radius 5) for the first-best circle(circles only, if a polygon or rectangle is nearby, it shouldnt scan it), and then saves the position of it in an local e.this._target variable so i can use it for the rest of the scripts.
An on-update script which alters the speed of an newly spawned object so it mooves in a spiral form around it's spawn point, becomming faster a short over time and thus distancing faster from the point the script was executed
If you have suggestions for one of these 2 scripts, please write them down in a comment. Use a general form(like (i)=>{}), and don't care to much about certain values. I will adjust the values inside the script to numbers that fit best for me
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
Re: Help for thyme scripts
Um, I think the first script can be achieved by using a laser to scan for circles, um, like
I use materialName as a identification system, different objects in my contraptions are named different things for my lasers do tell what is what - this is adapted from my missile script, sooo...
For the second part, it is relatively easy to make the spawned object move in a circle, and from there have it spiral out. In this particular circle I made, the timeToLive was 10 seconds, but you can change it to any real number without any problems.
Well, I tried. If all this fails, let me know and I will try to find what went wrong.
			- Code: Select all
- rotation =
 {sim.time}
 fadeDist =
 5.0
 onLaserHit =
 (e)=>{
 e.geom.materialname == "object_receiving_data" ? {
 e.geom._tpos = _tpos;
 e.geom._tvel = _tvel;
 rotation = rotation + math.pi
 } : {
 e.geom.radius > 0 ? {
 _tpos = e.geom.pos;
 _tvel = e.geom.vel;
 rotation = rotation + math.pi
 } : {}
 }
 }
I use materialName as a identification system, different objects in my contraptions are named different things for my lasers do tell what is what - this is adapted from my missile script, sooo...
For the second part, it is relatively easy to make the spawned object move in a circle, and from there have it spiral out. In this particular circle I made, the timeToLive was 10 seconds, but you can change it to any real number without any problems.
- Code: Select all
- vel :=
 {
 [sin(timetolive - 10), cos(timetolive - 10)] * (timetolive - 10)
 };
 timetolive :=
 10.0
Well, I tried. If all this fails, let me know and I will try to find what went wrong.
.
		- 
				 
 icrls984
- Posts: 80
- Joined: Thu Jun 13, 2013 6:33 am
Re: Help for thyme scripts
I already found out a way to make spirals by now, but nice to see a confirmation of the way I do it. And your way how to do the scanning gave me the idea to store a reference of the scanned object as a variable, and if another object comes and has a closer distance than the previous one, it gets overriden. Thanks for the help anyways  
			
		
- FRA32
- Posts: 229
- Joined: Wed Dec 03, 2014 9:51 pm
			3 posts			 • Page 1 of 1		
	Who is online
Users browsing this forum: No registered users and 3 guests




