How To

How to get the palette of a cell at a position


412lop 2023-06-01 22:04

I need to know how to do this for a program I’m making

McPepic 2023-06-02 00:09 (Edited)


was8bit 2023-06-02 12:52

In situations where you only use PAL (no flip, etc) then CELL.A will work...

CELL.A returns a value covering all attribute changes.... but i usually only use PAL

McPepic 2023-06-02 14:07

Yeah, but ‘and’ing it with the mask ignores all other bits - giving you just the palette.

was8bit 2023-06-02 16:56

Absolutely :) yours is the best solution.... :)

But, lets say they forget the AND %111 ... the CELL.A will still work for a simple background

I have, in my list of programs, code that yields all of CELL.A settings seperately, including the unused bit ;) i forget the code though ...

was8bit 2023-06-02 17:01

Another trick i have tried to use, is keeping a BG layer hidden, and use that to store levels... examples..

A locked box requires key#, the key# it needs is stored below it in the hidden background

A strong door requires so many hit points before it breaks open, its current hit points are stored below in the hidden background

Mystery bags hid different treasures, or different bad things... whats hidden in each bag is stored in the hidden background..

was8bit 2023-06-02 17:03

One could add pallete as information that adds extra info as gold or silver, or who owns the item...

was8bit 2023-06-02 17:04

.... i know i got off topic ... ;)

McPepic 2023-06-02 17:05

That's interesting. In the past, I've used data commands where each number represents a tile or group of tiles. This data is then loaded into an array for quick access. I've never used data from a separate background before.

was8bit 2023-06-02 17:06

One could read the FLIP of a cell, keep the cell a solid color, but the FLIP could then be used to hide info such as booby traps, direction of slide or movemenr, etc...

was8bit 2023-06-02 17:10

My rendition of Timo's game (not yet finished) uses a hidden background to hold hit points of all the ememies...

... the enemies are completely randomly placed, and move randomly cell to cell.. their hit points follow them on the hidden background...

This allows for multiple adding and removing of enemies without using arrays, and still keeps track of each enemies hit points.. ;)

.. its in my list of games... i forget its name though..

Log in to reply.