drecalen Posted October 19, 2016 Share Posted October 19, 2016 hi, im working on my own character mod, and im importing my sona. however, i know about sprite flipping and i know that doesnt go over well with asymmetrical characters. how to i fix this, if possible? Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/ Share on other sites More sharing options...
halfrose Posted October 19, 2016 Share Posted October 19, 2016 18 hours ago, drecalen said: hi, im working on my own character mod, and im importing my sona. however, i know about sprite flipping and i know that doesnt go over well with asymmetrical characters. how to i fix this, if possible? I will assume your sona is your icon? which if so, then I have an easy solution for that What you need to do first, is to duplicate its build and separate it by folders, example: mychar_right mychar_left In it you will add the differences to the head, accordingly where it is, left or right. Note however, that doing it with arms or legs doesn't really work well, as it will replace both legs or arms depending on the side it is facing. Then in your character prefab master_postinit, add the both anims example: local assets = { Asset( "ANIM", "anim/mychar_right.zip" ), Asset( "ANIM", "anim/mychar_left.zip" ), } then in the master_postinit inst:ListenForEvent("locomote", function(inst) if inst:HasTag("playerghost") then return end local dir = inst.Transform:GetRotation() local camera_rot = TheCamera:GetHeadingTarget() print("Camera rotation:", camera_rot) print("Direction:", dir) if camera_rot < 0 then camera_rot = camera_rot + 360 end if camera_rot == 0 or camera_rot == 45 then if dir <= 0 then inst.AnimState:SetBuild("mychar_right") else inst.AnimState:SetBuild("mychar_left") end elseif camera_rot == 90 or camera_rot == 135 then if math.abs(dir) >= 90 then inst.AnimState:SetBuild("mychar_right") else inst.AnimState:SetBuild("mychar_left") end elseif camera_rot == 180 or camera_rot == 225 then if dir >= 0 then inst.AnimState:SetBuild("mychar_right") else inst.AnimState:SetBuild("mychar_left") end else--if camera_rot == 270 or camera_rot == 315 then if math.abs(dir) <= 90 then inst.AnimState:SetBuild("mychar_right") else inst.AnimState:SetBuild("mychar_left") end end end) compile the two builds and run the game and see if the changes works. Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/#findComment-827134 Share on other sites More sharing options...
Aquaterion Posted October 19, 2016 Share Posted October 19, 2016 (edited) 1 hour ago, halfrose said: I will assume your sona is your icon? which if so, then I have an easy solution for that What you need to do first, is to duplicate its build and separate it by folders, example: mychar_right mychar_left In it you will add the differences to the head, accordingly where it is, left or right. Note however, that doing it with arms or legs doesn't really work well, as it will replace both legs or arms depending on the side it is facing. Then in your character prefab master_postinit, add the both anims example: local assets = { Asset( "ANIM", "anim/mychar_right.zip" ), Asset( "ANIM", "anim/mychar_left.zip" ), } then in the master_postinit --snip-- compile the two builds and run the game and see if the changes works. a simpler version: inst:ListenForEvent("locomote", function() if inst:HasTag("playerghost") then return end if inst.AnimState:GetCurrentFacing() == 2 then inst.AnimState:SetBuild("mychar") -- left animation elseif inst.AnimState:GetCurrentFacing() == 0 then inst.AnimState:SetBuild("mychar_right") -- right animation end end) Edited October 19, 2016 by Aquaterion Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/#findComment-827159 Share on other sites More sharing options...
drecalen Posted October 20, 2016 Author Share Posted October 20, 2016 (edited) thank you, both of you. Edited October 20, 2016 by drecalen Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/#findComment-827287 Share on other sites More sharing options...
halfrose Posted October 20, 2016 Share Posted October 20, 2016 11 minutes ago, drecalen said: thank you, and which file do i put this in exactly? im no script kiddie, but im no eilte coder ether the character prefab, it is where you can find the master_postinit. if that is what you are asking. Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/#findComment-827288 Share on other sites More sharing options...
drecalen Posted October 22, 2016 Author Share Posted October 22, 2016 On 10/19/2016 at 9:34 PM, halfrose said: the character prefab, it is where you can find the master_postinit. if that is what you are asking. ok, just a little bug, i already have a transform code in here, relying on sanity levels. how do i code it so it still does the left/right in each form? Link to comment https://forums.kleientertainment.com/forums/topic/70963-asymmetrical-character-sprites/#findComment-828282 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now