Difference between revisions of "Thread:User talk:Chase-san/Roboflight/A few basic questions/reply (3)"

From Robowiki
Jump to navigation Jump to search
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
After much consideration I decided to go with depleting thrust, so that you can do things like this.
 
After much consideration I decided to go with depleting thrust, so that you can do things like this.
  
<code>
+
<syntaxhighlight>
Missile m = setFireMissile(new Vector(0,0,0));
+
//Lay a mine
 +
Missile m = setFireMissile(new Vector(1,0,0));
 
if(m != null)
 
if(m != null)
 
m.setThrust(m.getVelocity().scale(-1));
 
m.setThrust(m.getVelocity().scale(-1));
</code>
+
</syntaxhighlight>
  
 
or this
 
or this
  
<code>
+
<syntaxhighlight>
 
//thrust towards center for 4 turns
 
//thrust towards center for 4 turns
 
setThrust(getPosition().normalize().scale(-4));
 
setThrust(getPosition().normalize().scale(-4));
</code>
+
</syntaxhighlight>
  
 
This will allow smaller robots by making the thrust system easier for robot creators to use, while not impacting those who want to change it every turn. If you set a thrust, it replaces the current thrust, just like calling setAhead(-100) replaces the previous setAhead(100) call.
 
This will allow smaller robots by making the thrust system easier for robot creators to use, while not impacting those who want to change it every turn. If you set a thrust, it replaces the current thrust, just like calling setAhead(-100) replaces the previous setAhead(100) call.

Latest revision as of 14:06, 1 May 2013

After much consideration I decided to go with depleting thrust, so that you can do things like this.

//Lay a mine
Missile m = setFireMissile(new Vector(1,0,0));
if(m != null)
	m.setThrust(m.getVelocity().scale(-1));

or this

//thrust towards center for 4 turns
setThrust(getPosition().normalize().scale(-4));

This will allow smaller robots by making the thrust system easier for robot creators to use, while not impacting those who want to change it every turn. If you set a thrust, it replaces the current thrust, just like calling setAhead(-100) replaces the previous setAhead(100) call.