Jump to content

Mirror/flip an anim through Spriter?


Recommended Posts

Hello, I need some help :)!

So...is it possible to mirror/fip an animation through Spriter? Like I made an animation, but realized I want it to face the opposite way..would I have to redo the entire thing from scratch all over again :(?

Edited by SuperDavid
Link to comment
Share on other sites

Well, basically it's actually just the death anim I'm trying to flip then I can play it alongside the wakeup anim for a "stun" anim without having to create one from scratch.

Here it is, it's the one called "collapse", I tried putting - at the x part, but it would get a little weird-ish so I don't know what to do, so I really appreciate your assistance man :)!

anim.zip

And thanks for your reply/help Aquaterion :D!!

Edited by SuperDavid
Link to comment
Share on other sites

I remembered seeing your collapse stategraph in another post so I just added to it:

local collapse = State {
	name = "collapse",
	tags = { "busy", "pausepredict", "nomorph", "collapsed" },
	onenter = function(inst)
		--inst.Physics:Stop()
		local sX, sY, sZ = inst.Transform:GetScale()--1. Get current scale
		inst.Transform:SetScale(-sX, sY, sZ)--2. flip the X axis
		inst.AnimState:PlayAnimation("death")  
			
		if not inst:HasTag("mime") then
			inst.SoundEmitter:PlaySound((inst.talker_path_override or "dontstarve/characters/")..(inst.soundsname or inst.prefab).."/death_voice")
		end
		if inst.components.playercontroller ~= nil then
			inst.components.playercontroller:RemotePausePrediction()
		end
	end,
	timeline =
	{
		TimeEvent(45 * FRAMES, function(inst)
			local rotat = inst.Transform:GetRotation() + pi
			if rotat > pi and rotat <= pi*2 then
				print(tostring(rotat).." left")
				inst.Transform:SetRotation(-pi/2)
			else
				print(tostring(rotat).." right")
				inst.Transform:SetRotation(pi/2)
			end
			local sX, sY, sZ = inst.Transform:GetScale()--3. Get current scale
			inst.Transform:SetScale(-sX, sY, sZ)--4. reflip the X axis
			inst.AnimState:PlayAnimation("wakeup")
		end),		
		TimeEvent(55 * FRAMES, function(inst)
			inst.sg:RemoveStateTag("busy")
			inst.sg:RemoveStateTag("collapsed")
		end),
	},
	events =
	{
		EventHandler("animover", function(inst)
			if inst.AnimState:AnimDone() then
				inst.sg:GoToState("idle")
			end
		end),
	},
}

 

 

Link to comment
Share on other sites

It seems like nothing different really happened, at least from what I can notice :confused:

Thanks for your help though Aquaterion :)!

Edit: Maybe it's cause I'm using a newer collapse state?  ...though they're practically the same, so probably not 

Spoiler

local pi = GLOBAL.PI
local degrees = GLOBAL.DEGREES
local collapse = State {
	name = "collapse",
	tags = { "busy", "pausepredict", "nomorph", "collapsed" },
	onenter = function(inst)
		inst.AnimState:PlayAnimation("death")
		
		if not inst:HasTag("mime") then
			inst.SoundEmitter:PlaySound((inst.talker_path_override or "dontstarve/characters/")..(inst.soundsname or inst.prefab).."/death_voice")
		end
		
		if inst.components.playercontroller ~= nil then
			inst.components.playercontroller:RemotePausePrediction()
		end
	end,
	
	timeline =
	{
		TimeEvent(45 * FRAMES, function(inst)
			local rotat = inst.Transform:GetRotation() + pi
			if rotat > pi and rotat <= pi*2 then
				print(tostring(rotat).." left")
				inst.Transform:SetRotation(-pi/2)
			else
				print(tostring(rotat).." right")
				inst.Transform:SetRotation(pi/2)
			end
			inst.AnimState:PlayAnimation("wakeup")
		end),
		
		TimeEvent(55 * FRAMES, function(inst)
			inst.sg:RemoveStateTag("busy")
			inst.sg:RemoveStateTag("collapsed")
		end),
	},
	
	events =
	{
		EventHandler("animover", function(inst)
			if inst.AnimState:AnimDone() then
				inst.sg:GoToState("idle")
			end
		end),
	},
}
local function SGWilsonPostInit(sg)
    sg.states["collapse"] = collapse
end
AddStategraphState("SGwilson", collapse)
AddStategraphPostInit("wilson", SGWilsonPostInit)

 

 

Edited by SuperDavid
Link to comment
Share on other sites

Not one i'm aware of, but maybe you could do a general search about spriter itself on google and see if you find something. Because the program isn't used only for don't starve so maybe you'll find more outside

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...