BerryBots forums

It is currently Mon Mar 25, 2019 5:28 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Changing Laser Color
PostPosted: Wed Sep 23, 2015 7:44 pm 
Offline

Joined: Wed Sep 23, 2015 12:17 pm
Posts: 6
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 :).


Top
 Profile  
 
 Post subject: Re: Changing Laser Color
PostPosted: Wed Sep 23, 2015 8:35 pm 
Offline
Site Admin
User avatar

Joined: Sat Nov 17, 2012 5:03 am
Posts: 88
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).


Top
 Profile  
 
 Post subject: Re: Changing Laser Color
PostPosted: Thu Sep 24, 2015 6:13 am 
Offline

Joined: Wed Sep 23, 2015 12:17 pm
Posts: 6
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group