snifit.lua - Snifit Behavior Modification API

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

Moderator: Userbase Moderators

RandomMcSomethin
Shy Guy
Shy Guy
Posts: 7
Joined: Tue Jul 03, 2018 11:01 pm

snifit.lua - Snifit Behavior Modification API

Postby RandomMcSomethin » Sat Jul 07, 2018 10:35 pm

A.K.A. The API that nobody asked for, but the API that I uploaded anyway, because Randoms don't care what people think of snifit APIs

This library allows you to modify the properties of snifits, such as projectiles, behavior, etc.

Usage:
Spoiler: show
Using the API is rather simple. To get started, simply download the API to your computer, put it in your level folder, and include the API in your lunadll.lua file with this line of code placed at the head of the file:

Code: Select all

local snifit = API.load("snifit");
Out of the box, the API adds in two new behaviours for snifits (these affect the red snifits by default). You can implement these into your snifits by putting them in different layers. Naming a layer "Jump" or "Jump3" will cause all snifits within that layer to have their behavior modified according to the layer.
"Okay, that's great and all," you may say, "but what about other snifits?" To answer your question, there is a function included within the API that goes as so:

Code: Select all

snifit.configureSnifits{snifitType, projectile}; 
snifitType can be modified to affect which snifits are affected by this behavior: 1 corresponds to red snifits, 2 corresponds to blue ones, and 3 is for grays. In addition, you can set projectile to an ID of any NPC in the game, from 1-up mushrooms to more snifits to banzai bills (At the moment, the API does not compensate for NPC width and set the X position accordingly, so large projectiles will most likely end up being behind snifits. This may be fixed in time.)
That's all there is to it! Sorry if it looks intimidating, my explanations can be rather wordy at times.
Limitations:
Spoiler: show
Due to the way this API is coded, there are some limitations that I will attempt to fix for future updates:
  • Only one type of snifit can have modified behavior in a level.
  • You can give custom projectiles to as many snifit types as you want, but only one projectile type can be used across all of them.
  • Gray snifits are not garunteed to work properly as they have not been thoroughly tested yet.
This is my first SMBX API, so feel free to give all feedback and constructive criticism.
Video Demonstration:
Spoiler: show
Downloads:
Spoiler: show

Smibbix
Swooper
Swooper
Posts: 60
Joined: Fri Apr 06, 2018 10:47 pm

Re: snifit.lua - Snifit Behavior Modification API

Postby Smibbix » Mon Jul 23, 2018 12:21 am

Quite interesting! This will probably be pretty useful for me, since I usually only use one type of snifit in my levels.

MegaDood
Charged Spiny
Charged Spiny
Posts: 1831
Joined: Wed Nov 01, 2017 2:43 am

Re: snifit.lua - Snifit Behavior Modification API

Postby MegaDood » Mon Oct 14, 2019 6:03 am

This looks really good, I can see a lot of creative usage, such as red snifits firing blue ones which shoot regular snifit bullets.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 3 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari