In this tutorial, I shall demonstrate how to create an ammo counter in TombEngine.
In order to fully complete this tutorial you need knowledge of:
LevelFuncs.OnControlPhase = function()
ShowAmmoCounter()
end
function ShowAmmoCounter()
local ammoCounterPosX = 100 -- X Position of counter.
local ammoCounterPosY = 300 -- Y Position of counter.
local holdWeapon = Lara:GetHandStatus() -- Check Lara's hand status.
local ammoCounterColor = Color.new(--[[Insert RGB values]])
local ammoMessage = DisplayString(
"Ammo: "..holdWeapon, ammoCounterPosX,
ammoCounterPosY, ammoCounterColor)
if (Lara:GetAmmoCount() == -1) then
unlimited = true
else
unlimited = false
end
if not unlimited then
if holdWeapon == 4 then
ShowString(ammoMessage)
else
HideString(ammoMessage)
end
end
end
This is a community project which is not affiliated with Core Design, Eidos Interactive, or Embracer Group AB. Tomb Raider is a registered trademark of Embracer Group AB. TombEngine is not be sold. The code is open-source to encourage contributions and to be used for study purposes. We are not responsible for illegal uses of this source code. This source code is released as-is and continues to be maintained by non-paid contributors in their free time.