Advertisement
biosp4rk

Metroid Fusion - Hitbox Viewer

May 14th, 2015
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.62 KB | None | 0 0
  1. -- displays the hitbox of all the enemies in the room
  2. function Enemies()
  3.     for i=0,23 do
  4.         if memory.readword(0x3000140 + i*56) ~= 0 then
  5.             local enemyX, enemyY = memory.readword(0x3000144 + i*56), memory.readword(0x3000142 + i*56)
  6.             local tlX = bit.arshift(enemyX + memory.readwordsigned(0x300014E + i*56) - cameraX, 2)
  7.             local tlY = bit.arshift(enemyY + memory.readwordsigned(0x300014A + i*56) - cameraY, 2)
  8.             local brX = bit.arshift(enemyX + memory.readwordsigned(0x3000150 + i*56) - cameraX, 2)
  9.             local brY = bit.arshift(enemyY + memory.readwordsigned(0x300014C + i*56) - cameraY, 2)
  10.             gui.box(tlX, tlY, brX, brY, "clear", "#80FF80")
  11.         end
  12.     end
  13. end
  14.    
  15. -- displays the hitbox of samus
  16. function Samus()
  17.     local samusX, samusY = memory.readword(0x300125A), memory.readword(0x300125C)
  18.     local tlX = bit.arshift(samusX + memory.readwordsigned(0x3001268) - cameraX, 2)
  19.     local tlY = bit.arshift(samusY + memory.readwordsigned(0x300126A) - cameraY, 2)
  20.     local brX = bit.arshift(samusX + memory.readwordsigned(0x300126C) - cameraX, 2)
  21.     local brY = bit.arshift(samusY - cameraY, 2)
  22.     gui.box(tlX, tlY, brX, brY, "clear", "#80FFFF")
  23. end
  24.  
  25. -- displays projectile hitbox
  26. function Projectiles()
  27.     for i=0,15 do
  28.         if memory.readword(0x3000960 + i*32) ~= 0 then
  29.             local projX, projY = memory.readword(0x300096A + i*32), memory.readword(0x3000968 + i*32)
  30.             local tlX = bit.arshift(projX + memory.readwordsigned(0x300097A) - cameraX, 2)
  31.             local tlY = bit.arshift(projY + memory.readwordsigned(0x3000976) - cameraY, 2)
  32.             local brX = bit.arshift(projX + memory.readwordsigned(0x300097C) - cameraX, 2)
  33.             local brY = bit.arshift(projY + memory.readwordsigned(0x3000978) - cameraY, 2)
  34.             gui.box(tlX, tlY, brX, brY, "clear", "#FFFF80")
  35.            
  36.             -- displays bomb timer
  37.             local projType = memory.readbyte(0x300096F + i*28)
  38.             if projType >= 16 then
  39.                 local timer = memory.readbyte(0x300097E + i*28)
  40.                 if memory.readbyte(0x3000972 + i*28) == 1 then
  41.                     if projType == 16 then
  42.                         timer = timer + 30
  43.                     else
  44.                         timer = timer + 70
  45.                     end
  46.                 end
  47.                 gui.text(tlX, tlY, timer, "#8080FF")
  48.             end
  49.         end
  50.     end
  51. end
  52.    
  53. -- displays the cooldown timer
  54. function Cooldown()
  55.     local cooldown = memory.readbyte(0x300124E)
  56.     if cooldown ~= 0 then
  57.         local cannonX = bit.arshift(memory.readword(0x3000B82) - cameraX, 2)
  58.         local cannonY = bit.arshift(memory.readword(0x3000B80) - cameraY, 2)
  59.         gui.text(cannonX - 1, cannonY - 3, cooldown - 1, "#FF80FF")
  60.     end
  61. end
  62.  
  63.  
  64. while true do
  65.  
  66.     cameraX = memory.readword(0x3001228)
  67.     cameraY = memory.readword(0x300122A)
  68.    
  69.     Enemies()
  70.     Samus()
  71.     Projectiles()
  72.     Cooldown()
  73.    
  74.     vba.frameadvance()
  75.    
  76. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement