[NPC and Library] Sonic Power Sneakers & speedboost.lua

Share and discuss custom LunaLua code and content packs for SMBX2.

Moderator: Userbase Moderators

ShadowXeldron
Snifit
Snifit
Posts: 232
Joined: Sun Dec 08, 2019 8:21 am
Flair: phpBB > ProBoards
Pronouns: He/Him
Contact:

[NPC and Library] Sonic Power Sneakers & speedboost.lua

Postby ShadowXeldron » Thu Mar 11, 2021 8:38 am

This is my first public upload, which I made last night. It includes two components: a library named speedboost.lua and the Power Sneakers from the Sonic franchise. I'm probably more proud of this than I should be. First, the shoes:

When picked up, the Power Sneakers will significantly boost your speed for 14 seconds. Specifically, your walking speed becomes double your running speed and your running speed will be quadrupled! Here's the powerup in action:
Image
Note that this footage was recorded with donthurtme (god mode) activated, and it will NOT protect you from enemy attacks! Be careful while using it.

speedboost.lua is a library included to interface with the speedboost function. It can be used to either force a speed boost or check whether or not you are currently boosting. It can be enabled by adding the following code to the top of your luna.lua:

Code: Select all

speedboost = require("speedboost")
It is not required to add to your luna.lua file for the Power Sneakers to work, but if you delete it they WILL stop working.

The function speedboost.GottaGoFast() can be used to force a speedboost, and the variable speedboost.Boosting will be either 1 (if boosting) or 0 (if not). This can be used to check whether you are presently experiencing a speedboost, as demonstrated above.

Here's an example script which depends on afterimages.lua to create afterimages while boosting for the intended feeling:
Spoiler: show

Code: Select all

local afterimages = require("afterimages")
local speedboost = require("speedboost")

local playerColours = {}
    
playerColours[1] = Color.red
playerColours[2] = Color.green
playerColours[3] = Color.pink
playerColours[4] = Color.red
playerColours[5] = Color.green

function onDraw()
    if speedboost.Boosting == 1 then
        afterimages.create(player, 14, playerColours[player.character], 1, -49)
    end
end
This script "borrows" the audio muting code from the starman script, as well as two lines of collision detection from 9thCore's Metal Cap because I'm too lazy to write my own code. It also uses the sprite from Sonic Lost World with an outline added and the sneaker theme from Sonic Adventure 2.

GOTTA DOWNLOAD FAST! (no regrets)

TheGameyFireBro105
Eerie
Eerie
Posts: 747
Joined: Thu Jan 09, 2020 6:09 pm
Flair: Good at remakes
Pronouns: he/him

Re: [NPC and Library] Sonic Power Sneakers & speedboost.lua

Postby TheGameyFireBro105 » Thu Mar 11, 2021 8:44 am


ShadowXeldron
Snifit
Snifit
Posts: 232
Joined: Sun Dec 08, 2019 8:21 am
Flair: phpBB > ProBoards
Pronouns: He/Him
Contact:

Re: [NPC and Library] Sonic Power Sneakers & speedboost.lua

Postby ShadowXeldron » Thu Mar 11, 2021 8:46 am

TheGameyFireBro105 wrote:
Thu Mar 11, 2021 8:44 am
Actually, I was considering using that theme before I decided on SA2's.


Return to “LunaLua”

Who is online

Users browsing this forum: Dot [Bot] and 2 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari