Deprecated: str_replace(): Passing null to parameter #1 ($search) of type array|string is deprecated in /var/www/vhosts/gamedevstudiogame.com/httpdocs/classes/client.php on line 124

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /var/www/vhosts/gamedevstudiogame.com/httpdocs/classes/client.php on line 124
Game dev studio

Classes

developer »

gameProject »

pedestrianController »

playerPlatform »

punishment »

team »

Concepts

Libraries

Objects

castLight

Description

Abstract. This is where you should put all your light-emitting related stuff into, as the image data preparation loop will go through all object grid tiles and call this method on any object it finds.

Example

-- taken from game/objects/light_source_base.lua

lightSource.lightColor = color(251, 255, 237, 255)

function lightSource:castLight(imageData, pixelX, pixelY)
	local clr = self.lightColor
	local r, g, b = imageData:getPixel(pixelX, pixelY)
	
	imageData:setPixel(pixelX, pixelY, math.max(r, clr.r), math.max(g, clr.g), math.max(b, clr.b), 255)
end