RESCOMP and individual nametable entries?

SGDK only sub forum

Moderator: Stef

diegzumillo
Newbie
Posts: 9
Joined: Sun Sep 08, 2019 6:35 pm

Re: RESCOMP and individual nametable entries?

Post by diegzumillo » Sat Mar 28, 2020 8:40 pm

vnsbr wrote:
Thu Mar 26, 2020 8:13 am
Do you have more details how to set priority bit with aseprite?
Just choose the colors from the palette! they are ordered. You want to repeat the first 16 colors at 128th position.

I wrote an Aseprite script that makes my life easier a little. I work in two layers, one is background the other is foreground (both meant for the same plane). The script goes through all tiles in the foreground palette and if there's anything there it changes the color for the equivalent one starting at 128 (if it's color 2 it changes to 130 etc). You just need to properly arrange the colors of the palette so they match.

Code: Select all

local cel = app.activeCel
local cx0 = cel.position.x
local cy0 = cel.position.y
local cx1 = cel.bounds.width + cx0
local cy1 = cel.bounds.height + cy0

local curImg = cel.image

function PutPixel(x,y,c)
	app.useTool{
		tool="pencil",
		color=Color(c),
		brush=Brush(),
		points={ Point (x,y) },
		cel=cel,
		layer=cel.layer,
		frame=cel.frame
	}
end


for tx = 0, cx1, 8 do
	for ty = 0, cy1, 8 do
		--check if this tile has anything
		local present = false
		for x = tx, tx+7, 1 do
			for y = ty, ty + 7, 1 do
				if( x >= cx0 and y >= cy0 and x < cx1 and y < cy1) then
					if(curImg:getPixel(x-cx0,y-cy0)>0) then
						present = true
						break
					end
				end
			end
			if(present)then
				break
			end
		end
		
		if(present)then
			--process this tile
			for x = tx, tx + 7, 1 do
				for y = ty, ty + 7, 1 do
					if( x >= cx0 and y >= cy0 and x < cx1 and y < cy1) then
						if(curImg:getPixel(x-cx0,y-cy0)<16)then
							PutPixel(x,y,curImg:getPixel(x-cx0,y-cy0)+128)
						end
					else 
						PutPixel(x,y,128)
					end
				end				
			end		
		end
	end
end

app.refresh()

Post Reply