If something does not look right you can reset the sandbox:
save world
This is a sandbox... you can change it play around and save it:
Welcome to the sandbox in Webwerkstatt! This page can be used to try out Lively and available applications. You might want to start with a tutorial about how objects can be manipulated (mov|webm). For more documentation please see the FAQ. If you have problems add a question there or send it to the mailing list. Shortcuts are here. Please note: To save this and other pages you need an account! See also the PartsBin sandbox page.
Webwerkstatt Sandbox
reset
// evaluate the following lines step by step by selecting an // expression and press CMD or Ctrl + d // Morphs have a name car = $morph('Car'); show(car) // we can add methods to morphs car.addScript(function drive() { this.moveBy(pt(10, 0)) }) // evaluate to move the car a bit car.drive() // we enhance the drive method so that the car will not leave the visble bounds car.addScript(function drive() { if (this.world().visibleBounds().containsRect(this.bounds())) this.moveBy(pt(10, 0)) }) // now we let the car drive alone car.startStepping(60/*ms*/, 'drive') // stop it! car.stopStepping() // Can you extend drive() so that the car turns when it reaches a border?
Code example: Building a car
X
M