Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

TIC-80

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

palette lost if I load an external lua script ?

A topic by fabricius created Apr 07, 2021 Views: 325 Replies: 3
Viewing posts 1 to 4

Hello,

I just bought the PRO version in order to be able to edit the code with an external editor (I'm an GNU Emacs fan).  I first played with the online TIC-80 editor and once I got something for a start I made snapshots of my code and recreated it in a .lua file. When I import this .lua file in TIC-80, it's all black. I wondered why, but I saw that the palette was entirely black. I thought it would keep the default palette after having loaded my lua file. What did I do wrong ? 

By the way, thanks for TIC-80, it's really great!

Answering to myself. Indeed, the palette seems to be lost (all colors are black), but the default palette can be found here: Palette · nesbox/TIC-80 Wiki (github.com) I just need to copy paste the whole string (given on the page), go to the sprite editor, click advanced mode and then click on the "paste" button to use the copied palette hexadecimal string. Now my rectangles are displayed (I dont use sprite for my current project, I only draw pixels and rectangles on the screen)

Developer (2 edits)

Hi, try to add `<PALETTE>` tag to the .lua file, it should look like this one

-- title:  game title
-- author: game developer
-- desc:   short description
-- script: lua
t=0
x=96
y=24
function TIC()
if btn(0) then y=y-1 end
if btn(1) then y=y+1 end
if btn(2) then x=x-1 end
if btn(3) then x=x+1 end
cls(13)
spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
print("HELLO WORLD!",84,84)
t=t+1
end
-- <PALETTE>
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
-- </PALETTE>


Thanks.

(+1)

Hi Nesbox, I tested it and it works like a charm! Thank you for the quick response. And thank you for having done TIC-80, it really reminds me the pleasure I had coding games in BASIC on my Amstrad CPC back in times (let's say 30 years ago). I love the "battery-included" environment with everything needed to create a game. Cheers from France!