Advertisement
Guest User

punchmod main.lua

a guest
Jan 8th, 2017
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. local punchmod = RegisterMod("Punch!", 1)
  2. local punch = Isaac.GetEntityTypeByName("punches")
  3.  
  4. local spawned = false
  5.  
  6. testvar = 0
  7.  
  8. function punchmod:spawn()
  9.   local player = Isaac.GetPlayer(0)
  10.   player.FireDelay = 2
  11.   if not spawned then
  12.     punchEntity = Isaac.Spawn(456, 0, 0, player.Position, Vector(0,0), nil)
  13.     spawned = true
  14.   end
  15.   local sprite = punchEntity:GetSprite()
  16.   if not sprite:IsPlaying("punch") then
  17.     sprite:Play("punch", 1)
  18.     testvar = testvar + 1
  19.   end
  20.   --[[sprite.RenderZOffset = 10
  21.   sprite:Play("punch", false)]]
  22.   punchEntity.Position = player.Position
  23.   punchEntity.SpriteRotation = player:GetAimDirection():GetAngleDegrees()
  24.   --testvar = tostring(sprite.RenderZOffset)
  25. end
  26.  
  27. --[[function punchmod:animation(_mod, fists)
  28.   local sprite = fists:GetSprite()
  29.   if not sprite:IsPlaying("punch") then
  30.     sprite:Play("punch", false)
  31.   end
  32. end]]
  33.  
  34. function punchmod:debugtext()
  35.   Isaac.RenderText(testvar, 100, 50, 255, 0, 0, 255)
  36. end
  37.  
  38. punchmod:AddCallback(ModCallbacks.MC_POST_UPDATE, punchmod.spawn, nil)
  39. --punchmod:AddCallback(ModCallbacks.MC_FAMILIAR_UPDATE, punchmod.animation, nil)
  40. punchmod:AddCallback(ModCallbacks.MC_POST_RENDER, punchmod.debugtext, nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement