Memorial: Difference between revisions

From CC Wiki
Jump to navigationJump to search
(first draft)
 
(formatting)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[File:Memorial.png|thumb|The Memorial object as it appears in Celeste Classic]]
''also known as "message" in the codebase''[[File:Memorial.png|thumb|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.
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:<blockquote>-- celeste mountain --
this memorial to those
perished on the climb</blockquote>
== 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 ==
<pre>
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)
</pre>
[[Category:Mechanics]]
[[Category:Mechanics]]

Latest revision as of 22:45, 5 January 2024

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)