Skip to content

Instantly share code, notes, and snippets.

@Dregu
Last active February 2, 2023 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dregu/77f910c5dfa1bee28c56df407f3211a2 to your computer and use it in GitHub Desktop.
Save Dregu/77f910c5dfa1bee28c56df407f3211a2 to your computer and use it in GitHub Desktop.
Spelunky 2 character animation tags for Aseprite
--[[
How to make full character mods in Aseprite:
1. Save this file (Raw > Save page as...) to Aseprites "File > Scripts > Open Scripts Folder"
2. "File > Import Sprite Sheet" and select a char_..._full sheet or a _grid, use options:
- Type: By Rows
- Width: 128 px
- Height: 128 px
- [x] Include partial tiles (checked)
3. Run the script from "File > Scripts > Spelunky2_Character_Tags"
4. Draw the tagged animations on new layer(s), don't add or delete any frames!
- The red frames are empty or part of the journal portrait, we'll do that later
- The yellow ones aren't actually used by the game, instead the preceding frames are just reversed
5. "File > Export Sprite Sheet" with these options, that should create a sheet in exactly the same format:
- Layout > Type: By Rows
- Layout > Constraints > Fixed # of Columns: 16
- Layout > [ ] Merge duplicates (unchecked)
- Layout > [ ] Ignore Empty (unchecked)
- Sprite > Layers: Pick your layer or select many beforehand
- Sprite > Frames: All Frames
- [x] Open Sprite Sheet (checked)
6. Change the canvas size of the exported sheet to 2048 x 2224 with the gravity on top
7. Draw the journal graphics, icon etc on the full sheet
8. Export the right layer(s) again as char_color_full.png and you're done!
(All the modding tools also support 4k textures and they do look slightly better ingame,
so you may resize your skin to 4096x4448 and adjust other values accordingly.)
]]
local animations = {
-- char animations
{ 1, 1, "Stand" },
{ 44, 44, "Hold" },
{ 2, 9, "Walk" },
{ 145, 147, "Jump" },
{ 148, 148, "JumpCharSelect" }, -- apparently only used in the character select screen jump
{ 11, 16, "Swim" },
{ 149, 152, "Fall" },
{ 181, 186, "LongFall" },
{ 97, 97, "OnLadder" },
{ 97, 102, "ClimbLadder" },
{ 19, 19, "Ducked" },
{ 22, 28, "Crawl" },
{ 10, 10, "Dead" },
{ 57, 60, "LedgeGrab" },
{ 33, 36, "Thrown" },
{ 65, 70, "Whipping" },
{ 71, 75, "Throw" },
{ 49, 56, "Teeter" },
{ 37, 43, "LedgeFlip" },
{ 81, 86, "Enter" },
{ 87, 92, "Exit" },
{ 113, 122, "ClimbRope" },
{ 17, 21, "Ducking" },
{ 129, 132, "LookUp", true },
{ 133, 135, "LookUpR", false, Color{ r=255, g=255, b=0, a=128 } },
{ 103, 108, "Push" },
{ 113, 113, "OnRope" },
{ 136, 136, "Sit" },
{ 136, 140, "LookUpMount" },
{ 140, 143, "LookUpMountR" },
{ 122, 122, "MountEnter" },
{ 125, 125, "MountDucked" },
{ 123, 127, "MountDucking" },
{ 225, 232, "Petting" },
{ 153, 156, "Celebrating" },
-- items, fx
{ 157, 157, "RopeThrown" },
{ 158, 158, "RopeTop" },
{ 159, 159, "RopeSingle" },
{ 160, 160, "RopeBurnt" },
{ 193, 193, "RopeSegment" },
{ 194, 197, "RopeUncoil" },
{ 198, 198, "RopeBottom" },
{ 199, 202, "RopeBurning" },
{ 203, 208, "Whip" },
{ 209, 220, "Birdies" },
{ 177, 177, "Head" },
{ 178, 178, "Bag" },
{ 179, 179, "Poster" },
{ 180, 180, "Pointer" },
-- ghost
{ 161, 164, "GhostIdle" },
{ 165, 168, "GhostInhale" },
{ 169, 170, "GhostCharge" },
{ 171, 176, "GhostBlow" },
{ 187, 187, "GhostPose" },
-- portrait
{ 29, 32, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
{ 45, 48, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
{ 61, 64, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
{ 77, 80, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
{ 93, 96, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
{ 109, 112, "Portrait", false, Color{ r=255, g=0, b=0, a=128 } },
-- tag empty spaces
{ 76, 76, "Empty", false, Color{ r=255, g=0, b=0, a=128 } },
{ 128, 128, "Empty", false, Color{ r=255, g=0, b=0, a=128 } },
{ 144, 144, "Empty", false, Color{ r=255, g=0, b=0, a=128 } },
{ 188, 192, "Empty", false, Color{ r=255, g=0, b=0, a=128 } },
{ 221, 224, "Empty", false, Color{ r=255, g=0, b=0, a=128 } },
}
if app.activeSprite then
for i,anim in pairs(animations) do
local tag = app.activeSprite:newTag(anim[1], anim[2])
tag.name = anim[3]
if anim[1] > anim[2] then
tag.aniDir = AniDir.REVERSE
end
if anim[4] then
tag.aniDir = AniDir.PING_PONG
end
if anim[5] then
tag.color = anim[5]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment