can't get spriter to work (it does, but nothing shows up)

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
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

can't get spriter to work (it does, but nothing shows up)

Post by girng »

i'm using hardcrawler spriter addon (https://bitbucket.org/hardcrawler/spriter) bless his heart.
Unfortunately i'm not able to get it to work. i loaded everything in,

Code: Select all

    spriterData = Spriter:loadSpriter("assets/spriter", "gbot")
    local animationNames = spriterData:getAnimationNames()
    spriterData:setCurrentAnimationName( "idle" )
i have

Code: Select all

spriterData:update( dt )
in my love.update

and i am drawing with:

Code: Select all

spriterData:draw( 0, 0 )
but nothing shows up on my screen.

These are my errors that I fixed, did i fix it wrong?
  • 1364 line: i changed canvas:clear() to love.graphics.clear()
  • then:
    addons/spriter/Spriter.lua:1415: Invalid blend mode 'premultiplied', expected one of: 'alpha', 'add', 'subtract', 'multiply', 'lighten', 'darken', 'screen', 'replace', 'none'.
    so i replaced:

    Code: Select all

    love.graphics.setBlendMode('premultiplied')
    with:

    Code: Select all

    love.graphics.setBlendMode("multiply", 'premultiplied')
got rid of the errors. but still nothing is showing up. man, i was so close too... i rigged my character with spriter..and everything :cry: :cry:
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

Re: can't get spriter to work (it does, but nothing shows up)

Post by girng »

ok actually it does show up!

however, it's inside a huge black canvas. it's HUGE and the character's offset is not correct:
Image

is there a way to just have it be drawn like if you were drawing an image? (rid of the black canvas, and remove weird offset)
position is supposed to be 0,0 lol

here is the Sprite:draw function if you need to take a look
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: can't get spriter to work (it does, but nothing shows up)

Post by pgimeno »

girng wrote: Thu Sep 13, 2018 12:21 pm so i replaced:

Code: Select all

love.graphics.setBlendMode('premultiplied')
with:

Code: Select all

love.graphics.setBlendMode("multiply", 'premultiplied')
I think you want "alpha", "premultiplied".
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

Re: can't get spriter to work (it does, but nothing shows up)

Post by girng »

pgimeno wrote: Thu Sep 13, 2018 2:05 pm
girng wrote: Thu Sep 13, 2018 12:21 pm so i replaced:

Code: Select all

love.graphics.setBlendMode('premultiplied')
with:

Code: Select all

love.graphics.setBlendMode("multiply", 'premultiplied')
I think you want "alpha", "premultiplied".
Nice! Thank you! The black part is now gone. Yay! Now, just the character's x and y position is at a weird offset.
i'm doing

Code: Select all

spriterData:draw( 0, 0 )
but it is showing if it was at 400, 500 or something. Gonna take a look in the :draw method again
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

Re: can't get spriter to work (it does, but nothing shows up)

Post by pgimeno »

I think you can do spriterData:setCanvasOffset(-400, -500) or something like that. I don't use spriter, sorry. Doesn't Spriter offer a hook point? If so, that should be automatically used, but it doesn't appear like the library can handle that.
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

Re: can't get spriter to work (it does, but nothing shows up)

Post by girng »

@pgimeno i found a solution i think

Code: Select all

function Spriter:spriterToScreen( x, y )
	local centerx = Spriter.canvas:getWidth() / 2
	local centery = Spriter.canvas:getHeight() - 200
change -200 to / 2

then,

Code: Select all

--Using a shared canvas to avoid creating too many
--Not sure if the best idea, and certainly clunky to hard-code w/h
function Spriter:getCanvas()
	if not self.canvas then
		Spriter.canvas = love.graphics.newCanvas(300, 300)
	end
	return self.canvas
end
this was at a whopping 1000, 1000. change it to whatever the width/height of your char is. works perfectly so far! hope this helps anyone seeing this thread!

Image

btw, got my assets here: https://github.com/ndee85/gBot totally free MIT license. good for skeleton base!

edit: now i need to figure out how to change the animation speed :X
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

Re: can't get spriter to work (it does, but nothing shows up)

Post by girng »

BOOOOOOOOOM just figured out hoow to change the animation speed

Code: Select all

time = time + (dt * self.animation_speed)
under function Spriter:incrementTime( dt )

man, this is addon is FREAKING EPIC! i might actually buy spriter lolz. now can change it dynamically based upon a player's speed, etc. hell yeah :D :D
girng
Prole
Posts: 40
Joined: Fri Sep 07, 2018 5:42 am

Re: can't get spriter to work (it does, but nothing shows up)

Post by girng »

Damn. Looks like there is one huge problem after doing all this to get it to work.

There is no animation transitioning. I have no clue on how to incorporate that :cry:

I checked out Spine's love runtime, works quite well (has animation transitioning too!). Except that puppy is $69.99 w/o even full IK support. And $300 with full IK. That's insane. FML

Could there be any possible workarounds?
Post Reply

Who is online

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