A small program or plugin that autowrites code for anim8 sprites would be really useful.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Asherah
Prole
Posts: 1
Joined: Sun May 05, 2019 12:21 pm

A small program or plugin that autowrites code for anim8 sprites would be really useful.

Post by Asherah »

Any anim8 (https://github.com/kikito/anim8) spritesheet you want to use is going to have AT LEAST the following components:

Sprite Initialization of some kind, for example:

sprites.player.idle = love.graphics.newImage('sprites/characters/playeridleanim.png')

Anim8 Initialization:

local playerIdle = anim8.newGrid(300,300, 1800,1800, 0,0, 0)
playerIdleAnim = {anim8.newAnimation(playerIdle('1-6', 1, '1-6', 2, '1-6', 3, '1-6', 4, '1-6', 5, '1-1', 6, '6-1', 5, '6-1', 4, '6-1', 3, '6-1', 2, '6-2', 1), 0.048),}

Update:

for i=1,#playerIdleAnim do playerIdleAnim:update(dt) end

Draw:

for i=1,#playerIdleAnim do playerIdleAnim:draw(sprites.player.idle, love.graphics.getWidth()/6, love.graphics.getHeight()/1.96, 0, ScaleX/6.4, ScaleY/3.6) end

And some kind of memory freeing process if your game gets big enough, for example:

sprites.player.idle = nil

When you start having hundreds of these spritesheets throughout your code, it starts taking up a lot of time that could be used for other things.

A small application built in C# for example that uses as data the image and takes in as input from the user:
* A variable name (playerIdle in this case)
* Size of each frame (300 x 300 in this case)
* Automatically goes from frames: left to right and then from frames: right to left ('1-6', 1, '1-6', 2, '1-6', 3, '1-6', 4, '1-6', 5, '1-1', 6, '6-1', 5, '6-1', 4, '6-1', 3, '6-1', 2, '6-2', 1 in this case)

And then you just have to copy and paste the code into the IDE.
Maybe I'm just being pedantic and this actually isn't faster than just doing it manually.
Seems like it would be useful. If I get around to building it, I'll share it.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 213 guests