Strawberry

From CC Wiki
Jump to navigationJump to search

Strawberries are collectibles that first appeared in celeste classic. they are never required to beat a level, but the summit flag tracks how many have been collected in total. Collecting all 18 is considered to be 100% completion. Some strawberries take the form of flying strawberries that fly upwards when the player dashes. Other berries can come out of chests when a key is collected. the player can collect a strawberry by touching it, which restores the player's dash, and even if the player dies afterwards the strawberry will remain collected and not come back. it is unclear whether madeline consumes the strawberries, collects them for later use, or simply causes them to disappear.

Original code

<blockquote>fruit={

    tile=26,

    if_not_fruit=true,

    init=function(this)

        this.start=this.y

        this.off=0

    end,

    update=function(this)

     local hit=this.collide(player,0,0)

        if hit~=nil then

         hit.djump=max_djump

            sfx_timer=20

            sfx(13)

            got_fruit[1+level_index()] = true

            init_object(lifeup,this.x,this.y)

            destroy_object(this)

        end

        this.off+=1

        this.y=this.start+sin(this.off/40)*2.5

    end

}</blockquote>

Glitches

After 18.2 minutes of a strawberry's cycle, the variable this.off will overflow, and the berry will suddenly jump to a lower point in its cycle. The sin() oddities that cause flying berry drift are still technically present, but they modify the berry's position rather than its speed, causing it to stay very close to the correct position.

A strawberry's behavior when its offset timer overflows

Strawberries that spawn from a chest are added to the object list after the player has already spawned into the level, so the player has to wait a frame longer to get her dash back from the berry.