Difference between revisions of "Thread:User talk:Chase-san/Roboflight/A few basic questions/reply (3)"
Jump to navigation
Jump to search
(Reply to A few basic questions) |
|||
(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. | ||
− | < | + | <syntaxhighlight> |
− | Missile m = setFireMissile(new Vector( | + | //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)); | ||
− | </ | + | </syntaxhighlight> |
or this | or this | ||
− | < | + | <syntaxhighlight> |
//thrust towards center for 4 turns | //thrust towards center for 4 turns | ||
setThrust(getPosition().normalize().scale(-4)); | setThrust(getPosition().normalize().scale(-4)); | ||
− | </ | + | </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 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.