Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
I wrote a simple Cloud Flower API, you can customize how much clouds will be fired before you'll become Small Mario again. It maybe isn't the best, but I hope it will be useful. It also comes with needed graphics.
Update 1.1:
-Mario doesn't get hurt now, you just can't shoot more clouds.
-Added cloud shooting sfx.
-Clouds disappear after a while.
-After collecting Cloud Flower while being in Cloud Mario form your clouds replenish.
Update 1.2:
-Hitbox of clouds is now fixed (thanks to FanofSMBX).
Don't the clouds disappear after a certain amount of time in SMG? Also, it might be a good idea to add a poof-like sound instead of the fireball sound. Looks okay though so far. It's at least a good start
In the original game, Mario doesn't power down when all his clouds are gone. He just can't shoot any anymore. Maybe impliment that? It's kinda awkward having him power down after shooting the third cloud, and I can imagine that being extremely exploitable in terms of invincibility frame abuse.
Yoshi021 wrote:It would be cool if the clouds appeared below you and the clouds didn't hurt you.
I don't think they hurt the player. I made that mistake originally of thinking that too, but the player just powers down after they launch a third cloud
PixelPest wrote:
I don't think they hurt the player. I made that mistake originally of thinking that too, but the player just powers down after they launch a third cloud
Your code could be cleaned up a bit. I played around with it myself to see how it works, but I'm not sure what's going on in your code and it's good practice to insert comments to show what each part of your code does. Using the tab button to indent lines will also make it easier to read.
local cloudflowerAPI = {}
local encrypt = loadSharedAPI("encrypt")
local cloudsData = encrypt.Data(Data.DATA_WORLD,true)
local clouds = 3
local clouds_max = 0
local pressing = 0
local cloudtimer = 0
local xtimer = 0
local clouds_check = 0
local seffect = Audio.SfxOpen("cloudflowerapi\\cloud-sfx.mp3")
local cloudcounter = Graphics.loadImage(Misc.resolveFile("cloudflowerapi\\cloud_counter.png"))
function cloudflowerAPI.setAmmount(value)
if value > 0 then
clouds_max = value
end
if value == 0 then
clouds_max = -1
end
end
function cloudflowerAPI.onStart()
if cloudsData:get("cflower") == nil then
cloudsData:set("cflower",0)
end
end
function cloudflowerAPI.onInitAPI()
registerEvent(cloudflowerAPI, "onLoop", "showClouds")
registerEvent(cloudflowerAPI, "onStart", "onStart")
registerEvent(cloudflowerAPI, "onTick", "check")
end
function cloudflowerAPI.showClouds()
Audio.sounds[18].sfx = seffect
if clouds > 0 then
Graphics.placeSprite(1, cloudcounter, 24, 24)
Text.print(clouds-1, 56, 24)
end
if clouds == 0 then
Graphics.placeSprite(1, cloudcounter, 24, 24)
Text.print(clouds, 56, 24)
end
if clouds < 0 then
Graphics.placeSprite(1, cloudcounter, 24, 24)
Text.print("infinity", 56, 24)
end
if player.powerup == PLAYER_BIG then
clouds = clouds_max+1
end
if clouds >= clouds_max+1 then
clouds = clouds_max+1
end
if player.powerup == PLAYER_FIREFLOWER and player:mem(0x140, FIELD_WORD) == 0 then
if player.runKeyPressing == true and pressing == 0 and clouds ~= 0 then
clouds = clouds - 1
pressing = 1
xtimer = 2
end
if player.runKeyPressing == false then
pressing = 0
end
end
if xtimer == 1 then
for k,v in pairs(NPC.get(46,-1)) do
v.y = player.y +64
v.x = player.x
v.speedX = 0
v.speedY = 0
v.id = 212
end
end
if player.powerup == PLAYER_FIREFLOWER and clouds == 0 and player.reservePowerup == 14 then
player.reservePowerup = 0
clouds = clouds_max+1
end
end
function cloudflowerAPI.check()
for k,v in pairs(NPC.get(212,-1)) do
v.ai3 = v.ai3 + 1
if v.speedX > 1 then
v.speedX = 0
v.speedY = 0
end
if v.ai3 >= 250 then
v.y = v.y + v.ai3*10
end
end
if clouds ~= 0 then
for k,v in pairs(NPC.get(13,-1)) do
v.id = 46
end
end
if clouds == 0 then
for k,v in pairs(NPC.get(13,-1)) do
v.id = 178
end
for k,v in pairs(NPC.get(178,-1)) do
v.y = player.y
v.x = player.x
end
end
xtimer = xtimer - 1
end
return cloudflowerAPI
local cloudflowerAPI = {}
local encrypt = loadSharedAPI("encrypt")
local cloudsData = encrypt.Data(Data.DATA_WORLD,true)
local clouds = 0
local clouds_max = 0
local pressing = 0
local cloudtimer = 0
local xtimer = 0
local clouds_check = 0
local seffect = Audio.SfxOpen("cloudflowerapi\\cloud-sfx.mp3")
local cloudcounter = Graphics.loadImage(Misc.resolveFile("cloudflowerapi\\cloud_counter.png"))
function cloudflowerAPI.setAmmount(value)
if value > 0 then
clouds_max = value
else
clouds_max = -1
end
end
function cloudflowerAPI.onStart()
if cloudsData:get("cflower") == nil then
cloudsData:set("cflower",0)
end
end
function cloudflowerAPI.onInitAPI()
registerEvent(cloudflowerAPI, "onLoop", "showClouds")
registerEvent(cloudflowerAPI, "onStart", "onStart")
registerEvent(cloudflowerAPI, "onTick", "check")
end
function cloudflowerAPI.showClouds()
Audio.sounds[18].sfx = seffect
Graphics.placeSprite(1, cloudcounter, 24, 100)
Text.print(math.max(0, clouds - 1), 56, 100)
if (player.powerup == PLAYER_BIG) or (clouds >= clouds_max + 1) then
clouds = clouds_max + 1
end
if player.powerup == PLAYER_FIREFLOWER and player:mem(0x140, FIELD_WORD) == 0 then
if player.runKeyPressing == true and pressing == 0 and clouds > 0 then
clouds = clouds - 1
pressing = 1
xtimer = 2
end
if player.runKeyPressing == false then
pressing = 0
end
end
if xtimer == 1 then
for k,v in pairs(NPC.get(46,-1)) do
v.y = player.y + 64
v.x = player.x
v.speedX = 0
v.speedY = 0
v.id = 212
end
end
if player.powerup == PLAYER_FIREFLOWER and clouds == 0 and player.reservePowerup == 14 then
player.reservePowerup = 0
clouds = clouds_max + 1
end
end
function cloudflowerAPI.check()
for k,v in pairs(NPC.get(212,-1)) do
v.ai3 = v.ai3 + 1
if v.speedX > 1 then
v.speedX = 0
v.speedY = 0
end
if v.ai3 >= 250 then
v.y = v.y + v.ai3*10
end
end
if clouds ~= 0 then
for k,v in pairs(NPC.get(13,-1)) do
v.id = 46
end
end
if clouds == 0 then
for k,v in pairs(NPC.get(13,-1)) do
v.id = 178
end
for k,v in pairs(NPC.get(178,-1)) do
v.y = player.y
v.x = player.x
end
end
xtimer = xtimer - 1
end
return cloudflowerAPI