PicklePet Posted June 7, 2022 Share Posted June 7, 2022 (edited) I'm trying to make the absolute simplest widget to start my project, all I want is to display the meatballs sprite on a corner of the screen - this will be part of a server-based mod if that matters. This is what I've copy-catted out of Food Memory modmain.lua local require = GLOBAL.require local CravingDisplay = require "widgets/cravingdisplay" local function AddCravingDisplay(controls) controls.top_root(CravingDisplay(inst)) end AddClassPostConstruct( "widgets/controls", AddCravingDisplay ) scripts/widgets/cravingdisplay.lua local Widget = require "widgets/widget" local Image = require "widgets/image" local CravingDisplay = Class(Widget,function(self, owner) Widget._ctor(self,"CravingDisplay") --this part is a background box self.cravingdisp = self:AddChild(Image("images/frontend.xml", "button_square_halfshadow.tex")) self.cravingdisp_icon:SetPosition(-6,1) self.cravingdisp:SetScale(1,2,2) self.cravingdisp:SetTint(10,10,10,.5) self.cravingdisp:MoveToBack() --for the actual meatballs sprite self.cravingdisp_icon = self.cravingdisp:AddChild(Image("images/inventoryimages.xml","meatballs.tex")) self.cravingdisp_icon:SetPosition(-6,1) self.cravingdisp_icon:SetScale(1,.5,.5) end) return CravingDisplay *this forum is being poopy and won't let me edit this code, my final settings for position are (-600, -40) on the box. EDIT: My problem was that the meatballs sprite wasn't showing up. In the mod I was copying from it had a static reference from inventoryimages1.xml (where someone just told me meatballs used to be) in the setup, but in runtime the mode uses a dynamic reference from the meatballs prefab, thus why it worked there and not in mine. I've adjusted it to where meatballs.tex has moved to (inventoryimages.xml) and it's working great. Edited June 7, 2022 by PicklePet Problem Solved 1 Link to comment 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