Memorial

From CC Wiki
Revision as of 22:43, 5 January 2024 by Petthepetra (talk | contribs) (more detail)
Jump to navigationJump to search

also known as "message" in the codebase

The Memorial object as it appears in Celeste Classic

The Memorial is an object first introduced in Celeste Classic that displays text when the player stands in front of it.

While the text of the memorial can be modified, in the original game it reads as follows:

-- celeste mountain --

this memorial to those

perished on the climb

Technical info

The text of the memorial is stored within the string variable this.text, which is initialized and parsed during the draw function. Any hash characters are converted into line breaks.

The object iterates through the string at a rate of 0.5 chars/frame, playing sfx 35 once a new character is reached.

Original code

message={
  tile=86,
  last=0,
  draw=function(this)
    this.text="-- celeste mountain --#this memorial to those# perished on the climb"
    if this.check(player,4,0) then
      if this.index<#this.text then
       this.index+=0.5
        if this.index>=this.last+1 then
         this.last+=1
         sfx(35)
        end
      end
      this.off={x=8,y=96}
      for i=1,this.index do
        if sub(this.text,i,i)~="#" then
          rectfill(this.off.x-2,this.off.y-2,this.off.x+7,this.off.y+6 ,7)
          print(sub(this.text,i,i),this.off.x,this.off.y,0)
          this.off.x+=5
        else
          this.off.x=8
          this.off.y+=7
        end
      end
    else
      this.index=0
      this.last=0
    end
  end
}
add(types,message)