I tried to make apis for cat and penguin powerups as I think these would be cool to have in SMBX but they don't work without producing an error.
These are the codes:
Cat:
Code: Select all
local cat = {}
local climbTimer = 10
function cat.oninitAPI()
registerEvent(cat, "onTickEnd", "onTickEnd", false)
end
function cat.onTickEnd()
if player.powerup == 4 then
if player:mem(0x14C,FIELD_WORD) ~= 0 or player:mem(0x148,FIELD_WORD) ~= 0 then
player:mem(0x40,FIELD_WORD,3)
climbTimer = climbTimer - 1
end
if climbTimer == 0 then
player:mem(0x40,FIELD_WORD,2)
end
if player:mem(0x14C,FIELD_WORD) == 0 and player:mem(0x148,FIELD_WORD) == 0 then
climbTimer = 10
end
end
end
return cat
Code: Select all
local penguin = {}
local can_slide = false
function penguin.onInitAPI()
registerEvent(penguin, "onTick", "onTick", false)
end
function onTick()
if player:mem(0x16C,FIELD_WORD,1) then
can_slide = true
end
if can_slide == true then
if player.downkeypressing == true then
player:mem(0x3C,FIELD_WORD,1)
end
end
Graphics.sprites.mario[7].img = Graphics.loadImage("penguin_mario.png")
end
return penguin
Greetings,yoshiegg.