Fraymakers

Fraymakers

King Knight
Bedoop!  [developer] 22 Jul @ 11:10am
Source Code/Tutorial for Intro Text, if you wish to make your own Shovel Knight characters
I figured that this would be nice info to have, so here's a rundown (i don't know how to use images in steam discussions! oh no !)

Formatting
For King Knight, the intro text all sits in a 316 x 16 canvas, with the sprites being at 2x resolution. Centered, and with the top of the letters touching the top of the canvas (so there's room for commas and such at the bottom.) King Knight's is 316 pixels wide because that's the longest intro tag he has, but yours could be wider or shorter.

In Fraytools, the intro texts are added to animations that I labelled from entry1 to entry8. They're aligned so that the bottom-middle anchor sits on the middle of the +.

The way they're animated is by being visible for 24 frames starting on Frame 1, and then being invisible for 24 more frames. This repeats 2 more times, so the text should have 3 moments of being visible! (For King Knight, this means the final frame is on frame 121, which is the first frame when the text goes invisible for the third time.)

Implementing/Coding

In Script.hx...
In Script.hx, this code is placed at the top area with the other vars;
var offsetHearYe = 0; var arrayHearYe = ["entry1", "entry2", "entry3", "entry4", "entry5", "entry6", "entry7", "entry8"];
you can replace "HearYe" with whatever you wish, just make sure it's consistent!
offsetHearYe is set up later, and is what makes the text stack ontop of eachother when multiple King Knights are on the scene.
arrayHearYe is pointing towards the animations that have the intro text, you can add more or less to the list if you have more/less than 8 intro texts!

In intro...
In your character's intro animation, you can put this code on a framescript for Frame 1;
((addendum; i am not the best at coding. this probably isn't too optimized! but it works!))
if (self.getPlayerConfig().port == 1) { offsetHearYe = 18; } if (self.getPlayerConfig().port == 2) { offsetHearYe = -18; } if (self.getPlayerConfig().port == 3) { offsetHearYe = 36; } if (self.getPlayerConfig().port >= 4) { offsetHearYe = -999; }
This code sets up the offsets for the text! Imagine every port number is offset by 1, (so Port 1 is Player 2, Port 2 is Player 3, etc...) so any hypothetical Player 5 onward has their text thrown into the air.

Under that code, still on Frame 1, place this in--you'll have to edit this one a bit, pay attention!;
match.createVfx(new VfxStats({spriteContent: self.getResource().getContent("MyCharacter"), animation: Random.getChoice(arrayHearYe), layer:VfxLayer.FOREGROUND_EFFECTS, flipWith: false, relativeWith:true, y:(camera.getY() - 125 + offsetHearYe), x:(camera.getX())}), self);
This spawns the text in! You'll have to replace MyCharacter with your character's ID (that's found in the Properties tab on the right, with the gear,) and if you renamed arrayHearYe or offsetHearYe you'll have to rename that too.

The text aligns with the camera's starting position when the match loads in! So if you don't see the text on certain stages, their camera may start somewhere else before quickly panning over! This can be changed in your stages by editing startX and startY in your stage's StageStats.

And that should work! Hopefully! :yjfblock:
Last edited by Bedoop!; 22 Jul @ 11:11am