griffpatch
ea59f8cd66
Reduce calls to getBlock
2017-02-11 14:26:23 +00:00
Magmaboat
85eee4f18e
Perform hasOwnProperty validation
2017-02-09 21:12:47 -05:00
griffpatch
276ae82769
Fixes Case Insensitive Broadcast Bug
...
Broadcasts are case sensitive #433
2017-02-08 10:05:48 +00:00
Ray Schamp
727fcc7875
Lint for eslint-config-scratch@3
2017-02-01 16:27:55 -05:00
Christopher Willis-Ford
369c02b5d5
Implement pen blocks
...
These blocks implement pen features as found in Scratch 2.0
Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
in the code, using a `Target`'s `setCustomState` and `getCustomState`
methods. This is used to store per-target pen state without requiring
`Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
for for black & white, and a `mixRgb` function to lerp between two
colors.
2017-01-19 11:51:22 -08:00
Eric Rosenbaum
dc9126e067
Merge pull request #373 from ericrosenbaum/sound
...
Integrate audio engine
2017-01-06 16:28:09 -05:00
Eric Rosenbaum
9980f4da3f
lint
2017-01-06 16:13:43 -05:00
Eric Rosenbaum
c0d57b4b6b
separate out main audioengine from audioplayer for each clone
2017-01-04 18:37:55 -05:00
Andrew Sliwinski
5daaaa4438
Merge pull request #362 from thisandagain/bugfix/coverage
...
Add integration test coverage
2017-01-03 09:38:14 -05:00
Andrew Sliwinski
4709cae4b7
Basic integration (end-to-end) testing for default project
2016-12-23 10:39:19 -05:00
Andrew Sliwinski
48721dd336
If not hat fields are not found, check inputs before continuing. Resolves GH-360
2016-12-23 09:38:18 -05:00
Eric Rosenbaum
f2793a1d59
Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
...
# Conflicts:
# package.json
# src/engine/runtime.js
# src/sprites/clone.js
2016-12-21 15:29:57 -05:00
Ray Schamp
e9da046969
Report full sprite info in targetsUpdate
...
We need more than just the name for the initial render, so send everything consistent with sprite info reports.
2016-12-07 17:11:08 -05:00
Ray Schamp
adaf2df743
Emit sprite info report for all sprites
...
This allows costume data to reach listeners even when the sprite isn't the editing target.
Filter out non-editing target reports in the playground to match previous behavior.
2016-11-30 13:21:00 -05:00
Ray Schamp
ce17fdbd30
Include costume data in sprite info reports
...
Also emit the report on all costume changes
2016-11-30 13:19:49 -05:00
Ray Schamp
d00cdd6b2c
Account for done threads on threadCount update
...
Also rename inactiveThreads -> doneThreads, since this describes them better. They are the threads that have completed in the step.
2016-11-28 10:49:05 -05:00
Ray Schamp
0003b294cb
Lint
2016-11-24 10:36:30 -05:00
Ray Schamp
55ac7e269c
Add PROJECT_RUN_START/STOP events
...
These events signal when any threads are running or when all threads have stopped running. This maps to whether the green flag or the stop button should be illuminated in the GUI.
2016-11-23 15:47:49 -05:00
Ray Schamp
2ff719f2ba
Fix consistency of existing emits
2016-11-23 15:43:05 -05:00
Tim Mickel
4deee071b2
Don't copy threads in step; stable restartThread ( #331 )
2016-11-10 15:05:49 -05:00
Eric Rosenbaum
6dadaba117
onStopAll function for stop button
2016-10-27 16:28:39 -04:00
Tim Mickel
56ef01745f
Implement sprite info emitting and posting ( #320 )
2016-10-26 13:27:12 -04:00
Tim Mickel
1dc4aaa2d7
Remove rAF usage and inline into _step ( #318 )
2016-10-26 11:32:15 -04:00
Ray Schamp
7712b2902f
Fix quote-props
2016-10-24 11:02:19 -04:00
Ray Schamp
f6c0064235
All linting other than console statements
2016-10-23 22:20:29 -04:00
Ray Schamp
68ed110b49
Pass with eslint --fix
...
Resolved whitespace issues, e.g., space-before-function-paren and key-spacing
2016-10-23 12:41:45 -04:00
Tim Mickel
3d57c2e74c
Drop single-stepping and pause modes ( #294 )
2016-10-20 11:42:16 -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
Eric Rosenbaum
7bd0142deb
Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound
...
# Conflicts:
# playground/index.html
2016-10-17 17:13:43 -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
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
Eric Rosenbaum
0024b209bd
Merge remote-tracking branch 'LLK/develop' into develop
2016-10-11 13:47:24 -04:00
Eric Rosenbaum
ed650ba487
Merge remote-tracking branch 'LLK/develop' into develop
2016-10-05 17:16:13 -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
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
Eric Rosenbaum
7c91565408
Merge branch 'develop' of https://github.com/LLK/scratch-vm into develop
2016-09-27 18:12:20 -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
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
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
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
Eric Rosenbaum
8872f663a4
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# playground/index.html
# playground/playground.js
# src/engine/execute.js
# src/engine/runtime.js
# src/index.js
# src/sprites/clone.js
2016-09-15 16:58:41 -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
Eric Rosenbaum
e19c1942c3
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# src/index.js
# src/sprites/clone.js
# src/worker.js
2016-09-13 18:09:43 -04:00
Tim Mickel
833c5ed313
When clicked hats ( #156 )
2016-09-12 17:16:10 -04:00
Tim Mickel
5df0acc895
Better glows ( #152 )
...
* Strip out old script glowing in thread management
* Add new tracking mechanism for glowing scripts
* Track parents and use them to determine script glows
* Use top-block for a thread if there's nothing on the stack
* Remove `console.log`
2016-09-08 09:40:53 -04:00
Tim Mickel
797f844de3
Stage, costumes, backdrops ( #149 )
...
* Add `Clone.prototype.getCostumeIndexByName`, keep in range
* Add basic costume primitives from Scratch 2.0
* Add costume getter block
* Add properties and methods for distinguishing stage and sprites-vs-clones
* Add backdrop-related looks blocks
* Fix up "switch to backdrop" to be working
* Costume/backdrop reporters are 1-indexed
* Fire "when backdrop switched" hats
* Cut cloning helpers for a separate PR
* Disable many blocks on the stage
* Refactor into _setCostumeOrBackdrop; implement switch backdrop and wait
* Fire hats even when backdrop unchanged
2016-09-08 09:40:27 -04:00
Eric Rosenbaum
6d21890338
Merge remote-tracking branch 'LLK/develop' into develop
2016-09-06 12:55:19 -04:00
dekrain
7caf8e588a
More hats ( #143 )
...
* Key pressed hat
* Tabs -> Spaces
* Oops
* Edge activate
* Fix hat
Phew...
* I forgot to change it also here
:/ :/ :\
* Minor fixes for TravisCi
* Minor docs
* Line length
2016-09-03 16:33:45 -04:00
Tim Mickel
e831866789
Keyboard events, "key is down" reporter ( #117 )
...
* Keyboard events, "key is down" reporter
* Update comment about inputs
* Simplify/generalize keyMap into a keys-pressed list
* Cast values passed to scratchKeyToKeyCode appropriately.
* Cut unspaced key values
* Fix lint from merge commit
2016-09-02 11:23:09 -04:00
Tim Mickel
86f136dd10
Merge pull request #115 from tmickel/feature/2.0-loader
...
Start of a 2.0 project loader
2016-09-02 11:16:35 -04:00
Tim Mickel
23d9999a9f
Add runtime.getTargetById
helper
2016-08-31 12:18:24 -04:00
Tim Mickel
08f48c5b30
Always start runtime with an empty target list.
2016-08-31 12:03:41 -04:00
Tim Mickel
bdc95cffc0
Rename trigger->activate/start
2016-08-29 10:26:26 -04:00
Tim Mickel
1098a06985
Various renames for hat opcodes/top blocks, allScriptsDo
2016-08-29 10:18:49 -04:00
Tim Mickel
3ccfdf3df0
Use hasOwnProperty
in getIsHat
/getIsEdgeTriggeredHat
2016-08-29 10:03:21 -04:00
Tim Mickel
40c90bbcc7
Add isActiveThread
and simplify broadcast-and-wait accordingly
2016-08-29 10:01:31 -04:00
Tim Mickel
64b82f4dc2
Switch back j->i
2016-08-29 09:52:34 -04:00
Tim Mickel
4f2cccf279
Fix issue when broadcasting in a when-broadcast
2016-08-23 18:37:03 -04:00
Tim Mickel
b4cf64009f
General-purpose hat implementation
2016-08-23 18:12:32 -04:00
Tim Mickel
94e389c8fb
Refactor script glowing into its own runtime function
2016-08-23 15:47:21 -04:00
Eric Rosenbaum
d121a4c6fa
Merge remote-tracking branch 'LLK/develop' into develop
...
# Conflicts:
# src/engine/runtime.js
2016-08-16 16:41:36 -04:00
Tim Mickel
aebcfde492
Add VM "I/O devices", clock, mouse as demo
2016-08-15 21:37:36 -04:00
Tim Mickel
4faaf1b685
Rename stacks
to scripts
...
Further pushing toward removing ambiguity of what "stack" means in the codebase.
2016-08-11 11:11:27 -04:00
Eric Rosenbaum
951d7771f3
tonejs synth for play note blocks
2016-08-09 15:40:50 -04:00
Tim Mickel
9c6dca8131
Add visual reporting of top-level reporter execution
2016-07-07 19:42:38 -04:00
Tim Mickel
0ae0ea5f22
Run threads for 60fps
2016-07-01 16:30:33 -04:00
Tim Mickel
660029010d
Feed in requestAnimationFrame events to VM
...
Not sure exactly how to use these yet, but it seems helpful to have them in there.
2016-07-01 11:52:43 -04:00
Tim Mickel
1eaed6fff3
Implement graphic effects and size blocks
2016-06-30 18:59:47 -04:00
Tim Mickel
19da0b0032
Add renderer demo using scratch-render-webgl
2016-06-30 18:59:47 -04:00
Tim Mickel
809528abdc
Straw-man implementation of targets/sprites/clones
2016-06-30 18:59:17 -04:00
Tim Mickel
ab6e0d3839
Remove YieldTimers, unused WeDo blocks
2016-06-30 18:56:31 -04:00
Tim Mickel
652cc8a31c
Fix references to window
2016-06-21 14:29:40 -04:00
Tim Mickel
506e9c32be
Don't attempt to glow a block that isn't known in the VM
2016-06-10 08:48:39 -04:00
Tim Mickel
526a260101
Simplify execution by removing nextBlock
...
Everything is managed by the stack, including what the execute() function does.
2016-06-09 17:08:30 -04:00
Tim Mickel
b0441e2ef5
Implement stub for number and add blocks
2016-06-09 14:29:07 -04:00
Tim Mickel
bd7f3245a2
Move scratch3 blocks into separate packages.
2016-06-09 11:45:58 -04:00
Tim Mickel
42d03db28b
Merge branch 'develop' into feature/eslint-jsdoc
...
# Conflicts:
# .eslintrc
# src/index.js
2016-06-08 17:23:41 -04:00
Tim Mickel
1f1a4941f3
Add .eslintrc rule to check JSDoc syntax
...
And fix the broken syntax rules
2016-06-08 16:57:08 -04:00
Tim Mickel
5767e05d56
Add block-by-block feedback to the VM playground
2016-06-07 20:59:34 -04:00
Tim Mickel
9be33089a8
Refactor block management into a separate module.
2016-06-06 15:29:34 -04:00
Tim Mickel
aa152fd604
Rewrite of moveBlock to better reflect Blockly
2016-06-06 14:55:01 -04:00
Tim Mickel
214daa8087
Always unset topLevel
in deleteStack_
...
Blocks may have topLevel set even if they are not present in this.stacks
2016-06-06 14:54:32 -04:00
Tim Mickel
18e4228399
Update runtime's handling of delete for new blocks structure
2016-06-06 14:53:59 -04:00
Tim Mickel
285c2792ef
Only add to stacks if topLevel is true in CREATE
2016-06-06 14:53:42 -04:00
Tim Mickel
0dfc72893c
Update Runtime createBlock for new structure; _addStack helper.
2016-06-06 14:12:43 -04:00
Tim Mickel
dd53b86b8c
Reduce amount of time for executing blocks
2016-05-05 13:09:37 -04:00
Tim Mickel
5c03167ec3
Hack helper for distance sensors
2016-05-03 17:39:02 -04:00
Tim Mickel
659c9b274a
Add motorStop patch to stopAll
2016-05-03 17:18:28 -04:00
Tim Mickel
833f40cfe5
Allow pushing threads that are not on this.stacks
...
For flyout running
2016-05-03 15:58:20 -04:00
Tim Mickel
90a5982ff9
Fix Runtime.stopAll
...
Removing threads as we were looping was causing not all of them to be hit.
2016-05-03 14:11:37 -04:00
Tim Mickel
4de24cfc30
Implement thread status, YieldTimer, block glow, wait
2016-05-03 11:26:28 -04:00
Tim Mickel
6bbeb2d0fe
Shuffle moveBlock to allow case where e.oldParent !== undefined
2016-05-02 22:31:00 -04:00
Christopher Willis-Ford
751ca97733
Fix eslint errors
...
This includes adding a line to `.eslintrc` to allow `console.log`,
`console.warn`, and `console.error`.
2016-05-02 11:56:52 -07:00
Christopher Willis-Ford
4a3276d026
Improve block primitive lookup and execution
...
Slightly simplify export of block primitives from a block package.
Catch and report exceptions from block functions.
2016-05-02 11:31:37 -07:00
Christopher Willis-Ford
27c06ce476
Add framework for block execution
...
The runtime now stores a mapping of opcode to function.
The `wedo2` and `scratch3` packages are currently stubs.
2016-05-02 11:31:25 -07:00
Tim Mickel
79f6725ff3
Add stack glow and infrastructure for block glow
2016-05-02 13:09:38 -04:00
Tim Mickel
b92a73da0f
Add green flag and stop button functions
2016-04-29 17:58:31 -04:00
Tim Mickel
b46ee0113f
Return if a thread is toggled off
2016-04-29 17:39:18 -04:00
Tim Mickel
7d9f75b14d
updating _removeThread to actually match docs
2016-04-29 17:36:09 -04:00
Tim Mickel
96123f870f
Fix _removeThread documentation and add toggleStack
2016-04-29 17:31:04 -04:00
Tim Mickel
2b2187014f
fix createBlock
2016-04-29 16:55:13 -04:00
Tim Mickel
11c6537f42
Add listener for new blocks that doesn't add to stacks
2016-04-29 16:49:08 -04:00
Tim Mickel
92dab97b84
Add thread management and stepping to runtime
2016-04-26 16:50:49 -04:00
Tim Mickel
dbfb3356c6
Move threads list to the Runtime
2016-04-26 15:51:14 -04:00
Tim Mickel
b6186a44f3
Add basics for the sequencer and threads
2016-04-26 15:00:45 -04:00
Tim Mickel
33340125e4
Adding JSDocs, threads, sequencer to runtime
2016-04-26 14:23:22 -04:00
Andrew Sliwinski
389d112729
All tests passing
2016-04-26 09:54:14 -04:00
Andrew Sliwinski
981b85e78f
AST create / change / move / delete from blockly
2016-04-26 09:49:52 -04:00
Andrew Sliwinski
53779220b7
WIP
2016-04-18 18:03:18 -04:00
Andrew Sliwinski
f9f47ed103
WIP
2016-04-18 17:20:30 -04:00