Skip to content

Commit

Permalink
restore an fps block
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Aug 16, 2023
1 parent bf47871 commit dd5f789
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions extensions/XeroName/Deltatime.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ I learned how to use "Runtime Steps" of Scratch VM through that code.
opcode: 'dt',
blockType: Scratch.BlockType.REPORTER,
text: 'ΔT'
},
{
opcode: 'fps',
blockType: Scratch.BlockType.REPORTER,
text: 'fps'
}
]
};
Expand All @@ -53,6 +58,10 @@ I learned how to use "Runtime Steps" of Scratch VM through that code.
dt() {
return deltaTime;
}

fps() {
return +(1 / deltaTime).toFixed(2);
}
}

Scratch.extensions.register(new Dt());
Expand Down

0 comments on commit dd5f789

Please sign in to comment.