Tophat tips
The API reference is your best friend.
Rotations are in degrees.
Assets paths are prefixed with the
dir. That is./by default, but you can specify it using thedirflag. If you prefix a path withraw://, it will not be changed by tophat.
You can get last frame length from
th.delta. This is useful for making your game FPS independant. A good rule of thumb is to multiply any kind of movement by theth.deltavalue.
Resizing the window won't change how the game is displayed - the viewport stays the same. The viewport size is in the
window.wpvariable. You can change it to your liking.
Dimensions of one
canvas.drawTextcharacter is 5x5 px, and the character spacing is 1px.
input.getMouseDeltaworks even if the cursor is frozen usingwindow.freezeCursor