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

From Robowiki
Jump to navigation Jump to search
 
Line 3: Line 3:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
//Lay a mine
 
//Lay a mine
Missile m = setFireMissile(new Vector(0,0,0));
+
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));

Latest revision as of 13: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.