• Do not use Works in Progress as a way of avoiding the releases system! Works in Progress can be used for sharing early betas and for getting suggestions for improvement. Releases of finished content are not allowed in this forum! If you would like to submit a finished addon, click here for instructions on how to do so.

How to put a sprite into the HUD?

Status
Not open for further replies.

GLide KS

Sometimes I sprite "things"
Hello, so, i was seeing Lua/Functions, and i cant get it the hud.add function, so, someone explain me or show me how to do make a sprite appear in the HUD.
 
I think this might belong in Editing help as opposed to just Editing. I'm afraid that I'm not good with Lua so all I can do is point you in a better direction where you might get an answer more quickly. You could also probably try coming onto the irc chat and asking there, you might get a response much more quickly.

Cheers!
 
As far as My knowledge takes me:

1) It most likely belongs in editing, echoing what Tidbit said

2) Try this Lua Script to render sprites on the HUD:

Code:
hud.add(function(v, player)
	//v is the HUD, player is to access the player's variables whilst in the HUD.add function
	local patch = v.cachePatch("ABCDEFGH")
	//v.draw - Draws the patch at the exact pixel size
	v.draw(x pos here, y pos here, patch)
	//v.drawScaled - Draws the patch at a fixed scale (multiply it by FRACUNIT)
	v.drawScaled(X pos here, Y pos here, Scale e.g. 2*FRACUNIT or FRACUNIT/2)
end, "game")
//"game" - renders it to the in-game HUD
//"scores" - Renders it to the in-game Scores HUD

Hope this helps!
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top