Only count upwards motion for barrel launch

This commit is contained in:
Empathic Qubit 2021-03-06 09:52:51 -05:00
parent 438df48497
commit f346531178
3 changed files with 10 additions and 3 deletions

View file

@ -32,3 +32,4 @@ An AI based on SethBling's MarI/O to play Donkey Kong Country 2 with lsnes.
* [SethBling's Mar I/O](https://github.com/mam91/neat-genetic-mario)
* [Basic tilemap info from p4plus2/DKC2-disassembly](https://github.com/p4plus2/DKC2-disassembly)
* [dkjson](http://dkolf.de/src/dkjson-lua.fsl/home)
* [LibDeflate](https://github.com/SafeteeWoW/LibDeflate)

View file

@ -71,11 +71,17 @@ end
function _M.getVelocityY()
local sprite = _M.getSprite(leader)
if sprite == nil then
return 1900
end
return sprite.velocityY
end
function _M.getVelocityX()
local sprite = _M.getSprite(leader)
if sprite == nil then
return 1900
end
return sprite.velocityX
end

View file

@ -802,10 +802,10 @@ function mainLoop (species, genome)
-- Don't punish being launched by barrels
-- FIXME Will this skew mine cart levels?
if math.abs(game.getVelocityY()) > 0x1800 or math.abs(game.getVelocityX()) > 0x1800 then
statusLine = "Barrel launch!!!"
if game.getVelocityY() < -1850 then
statusLine = string.format("Gotta go fast!!! %d", partyX)
statusColor = 0x0000ff00
timeout = timeoutConst
timeout = timeoutConst + 60 * 2
end
if not vertical then