while (system.run()) { // render stuff here screen.flip(); // update stuff here}
Dispatch.onUpdate(doUpdate);Dispatch.onRender(doRender);function doUpdate(){ // update stuff here}function doRender(){ // render stuff here}
Oh, alright. Also, why was fs changed to FS?
Quote from: Eggbert on November 10, 2016, 04:02:31 pmOh, alright. Also, why was fs changed to FS?The release notes for 4.3 explain this. Mostly it was done to match other JS namespaces like Math and Reflect. It's not really an object representing the file system so much as "the place where file system functions live." So it gets an uppercase name. A concrete global "this is the file system" variable only really makes sense if the engine supports multiple independent file systems, which doesn't seem like something we need in Sphere.screen on the other hand was left lowercase because it's an actual Surface object, just one that happens to represent the backbuffer. It's not a namespace but a true object in the OOP sense. The alternative is to call it Surface.Screen for consistency with Mixer.Default etc. but that's a bit verbose for an object that will be referenced all the time. tl;dr: API consistency concerns.
const assert = require('assert');const test = require('test');test.run({ testFatburner: function() { var scott = existence.find("Scott Starcross"); var maggie = existence.find("maggie"); var fatburner = existence.find("Holy Blade Fatburner"); scott.equipWeapon(fatburner); scott.attack(maggie); assert.ok(maggie.deceased); }, testMunch: function() { var scott = existence.find("Scott Starcross"); var maggie = existence.find("maggie"); maggie.munch(scott); assert.ok(!existence.has(scott)); }});