Ah I think I understand what you want:
Show the background color of the grid tile & its ascii symbol.
But when the player walks over it show the background color of the GRID and the ascii of the PLAYER.
Right ?
Then you have to change how the engine sends map info to the core to be displayed. Luckily I already thought about that

In your load.lua you want to add:
Code: Select all
local Map = require "engine.Map"
Map.updateMapDisplay = function (self, x, y, mos)
local g = self(x, y, self.TERRAIN)
local gb = nil
local o = self(x, y, self.OBJECT)
local a = self(x, y, self.ACTOR)
local t = self(x, y, self.TRAP)
local p = self(x, y, self.PROJECTILE)
if g then
-- Update path caches from path strings
for i = 1, #self.path_strings do
local ps = self.path_strings[i]
self._fovcache.path_caches[ps]:set(x, y, g:check("block_move", x, y, ps, false, true))
end
g:getMapObjects(self.tiles, mos, 1)
g:setupMinimapInfo(g._mo, self)
if g.default_tile then gb = g.default_tile end
end
if t then
-- Handles trap being known
if not self.actor_player or t:knownBy(self.actor_player) then
t:getMapObjects(self.tiles, mos, 3)
t:setupMinimapInfo(t._mo, self)
else
t = nil
end
end
if o then
o:getMapObjects(self.tiles, mos, 3)
o:setupMinimapInfo(o._mo, self)
if self.object_stack_count then
local mo = o:getMapStackMO(self, x, y)
if mo then mos[5] = mo end
end
end
if a then
-- Handles invisibility and telepathy and other such things
if not self.actor_player or self.actor_player:canSee(a) then
a:getMapObjects(self.tiles, mos, 3)
a:setupMinimapInfo(a._mo, self)
end
end
if p then
p:getMapObjects(self.tiles, mos, 3)
p:setupMinimapInfo(p._mo, self)
end
if gb and not p and not a and not o and not t then
gb:getMapObjects(self.tiles, mos, 3)
end
end
This will modify the display code to work nearly exactluy the same as before except it will place everything but the terrain on the same Z layer, so the display will show in order either: projectiles, actors, objects or traps.
It also checks for a "default_tile" property on the terrain and dislpays it if no projectiles, actors, objects or traps are found.
This means taht if you change your grids.lua to:
Code: Select all
newEntity{
define_as = "DOWN",
name = "next level",
default_tile=class.new{_noalpha=false, display = '>', color_r=130, color_g=255, color_b=30}, display='', back_color=colors.SLATE,
notice = true,
always_remember = true,
change_level = 1,
}
newEntity{
define_as = "FLOOR",
name = "floor",
default_tile=class.new{_noalpha=false, display = ' ', color_r=185, color_g=185, color_b=245}, display='', back_color=colors.SLATE,
always_remember = true,
}
newEntity{
define_as = "WALL",
name = "wall",
default_tile=class.new{_noalpha=false, display = '#', color_r=165, color_g=165, color_b=205}, display='', back_color=colors.DARK_SLATE_GRAY,
always_remember = true,
does_block_move = true,
can_pass = {pass_wall=1},
block_sight = true,
air_level = -20,
dig = "FLOOR",
}
newEntity{
define_as = "DOWN2",
name = "next level",
default_tile=class.new{_noalpha=false, display = '>', color_r=230, color_g=100, color_b=100}, display='', back_color=colors.SLATE,
notice = true,
always_remember = true,
change_level = 1,
change_zone = "dungeon2",
}
It'll do what you want
Basically this grids.lua file defines the same grids you did but only gives them a backcolor. The ascii symbol is set in the default_tile. This way the ascii symbol is only shown if nothing is over the terrain.