Skip to content

Custom Sprites

Bradley edited this page Feb 13, 2023 · 2 revisions

To add custom sprite sheets make a lua file in sprites/ e.g. sprites/characters/exampleSprite.lua

After you made it go into it and type

Return graphics.newSprite(
    love.graphics.newImage(graphics.imagePath(“path/to/image”)),

)

NOTE: DO NOT ADD “image/png”

EXAMPLE image

Next, get your characters XML and put it in tools/funkin-xml and run python funkin-xml.py exampleCharacter.xml

After you did that a file called output.txt should appear, Copy all contents in the output.txt file and go to exampleCharacter.lua and paste it in the bracket EXAMPLE image

After you did that you add this at the bottom

What goes in the bracket over “idle”?

This does

    ["singDOWN"] = {start = 1, stop = 7, speed = 24, offsetX = 0, offsetY = 0},
    ["singLEFT"] = {start = 8, stop = 8, speed = 24, offsetX = 0, offsetY = 0},
    ["singRIGHT"] = {start = 9, stop = 27, speed = 24, offsetX = 0, offsetY = 0},
    ["singUP"] = {start = 28, stop = 32, speed = 24, offsetX = 0, offsetY = 0},
    ["idle"] = {start = 33, stop = 45, speed = 24, offsetX = 0, offsetY = 0}

(To get offsets use the sprite debugger when pressing 7 in FNFR) (Change start and end according to notes)

after that, if the sprite is a character, make sure to add the following code after the animations table

{
    isCharacter = true,
    sing_duration = 4
}

To get the sing_duration, simply look at the games source code or the characters json file

To draw the character in the week then do

enemy = love.filesystem.load(“sprites/exampleCharacter.lua”)()enemy:draw()

Or

boyfriend = love.filesystem.load(“sprites/exampleBoyfriend.lua”)()boyfriend:draw()

Or

girlfriend = love.filesystem.load(“sprites/exampleGirlfriend.lua”)() ... girlfriend:draw()

If you do a special boyfriend with no death animation than add a fakeBoyfriend e.g. fakeBoyfriend = love.filesystem.load(“sprites/boyfriend.lua”)() -- Do NOT add fakeBoyfriend:draw()

For what boyfriend and girlfriend sprite sheets look like then just look in sprites/girlfriend.lua or sprites/boyfriend.lua

Clone this wiki locally