Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

Adding Characters Instead of Replacing Them :) - A Tutorial for Friday Night Funkin'.

Obsolescence Notice

Obsolete due to a different method of grabbing assets with the Paths.hx system.

Updates

BugfixGitHub Link
Fixed the link to the game's GitHub repository. This site doesn't like to use links properly, huh? :)

Fix
Adjustment
AdjustmentImages
For some reason, this site really hates images. Oh well.
Example images for this post are found on my GitHub Repository!

Fix
Adjustment
AdjustmentImages
For some reason, this site really hates images. Oh well.
Example images for this post are found on my GitHub Repository!

Fix
Adjustment
AdjustmentImages
For some reason, this site really hates images. Oh well.
Example images for this post are found on my GitHub Repository!

Fix
Adjustment
AdjustmentImages
For some reason, this site really hates images. Oh well.
Example images for this post are found on my GitHub Repository!

It's easy trust me :)

BEFORE YOU BEGIN:

This requires you to compile the game afterwards, so if you don't know how to do that, follow the guide on the GitHub for the game (ninjamuffin99/Funkin (github.com), along with grabbing the source code for the game! If you need anymore help after you have read the guide, DM me on Discord! My tag is tenta#7716.

Now then, lets begin!

What should I do to get set up?

First, create/grab a new character's sprite sheet (.png file) and grab the .xml file to define the frames for the character. As an example, I will be using Crae's character Pip!



We got the files, now time to program!

The files we will he changing: Character.hx, HealthIcon.hx, PlayState.hx, CharacterList.txt, 
and any .json files we want to add the character to.

How are characters defined? Whats a .xml file?

Inside of the 'source' folder is a file called 'Character.hx'. Open up that file and we can get started!

The Character.hx file defines each character that are used in the game, such as bf, bf-christmas, pico, and everyone else! Normally, it looks like this:



Creating a new instance for a character is simple! Most people who create models use the old .xml file of the character that they were replacing. Crae used the Pico .xml file. Why is this important? Adding animations is based off of the prefixes on the frames:

Examples of the prefixes: Pico Down Note0, Pico Down Note MISS0, Pico Idle Dance.



Each character has these prefixes depending on the character, which defines each frame of the animation.

So now that we know how characters are created with .xml files, how do we use them?

Programming the new character instances:

Programming instances of characters is rather simple. An instance of character looks like this:



How do we create a new one? We can copy this code and change it a little bit. Add the prefixes of the frames, where the .png file and .xml files are located, and the name of the character. Example:



Adding the character's icons:

After creating an instance of a character, we need to assign the character to a health bar icon. If we don't the game will crash. I have learned from experience...

Go to HealthIcon.hx and create a new instance for the health icons of the character.

To add a character's health icon, you will need to type 'animation.add('[Character]', [0,1], 0, false, isPlayer);'. Replace [Character] with the character's name and [0,1] with the new icons. The icons start at 0 so pay attention to that.



Alligning the character in the game:

After we have all of that stuff done, we just need to make sure that the character is in the right position.

Go to PlayState.hx and go around to line 600. 

Down here, we have positions for characters who we are against. We need to add our character to it!

Add your character here. If your character is based off another character, copy the info and replace the name. For Pip, he was originally overlapping Pico, so all we need to do is grab the camera data for Pico and change the name! Simple!



Adding the character into tracks:

We have made it here! Now that that is all over, we can add the character to tracks! There are two ways we can do this; changing .json files on tracks or accessing the character in Debug(7) mode.

JSON files:

Each song uses JSON files to load up songs. These JSON files are named like tutorial.json, tutorial-easy.json, and tutorial-hard.json.

Pick the song you want to change. I'll choose Funkin\Assets\data\Pico\Pico.json for this example.

The code looks like an absolute mess but these are each individual notes. Don't mess with them right now.

Use Control+f to search for the character. Type 'player2' in the popup box to go to the characters. Replace the name of the character (normally it is 'pico') with the character you were adding. If it is a playable character, replace the player1 value.



Debug mode:

Inside of the data folder in Assets lies a file called characterList.txt. Open up this file and create a new line with the character name on a new line.



After you compile the game, hit 7 on any song to open up the debug mode. Change the characters in the 'song' tab.



All done!

You have added a new character into the game that doesn't replace an old one! Compile the game and see your results!



Have any errors? Questions? DM me on Discord. My tag is tenta#7716.
Login or Sign up to access this!
Login or Sign up to access this!

Comments

No comments yet!

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Me
TentaRJ
Tutorial Guy

Author

TentaRJCreator
Login or Sign up to access this!
Login or Sign up to access this!
Login or Sign up to access this!

Game

Login or Sign up to access this!

Category

Tags

Details

Difficulty Level
Advanced

Share

  • 57
  • 100.9k
  • 40
Login or Sign up to access this!
arrow_back