Convert Chests to look like Mimics. Look for other interesting things to do. Short morning today. But some progress.
I have an eyeball appointment this morning, so the “work day” will be a bit short1. We are moving slowly closer to having some chests be safe and some not. I am assuming now that there will be no visible difference between them. I’m not sure how best to do that. Monsters presently announce themselves with music and an attribute sheet. Doing that with a mimic pretending to be a chest might give the player too much of a clue.
Maybe we’ll have it be a chest and turn into a Mimic. That should be easy enough. Anyway, that’s for later. This morning I’m going to start by changing what a chest looks like.
Chest is a fairly simple class. Here’s the whole thing:
Chest = class() function Chest:init(tile, runner) tile:moveObject(self) self.runner = runner self.closedPic = asset.builtin.Planet_Cute.Chest_Closed self.openPic = asset.builtin.Planet_Cute.Chest_Open self.pic = self.closedPic end function Chest:draw(tiny, center) if tiny then return end pushMatrix() pushStyle() spriteMode(CENTER) sprite(self.pic,center.x,center.y+10, 55,75) popStyle() popMatrix() end function Chest:getTile() return self.tile end function Chest:query() return "I am probably a mysterious chest." end function Chest:setTile(tile) self.tile = tile end function Chest:isOpen() return self.pic == self.openPic end function Chest:open() if self:isOpen() then return end self.pic = self.openPic Loot(self.tile, "Health", 4,10) end
Chests currently have a closed picture and an open one. I don’t have art for a non-mimic open chest that looks like the regular mimic chest. We’ll just finesse that for now by making the pictures the same.
Glancing at the sprite sheet for mimic hiding, I think I’ll choose the second image:
function Chest:init(tile, runner) tile:moveObject(self) self.runner = runner self.closedPic = "mhide02" self.openPic = "mhide02" self.pic = self.closedPic end
And we have to change the
sprite call to be prepared to decode and look up a string.
That looks OK. It seems not to work. When I try to step on it, I don’t get anything. Also, I’m getting a strange message about assets, perhaps from the Mimic.
I was hoping for an easy morning.
Ah. We check for open using the pictures:
function Chest:isOpen() return self.pic == self.openPic end function Chest:open() if self:isOpen() then return end self.pic = self.openPic Loot(self.tile, "Health", 4,10) --Health(self.tile, self.runner) end
They are assumed to be different. We should use a separate indicator.
function Chest:init(tile, runner) tile:moveObject(self) self.runner = runner self.closedPic = "mhide02" self.openPic = "mhide04" self.pic = self.closedPic self.opened = false end function Chest:isOpen() return self.opened end
I also found that I forgot to fix the AttributeSheet to convert the names of sprites to images.
function AttributeSheet:drawPhoto(aSprite) sprite(Sprites:sprite(aSprite), 200, 6, 50) end
I should just plug that in to every sprite call in the system, I guess. Can’t hurt, will help i and when I change an image.
I think it’s working now, but of course the chest doesn’t change much from closed to open. But whatever it gives is on top.
I’ll see if I can edit the picture to make an open one. Shouldn’t be too far beyond my capabilities. He imagined.
That’ll do for today, my eyes are still dilated and it’s 1730. Commit: Chest looks like mimic.
Just a quick hit today, changing the graphics for Chest. In so doing we discovered a sort of a hack, that the chest determined whether it was open or closed depending on its picture. That’s too clever for its shirt. So I added a flag.
Next time, if all goes well, we’ll see about making some chests be actual Mimics, or change to Mimics, or something.
I have some ideas for the Mimic Strategy and graphics, since we have so many different mimic drawings. Might as well use them.
For now, we’re outa here. See you next time!
Shorter than your usual two hours? Where can I get a job like yours? Oh, there’s no pay? Never mind. ↩