Cloud Flower

This is the place for discussion and support for LunaLua and related modifications and libraries.

Moderator: Userbase Moderators

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?
Hatebz
Shy Guy
Shy Guy
Posts: 6
Joined: Wed Aug 24, 2016 2:12 pm

Cloud Flower

Postby Hatebz » Wed Aug 24, 2016 2:34 pm

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.



Download (old): http://www.mediafire.com/download/rysh0 ... flower.zip

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).

Download (new): http://www.mediafire.com/download/6igh2 ... er_new.rar
Last edited by Hatebz on Mon Aug 29, 2016 5:18 pm, edited 2 times in total.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Cloud Flower

Postby PixelPest » Wed Aug 24, 2016 2:42 pm

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

Yoshi021
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 691
Joined: Thu Jan 21, 2016 9:06 pm
Flair: :)
Pronouns: He/Him

Re: Cloud Flower

Postby Yoshi021 » Wed Aug 24, 2016 2:43 pm

It would be cool if the clouds appeared below you and the clouds didn't hurt you.

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: Cloud Flower

Postby Emral » Wed Aug 24, 2016 2:43 pm

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.

PixelPest
Link
Link
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: Cloud Flower

Postby PixelPest » Wed Aug 24, 2016 2:44 pm

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

Yoshi021
Gold Yoshi Egg
Gold Yoshi Egg
Posts: 691
Joined: Thu Jan 21, 2016 9:06 pm
Flair: :)
Pronouns: He/Him

Re: Cloud Flower

Postby Yoshi021 » Wed Aug 24, 2016 2:47 pm

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
Oops... I just noticed that with Enjl's post.

Hatebz
Shy Guy
Shy Guy
Posts: 6
Joined: Wed Aug 24, 2016 2:12 pm

Re: Cloud Flower

Postby Hatebz » Thu Aug 25, 2016 2:52 am

I did what you suggested, the download and changelog are in first post.

lotus006
Spike
Spike
Posts: 284
Joined: Thu Sep 24, 2015 12:59 am

Re: Cloud Flower

Postby lotus006 » Thu Aug 25, 2016 5:10 am

Nice, and I love how bad is the evil cloud in the 1st video :D (an hurting power :) )

MECHDRAGON777
Pink Yoshi Egg
Pink Yoshi Egg
Posts: 6422
Joined: Fri Dec 20, 2013 6:40 pm
Flair: Nuclear Queen of Reversion.
Contact:

Re: Cloud Flower

Postby MECHDRAGON777 » Sun Aug 28, 2016 10:16 pm

Also, not sure if this is fixed, but you should be able to stand on the top, not 16 pixels into them.

Hatebz
Shy Guy
Shy Guy
Posts: 6
Joined: Wed Aug 24, 2016 2:12 pm

Re: Cloud Flower

Postby Hatebz » Sun Aug 28, 2016 11:33 pm

MECHDRAGON777 wrote:Also, not sure if this is fixed, but you should be able to stand on the top, not 16 pixels into them.
IDK why it works like that, tried changing NPC, but still it's hitbox is so small for some reason. :/

FanofSMBX
Ludwig von Koopa
Ludwig von Koopa
Posts: 3878
Joined: Sun Dec 22, 2013 12:01 pm

Re: Cloud Flower

Postby FanofSMBX » Mon Aug 29, 2016 9:43 am

Hatebz wrote:
MECHDRAGON777 wrote:Also, not sure if this is fixed, but you should be able to stand on the top, not 16 pixels into them.
IDK why it works like that, tried changing NPC, but still it's hitbox is so small for some reason. :/
Whatever NPC you use, you must do npc-13.txt with the changed height.

Hatebz
Shy Guy
Shy Guy
Posts: 6
Joined: Wed Aug 24, 2016 2:12 pm

Re: Cloud Flower

Postby Hatebz » Mon Aug 29, 2016 5:16 pm

Oh, how could I forget it. Thanks for help. Fixed version: http://www.mediafire.com/download/6igh2 ... er_new.rar

aero
Palom
Palom
Posts: 4787
Joined: Fri Mar 28, 2014 2:51 pm

Re: Cloud Flower

Postby aero » Fri Sep 02, 2016 3:43 am

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.

Original:

Code: Select all

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
Revisions (from what I could make sense of):

Code: Select all

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


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari