All pastes #606520 Raw Edit

Something

public text v1 · immutable
·published 2007-07-06 22:05 UTC
rendered paste body
ENT={}

ENT.name = "Test object."
ENT.desc = "Sits there doing nothing."
ENT.author = "yuriks"

-- Guaranteed to be called at least once
-- Here you should load all needed resources
function ENT:precache()
	if (not self.global.data['idle_sprite']) then -- Please, always make these checks
		self.global.data['idle_sprite'] = disk.loadSprite("images/idle.png")
	end
end

-- Called when the entity is created (not spawned!)
function ENT:create()
	-- Do nothing.
end

-- Called when the entity is drawn
function ENT:draw()
	screen.drawSprite(self.global.data['idle_sprite'], self.getPos())
end

function ENT:think(time)
	-- Time is number of ticks (seconds) since last update
	-- ideally this will be called once per frame, but bad stuff may happen.

	-- Do nothing. =D
end


-- Note: you may omit any empty functions