Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tackleSprite;
- local hasGenerated = false;
- local myCounter = 0
- local cooldown = 0
- local defs = API.load("expandedDefines")
- local pnpc = API.load("pnpc")
- local npcconfig = API.load("npcconfig")
- local npcManager = API.load("npcManager")
- local player = Player()
- local tableX = {}
- local tableY = {}
- local tOpacity = {}
- local flag = false
- function onTick()
- character=player:mem(0xF0, FIELD_WORD)
- if (player.powerup == PLAYER_BIG) then
- if (cooldown == 0) then --Cooldown (sempre deve ser maior que a duração do efeito!!!!! lembrar)
- if ((player.altRunKeyPressing) and (player.downKeyPressing == false) and (player.altJumpKeyPressing == false)) or (myCounter > 0) then
- myCounter = myCounter + 2
- Text.print(myCounter,0,0)
- --Contador de tempo
- player.speedX = player:mem(0x106, FIELD_WORD) * 8
- --Velocidade horizontal
- table.insert(tableX, player.x)
- table.insert(tableY, player.y)
- table.insert(tOpacity, 1)
- if ((player:isGroundTouching() == false) and (character~=5)) then
- player.speedY = -6
- if (myCounter < 3) then
- playSFX("tackle-air.wav")
- end
- end
- flag = true
- if (player:isGroundTouching()) then
- if (myCounter < 3) then
- playSFX("tackle-ground.wav")
- end
- end
- player.leftKeyPressing = false
- player.rightKeyPressing = false
- player.jumpKeyPressing = false
- player.altJumpKeyPressing = false
- player.runKeyPressing = false
- Defines.cheat_donthurtme = true
- --Invencibilidade
- player:mem(0x156, FIELD_BOOL, false)
- --Efeitos
- for _, w in pairs(NPC.getIntersecting(player.x, player.y, player.x + player.width, player.y + player.height)) do
- if defs.NPC_HITTABLE_MAP[w.id] then
- w:harm(HARM_TYPE_EXT_HAMMER)
- playSFX("punch.wav")
- Animation.spawn(76, w.x, w.y)
- end
- end
- --Matar os brode
- if (myCounter == 40) then
- cooldown = 50
- myCounter = 0
- Defines.cheat_donthurtme = false
- flag = false
- tableX = {}
- tableY = {}
- tOpacity = {}
- end
- end
- --Fim da linha
- else
- cooldown = cooldown - 1 --Caso cooldown seja 100 (ou o tempo definido), a função será executada
- end
- end
- end
- function onDraw()
- tackleSprite = Graphics.loadImageResolved("tackleS.png")
- if (flag) then
- for i = 1, #tableX, 2 do --only draw every fifth frame
- Graphics.drawImageToSceneWP(tackleSprite, tableX[i], tableY[i], (tOpacity[i] - 0.1), 0)
- end
- player:setCurrentSpriteIndex(1, 45, false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement