Commit graph

139 commits

Author SHA1 Message Date
griffpatch
0dcaa46107 Fix lint issues
Had to update the test scripts to handle the alpha channel, also I note
that all the hex tests are using CSS notation, not scratch notation
(which is 0x not #)
2017-01-27 17:05:17 +00:00
griffpatch
b856041d9a Fix for Support ARGB for pen #393
Requires fix to scratch-render before this will work (see:
6f5acfee7b961d71237f1fd50bb3d5a5139c527e)
2017-01-27 13:45:16 +00:00
Christopher Willis-Ford
88cc50aa18 Code review: more docs, move constants, clone util
Changes include:
- Added missing JSDoc for items in `scratch3_pen.js` and `target.js`.
- Moved constants used by `Scratch3PenBlocks` into the class.
- Created a constant for minimum and maximum pen size.
- Added `util/clone.js` to host cloning functionality.
- Pen blocks now check for the renderer before trying to use it.
- The pen integration test covers all blocks, though `clear`, `stamp`,
  and `pen down` will skip some of their functionality when there is no
  renderer.
2017-01-20 11:26:18 -08:00
Christopher Willis-Ford
a6190da774 Lint fixes and related cleanup 2017-01-19 12:50:46 -08: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
fec9e5b91a add audio to playground 2017-01-06 11:49:25 -05:00
Eric Rosenbaum
9350baef3b add current volume block 2017-01-06 10:31:11 -05:00
Eric Rosenbaum
dbe2cef93c move promise into audio engine
changes to play note, play drum and rest blocks so their promises to wait are returned by the audio engine
2017-01-06 10:31:01 -05:00
Eric Rosenbaum
c0d57b4b6b separate out main audioengine from audioplayer for each clone 2017-01-04 18:37:55 -05:00
Eric Rosenbaum
5a1386f727 remove redundant type check 2017-01-04 14:42:00 -05:00
Eric Rosenbaum
3bf9238e0c treat numeric input to sound name as 1-indexed 2017-01-04 14:41:14 -05:00
Eric Rosenbaum
7a49a3ae43 lint 2017-01-03 23:41:49 -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
Tim Mickel
b99f089ae7 Fix #327, "switch costume to [next/previous]" (#330) 2016-11-09 11:22:17 -05:00
Eric Rosenbaum
1e5555e96d add volume and tempo blocks 2016-10-27 11:31:22 -04:00
Tim Mickel
28a0831e8d Fix 1-1 in daysSince2000 2016-10-26 10:26:03 -04:00
Liam
f75577bcbe Implement '(attribute) of' sensing block (#311)
* Implement '(attribute) of' sensing block

* Remove unused util parameter
2016-10-24 20:37:27 -04:00
Eric Rosenbaum
90867cd14e convert string to number for sound index 2016-10-24 17:00:51 -04:00
Ray Schamp
63cfa4229a Fix space-infix-ops
http://eslint.org/docs/rules/space-infix-ops
2016-10-24 11:19:07 -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
Eric Rosenbaum
0858a22ffb adding theremin block and set instrument 2016-10-19 15:44:30 -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
Eric Rosenbaum
6d9f889aa7 fixed sound loading 2016-10-17 17:16:55 -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
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
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
8c654bbe60 Procedure blocks (#264) 2016-10-13 13:11:26 -04:00
Eric Rosenbaum
31d680a229 lint 2016-10-13 11:54:00 -04:00
Eric Rosenbaum
7b179546ed new setup for use with scratch-gui 2016-10-12 13:17:51 -04:00
Tim Mickel
a7522c7734 Fix data_listcontents block name (#254) 2016-10-11 17:12:19 -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
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
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
Eric Rosenbaum
0db0783fe8 working on sound font player 2016-10-04 14:19:04 -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
e1df4b3aaf fixed dictionary of loaded sounds 2016-10-01 17:27:28 -04:00
Tim Mickel
2226fda19e Implement rotation style (#223) 2016-09-28 17:09:04 -04:00
Eric Rosenbaum
6988cfc0d3 starting to load sounds from project files 2016-09-28 16:42:25 -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
Eric Rosenbaum
39c8e76bdf adding sound blocks 2016-09-27 17:09:53 -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