Skip to content

Investigate and match Scratch's timer implementation #180

@towerofnix

Description

@towerofnix

The current timer implementation in Leopard is very rudimentary:

leopard/src/Project.js

Lines 251 to 254 in 25652b1

get timer() {
const ms = new Date() - this.timerStart;
return ms / 1000;
}

This would be quite dandy if that's how the timer worked in Scratch, too, but it's not 📦

See this project I made last year which shows that the timer block is only updated once every rendered Scratch frame. (The main project loop runs many times in one frame unless you click "simulate movement", which enables requesting a screen redraw every tick.)

See all the gruesome details in scratch-vm: clock.js, sequencer.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityBugs that cause Leopard's behavior to differ from Scratch's

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions