Jump to content

Load HUD animation


Recommended Posts

So far I got my compass widget working, but when I try to change the default arrow for my custom one it doesn't shows up at all. I was digging around the files and it seems that the hud loads its resources by creating a prefab, but when I try to do the same it still doesn't works.

My question is, how do I load an Anim for my hud element?

I have the following:

widgets/rotatingcompass.lua

...
    self.needle = self:AddChild(UIAnim())
    self.needle:GetAnimState():SetBank("one_direction_needle")
    self.needle:GetAnimState():SetBuild("one_direction_needle")
    self.needle:GetAnimState():PlayAnimation("idle")
...

prefabs/one_direction_needle.lua

local assets =
{
    Asset("ANIM", "anim/one_direction_needle.zip"),
}

local prefabs =
{
}

--we don't actually instantiate this prefab. It's used for controlling asset loading
local function fn()
    return CreateEntity()
end

return Prefab("one_direction_needle", fn, assets, prefabs)

modmain.lua

PrefabFiles = {
	"one_direction_needle",
}

Assets =
{
	Asset("ANIM", "anim/one_direction_needle.zip")
}
...

Also, attaching the anim files.

one_direction_needle.zip

one_direction_needle[EXPORTED].zip

 

 

EDIT: I'm doing something wrong with the anims. Setting the Bank to "compass_needle" (the one from the base game) and the Build to "one_direction_needle" (the one from my mod) seems to work.

Edited by Ryuushu
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...