Commit graph

274 commits

Author SHA1 Message Date
Tim Mickel
3d57c2e74c Drop single-stepping and pause modes (#294) 2016-10-20 11:42:16 -04:00
Tim Mickel
9af9a87cb6 Pass rotation center and bitmap resolution to renderer (#288) 2016-10-19 17:01:48 -04:00
Tim Mickel
e49f076fa1 Interpreter fixes, enhancements, features (#280)
* Thread stepping rework; interp.redraw equivalent

* Add turbo mode and pause mode

* Yielding behavior to match Scratch 2.0

* Implement warp-mode procedure threads

* Add check for recursive call

* Inline wait block timer

* Revert to setInterval and always drawing

* Restore yielding in glide

* 30TPS compatibility mode

* 5-call count recursion limit

* Removing dead primitive code

* To simplify, access runtime.threads inline in `stepThreads`.

* Warp mode/timer fixes; recursive check fixes; clean-up

* Add basic single-stepping

* Add single-stepping speed slider

* Allow yielding threads to run in single-stepping

* Restore inactive threads tracking for block glows

* Add clock pausing during pause mode

* Documentation and clean-up throughout

* Don't look for block glows in `thread.topBlock`.

* Add null check for block glows; rename `_updateScriptGlows` to reflect block glowing

* Use the current executed block for glow, instead of stack

* Add more comments to `stepToProcedure`, and re-arrange to match 2.0

* Tweak to Blocks.prototype.getTopLevelScript

* Revert previous

* Fix threads array to be resilient to changes during `stepThreads`

* Restore inactive threads filtering

* Fix typo in "procedure"

* !! instead of == true
2016-10-17 23:23:16 -04:00
Tim Mickel
060d1ab2a5 Updated blocks for new renderer features (#257)
* Add "touching" block, layers blocks

* Keep in fence, if on edge bounce, fix to touching edge

* Fix degtoRad in "if on edge, bounce"

* Fixes from review
2016-10-17 23:17:55 -04:00
Tim Mickel
352c6516d3 Fix parent setting in sb2 importer (#283) 2016-10-17 16:44:33 -04:00
Cosmic Web Services
454eb904a3 Add days since 2000 block (#272)
* Add days since 2000 block

* Empty line addition

* Add semicolin

* Empty line addition

* Tabed

* Remove extra line

* Make it exactly like scratch 2 was

* Fixed spacing
2016-10-17 13:57:25 -04:00
Ray Schamp
2904152318 Merge pull request #282 from rschamp/feature/vm.clear
Add VM.clear method
2016-10-17 13:56:37 -04:00
Ray Schamp
5615583fb2 Lint 2016-10-17 13:54:27 -04:00
Ray Schamp
bd95c1461d Add VM.clear method
Use it before loading projects so targets don't accumulate when multiple projects are loaded on the same instance.

Move check to see if the clone is the original clone onto the block implementation so all clones can be removed.

Fixes #274
2016-10-17 13:43:38 -04:00
Andrew Sliwinski
ace9a96fc2 Fix degToRad function definition. Resolves GH-229 2016-10-17 11:52:02 -04:00
Tim Mickel
3bfd755e60 Complete implementation of stop block (#271)
* "Other scripts in stage" sb2

* Complete implementation of "stop" block
2016-10-13 23:00:46 -04:00
Tim Mickel
c45b420115 Fix check for existing hat threads (#269) 2016-10-13 22:14:19 -04:00
Tim Mickel
1e86d48a31 Clicking blocks in the toolbox (#267) 2016-10-13 17:15:49 -04:00
Tim Mickel
8c654bbe60 Procedure blocks (#264) 2016-10-13 13:11:26 -04:00
dekrain
91037a261e Fix relative localization for assets 2016-10-13 16:19:42 +02:00
dekrain
49d6bd3b67 Fix new project creation (#256)
* Fix new project creation

* Fix new project creation

* const -> var
2016-10-12 13:56:31 -04:00
Tim Mickel
a7522c7734 Fix data_listcontents block name (#254) 2016-10-11 17:12:19 -04:00
Liam
30535d8e6e Implement "distance to" block (#239)
* Implement "distance-to" block

* distance-to in stage should always be 10000
2016-10-04 21:26:59 -04:00
TheBrokenRail
9b07889b3f Fix Stage PNG (#241)
* Fix Stage PNG

* Add New Stage PNG

* Remove Old Stage PNG

* Delete backdrop1.png

* Rename New Stage PNG

* Delete stage.png

* Fix Stage Resolution
2016-10-04 20:38:11 -04:00
Liam
5871672551 Implement "go to" block (#238)
* Implement "go to" block

* Add a missing semicolon

My text editor doesn't automatically insert them and I'm not used to using
semicolons so much. :(

* Implement go-to-random

* Clean up the go-to-random code a bit

* Add rounding to _random_ picks
2016-10-04 18:19:52 -04:00
Liam
886bcbe3c1 Implement the point-towards block (#235)
* Implement the point-towards block

* Pointing towards a nonexistent sprite should do nothing, not throw an error
2016-10-04 15:20:53 -04:00
Tim Mickel
0a66c62f6a Mutations in block representation; an unfeatured procedure call (#212)
* Add scratch3_procedures and no-op for defnoreturn

* Add mutation adapter to parse mutations in CREATE/CHANGE events

* Add mutation-to-XML

* Update spec map for Blockly procedure names

* Placeholder for procedure special cases

* Basic stepping to procedures

* Remove extra case

* Validation for changeBlock
2016-10-03 17:43:24 -04:00
Tim Mickel
5728d648b1 Ensure clone.effects is defined on each instance (#225)
* Ensure clone.effects is defined on each instance

* Add regression test for GH-224
2016-10-03 10:16:43 -04:00
Tim Mickel
2226fda19e Implement rotation style (#223) 2016-09-28 17:09:04 -04:00
Tim Mickel
d10ba11c8f Round costume values (#221) 2016-09-28 16:43:12 -04:00
Tim Mickel
a585a08a93 Remove extra calls to updateAllDrawableProperties (#222) 2016-09-28 16:43:04 -04:00
Tim Mickel
2357d63243 Drop useRound option from Cast.toListIndex (#213)
* Drop `useRound` option from `Cast.toListIndex`

* Param fix
2016-09-26 12:01:21 -04:00
Tim Mickel
2d736f2b87 "Wait until" implementation (#210) 2016-09-22 17:00:38 -04:00
Tim Mickel
a118d50056 Variables and lists (#187)
* Import lists and variables from SB2

* Switch to Variable and List objects

* Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable

* Add (get, set, change) variable blocks.

* Copy variables and lists on clone instantiation

* Move variable options closer to blocks

* Add list primitives

* Move variable and lists storage to `Target` instead of `Clone`

* Move _computeIndex to a Cast function

* Rename `getList` -> `getListAsString`

* Renames renames

* Remove extra check in Cast.isNaN
2016-09-21 16:38:33 -04:00
Tim Mickel
a687184c3c Fix and improve playground threads display (#198) 2016-09-21 16:31:23 -04:00
Tim Mickel
aa5e8d2648 Clear graphic effects on green flag (#199) 2016-09-21 16:31:07 -04:00
Ray Schamp
4e547556a8 Use attachRenderer rather than the constructor
This makes the renderer optional as well as making the order of instantiation flexible.
2016-09-20 15:09:21 -04:00
Ray Schamp
fa10a2279a Only expose VirtualMachine to window for bundles 2016-09-20 10:29:47 -04:00
Ray Schamp
499ba5235c Scope renderer to instance
This allows usage without global scope to attach a renderer to the VM. It also provides the ability to have multiple VMs/renderers to be used at once.
2016-09-20 02:52:33 -04:00
Tim Mickel
c02ee88d02 Add some more info/links to sb2specmap (#197) 2016-09-19 15:24:46 -04:00
Tim Mickel
13f287e871 Fix up property imports from SB2 (#196)
* Update target's drawable properties after SB2 import

* Always use `hasOwnProperty` parsing SB2 JSON
2016-09-19 14:40:01 -04:00
Tim Mickel
9744bcbb70 Clones (#150)
* Provide property to Clone to distinguish "original" clones

* Provide method to clone a clone's properties

* Don't report clones in the UI target list

* Add target info to Thread

* Allow hats to skip clones (for green flag)

* Green flag skips clones

* Implement "create clone" and hat

* Pass the runtime to sprites and clones (for start hats)

* Clone disposal; trigger hats after drawable initializes.

* Separate stop threads for target; fix handling of stop button

* Remove extraneous `skipClones` property

* Add global clone limit

* Don't allow a non-clone to delete itself.

* Rename `cloneClone` -> `makeClone`

* Variable updates in runtime.js

* Synchronous drawable initialization (until we put it back to promises)
2016-09-15 19:37:12 -04:00
Tim Mickel
542899949e Update for RenderWebGLLocal -> RenderWebGL (#181)
* Update for RenderWebGLLocal -> RenderWebGL

* Move button under title
2016-09-15 19:02:03 -04:00
Tim Mickel
6b3f0d3d8a Playground update; update SB2 spec map for list, _ of _ blocks (#184)
* Playground update

* Update SB2 spec map for list, _ of _ blocks
2016-09-15 17:10:32 -04:00
Tim Mickel
8987330853 Cleanly handle deleting running scripts (#162)
* Cleanly handle deleting running scripts

* Turn off glow request on retire thread; add null check
2016-09-15 13:51:40 -04:00
Tim Mickel
1ebee14eb0 Update sb2specmap.js for droppable broadcast (#182) 2016-09-14 16:43:21 -04:00
Tim Mickel
dec5d054c8 Better handling of float values (fix #172) (#176)
* Better handling of float values (fix #172)

* Stricter equality in Cast.isInt
2016-09-13 17:53:17 -04:00
Tim Mickel
6b08b95b97 Escape field values for XML-unsafe characters (#177)
* Escape field values for XML-unsafe characters

* String equality check ===
2016-09-13 17:51:17 -04:00
Tim Mickel
08b40b4d1d Drop worker support (#175)
* Take out worker code

* Fix Blockly event listening (minus worker)

* Recompile Sept. 13
2016-09-13 17:49:45 -04:00
Tim Mickel
833c5ed313 When clicked hats (#156) 2016-09-12 17:16:10 -04:00
Tim Mickel
c357a62005 Key repeats, with OS delay (#168) 2016-09-12 13:52:44 -04:00
Tim Mickel
91cdec1547 Implement glide (#154) 2016-09-12 13:26:10 -04:00
Tim Mickel
bbea1af5a3 Better shadow evaluation (#160)
* Better shadow evaluation

* Audit and improve casting for all primitives

* Force repeat times to int

* Remove colorPicker shadow menu
2016-09-12 13:14:16 -04:00
Tim Mickel
ebbfe881db Augment Timer with documentation and self.performance.now (#163)
* Augment Timer with documentation and `self.performance.now`

* Add undefined check for `self`.
2016-09-12 13:09:01 -04:00
Tim Mickel
79346c0925 Fixes for #138 (#166)
* Markup/CSS adjustments

* Move assets to folder

* Strip extra font-family

* More robust handling of project-load fail state

* Move empty project creation to its own function

* Move green flag/stop back out of the tab

* Restore default id
2016-09-12 12:03:24 -04:00