Advertisement
Guest User

Mario & Luigi Superstar Saga VBA24m Backbrother Followpath

a guest
Oct 30th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. ---coordinates to move everything around
  2. x=0
  3. y=0
  4.  
  5. while true do
  6.  
  7.  
  8. --- display
  9. gui.opacity(0.35)
  10. gui.drawbox(160+x,36+y,232+x,108+y,"#009DFF")
  11.  
  12. gui.opacity(1)
  13. gui.drawline(160+x,36+y,232+x,36+y,"#009DFF")
  14. gui.drawline(160+x,108+y,232+x,108+y,"#009DFF")
  15. gui.drawline(160+x,36+y,160+x,108+y,"#009DFF")
  16. gui.drawline(232+x,36+y,232+x,108+y,"#009DFF")
  17.  
  18. --- Mario path display
  19. --020057D0
  20. MarioX = memory.readdword(0x02006C14)
  21. MarioY = memory.readdword(0x02006C18)
  22. LuigiX = memory.readdword(0x02006FB0)
  23. LuigiY = memory.readdword(0x02006FB4)
  24. ---
  25. OverwritingPos = memory.readword(0x02006F60) --the x/y of the path that is going to be overwritten next frame. It does not take on consistent values so I will normalize it:
  26. OverwritingPos=(OverwritingPos-48) / 64               --value 47 is when it goes over the list from the start again.
  27. OverwritingPos = OverwritingPos - 47                    --so value 47 is made into 0 now.
  28. if OverwritingPos < 0 then OverwritingPos=OverwritingPos+64 end  --the x/y of the path that is going to be overwritten next frame, is now normalized.
  29.  
  30.  OverwritingPixelX=(memory.readdword(0x020057E8+8*OverwritingPos) - LuigiX) / 512    --Offset of the pixel that is going to be overwritten next frame. With this we can draw that pixel on the display.
  31.  OverwritingPixelY=(memory.readdword(0x020057EC+8*OverwritingPos) - LuigiY) / 512   -- ...
  32.  gui.drawline(160+x,72+OverwritingPixelY+y,232+x,72+OverwritingPixelY+y,"#009DFF")
  33.  gui.drawline(196+OverwritingPixelX+x,36+y,196+OverwritingPixelX+x,108+y,"#009DFF")
  34. ---
  35.     for i = 0x020057E8, 0x02005FE4, 8 do    -- for each x/y of the path, draw the corresponding pixel
  36.         FOX=(memory.readdword(i) - LuigiX) / 512
  37.         FOY=(memory.readdword(i+4) - LuigiY) / 512
  38.         FOX = math.floor(FOX)
  39.         FOY = math.floor(FOY)
  40.         gui.drawpixel(196+FOX+x,72+FOY+y,"#000000")
  41. end
  42. ---
  43. gui.drawbox(195+x,71+y,197+x,73+y,"#00FF00") --draw Luigi pos
  44.  
  45. MarioNOX = (MarioX - LuigiX) / 512
  46. MarioNOY = (MarioY - LuigiY) / 512
  47. MarioNOX = math.floor(MarioNOX)
  48. MarioNOY = math.floor(MarioNOY)
  49. gui.drawbox(195+MarioNOX+x,71+MarioNOY+y,197+MarioNOX+x,73+MarioNOY+y,"#FF7777")  -- draw Mario pos
  50. ---
  51.  
  52. emu.frameadvance()
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement