understanding velocity
Sets the item's velocity.
As with other functions that take a point as an input, you can also specify the x and y components as numeric arguments.
Parameters
vel A point representing item's velocity.
Confusing to me. This point can't just be (x, y) because the bot will not work if that was the case. you can't just getPos and put that value in. I don't know what goes on with velocity...
working code: why is my ship faster?
- Code:
- function onTick()
table.clear(items)
targetShip = findClosest(findAllObjects(items, ObjType.Ship))
if(targetShip ~= nil) then
local targetShiploc = targetShip:getPos()
local angle = targetShip:getAngle()
local playerVel = targetShip:getVel()
if(bot:canSeePoint(targetShiploc)) then
bot:setVel(playerVel)
--experimental velocity code above. Why is my ship faster?
--you can also do bot:setVel(2*playerVel) multiplying speed
--TAZ
--the following line is a pt, right?
--bot:setVel(targetShiploc)
bot:setAngle(angle)
bot:fireWeapon(Weapon.Phaser)
else
bot:setAngle(angle)
end
end
end
viewtopic.php?f=33&p=21002#p21002