Using sprites - NLferdiNL/Teardown-Chaos-Mod GitHub Wiki

Using sprites is very similar to sounds, but even easier.

You simply put a string with the path to the sprite, and the mod will replace it with a handle reference to that sprite.

Below is an example of an effect using a sprite. (This is a shortened version of the flood effect.)

suddenFlood = {
	name = "Flood",
	effectDuration = 10,--20,
	effectLifetime = 0,
	hideTimer = false,
	effectSFX = {},
	effectSprites = {"MOD/sprites/square.png"},
	effectVariables = { waterHeight = -1 },
	onEffectStart = function(vars) 
		vars.effectVariables.waterHeight = math.random(12, 15)
	end,
	onEffectTick = function(vars)
		local waterPos = GetPlayerPos()

		waterPos[2] = vars.effectVariables.waterHeight
		
		local rotation = QuatEuler(90, 0, 0)
		
		DrawSprite(vars.effectSprites[1], Transform(waterPos, rotation), 500, 500, 0, 0, 1, 0.25, true, true)
	end,
	onEffectEnd = function(vars) end,
},