BerryBots forums
http://berrybots.com/forum/

Changing Laser Color
http://berrybots.com/forum/viewtopic.php?f=1&t=443545
Page 1 of 1

Author:  sadd [ Wed Sep 23, 2015 7:44 pm ]
Post subject:  Changing Laser Color

So I tried changing the laser color in "run" to more easily identify some specific shots, but changing laser color doesn't work during run time it seems. I'm just writing this because the API docs specifically state only for the team name that it can't be changed during run time... Or did I do anything wrong?

Here my test bot

Code:
-- LaserColorTester.


ship = nil
world = nil

function init(shipIn, worldIn)
   
   ship = shipIn
   world = worldIn
   
   ship:setName("LaserColorTester")

    ship:setLaserColor(255, 0, 0)
end

timeStep = 0
function run(enemyShips, sensors)

    timeStep = timeStep + 1
    if timeStep == 100 then
        print("Changing laser color...")
        ship:setLaserColor(0, 0, 255)
    elseif timeStep == 200 then
        print("Changing laser color...")
        ship:setLaserColor(0, 255, 0)
    end
    ship:fireLaser(0)

end


EDIT: Maybe this belongs more in the "help" section :).

Author:  Voidious [ Wed Sep 23, 2015 8:35 pm ]
Post subject:  Re: Changing Laser Color

Doh! Yes, the intent is that the colors can also be set only during init. It would make sense to me to lift that restriction when debug gfx are enabled - would that fit your use case? I'll get that into the next version of the app, which should be ready soon (hopefully next week or so).

Author:  sadd [ Thu Sep 24, 2015 6:13 am ]
Post subject:  Re: Changing Laser Color

Didn't know about debug gfx, but I'm guessing that would be enough for my use case :). It's not terribly important for my though, it was just the first thing which came to my mind to distinguish different shots.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/