Jump to content

[SOLVED] Basic Widget

Recommended Posts

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


local require = GLOBAL.require
local CravingDisplay = require "widgets/cravingdisplay"

local function AddCravingDisplay(controls)

AddClassPostConstruct( "widgets/controls", AddCravingDisplay )


local Widget = require "widgets/widget"
local Image = require "widgets/image"

local CravingDisplay = Class(Widget,function(self, owner)
    --this part is a background box
  self.cravingdisp = self:AddChild(Image("images/frontend.xml", "button_square_halfshadow.tex"))

    --for the actual meatballs sprite
  self.cravingdisp_icon = self.cravingdisp:AddChild(Image("images/inventoryimages.xml","meatballs.tex"))


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 by PicklePet
Problem Solved
  • Like 1
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

  • Create New...