Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

Fantasy computer for making, playing and sharing tiny games. · By Nesbox

How can I turn up the brightness of the palette while it is running?

A topic by Flox created Dec 10, 2021 Views: 153 Replies: 3
Viewing posts 1 to 3

I am making a game and I need to turn up the brightness of a colour individually when the game is running.

Developer

You can access the current palette in the VRAM using peek()/poke() API functions.

Here is an example https://github.com/nesbox/TIC-80/wiki/Sample-RGB-Color-RAM-Address

Emm… This is a little hard for me to understand. I don’t know why and what changed after the memory was written in the example. Can you explain it in more detail please?

This might help - read it with the example given by Nesbox and refer to the Wiki :D

local red=0
local green=0
local blue=0
--r,g,b values are in range 0-255
--three consecutive addresses for
--each palette entry
--modify palette index 1
--by poking max rgb values into
--its 3 addresses, making it white 
poke(0x3FC3, 255)
poke(0x3FC4, 255)
poke(0x3FC5, 255)
function TIC()
 --palette index 0 is black by default
 cls(0)
 --hold button A (ie key 'Z')
 --to increase red component of index 0
 if btn(4) then
  if red<255 then red=red+1 end
  poke(0x3FC0, red)
  poke(0x3FC1, green)
  poke(0x3FC2, blue)
 end
 print('This text drawn using index 1',0,16,1)
end