Commit graph

478 commits

Author SHA1 Message Date
Eric Rosenbaum
aab1b834d6 On set color using picker, reset transparency to 0 2017-10-17 23:13:05 -04:00
Eric Rosenbaum
a32f7a6402 Default color setting matches default RGB values
For color (hue) in range 0-100, to get RGB (0, 0, 1), we need to use 100 * 2/3 = 66.66
2017-10-17 23:10:58 -04:00
Eric Rosenbaum
240c48ad0c Set or change color param with a single function 2017-10-17 19:31:51 -04:00
Eric Rosenbaum
086df4652e Remove references to pen shade 2017-10-17 12:23:38 -04:00
Eric Rosenbaum
264042b4cc Use the word “color” instead of “hue” 2017-10-17 12:22:53 -04:00
Eric Rosenbaum
4f8782cc84 Remove unused function 2017-10-17 11:27:46 -04:00
Eric Rosenbaum
3d6644609f Add new set/change color param blocks with menu
And remove set/change color and shade blocks. All 4 params are now scaled 0-100.
2017-10-17 11:25:22 -04:00
Eric Rosenbaum
22e70ce095 Remove unused arguments for “clear” block 2017-10-17 11:25:22 -04:00
Chris Willis-Ford
c4e79c9732 Merge pull request #713 from cwillisf/fix-extension-hats
Fix extension hats
2017-10-13 16:03:51 -07:00
Chris Willis-Ford
7051ccfd69 Merge pull request #687 from cwillisf/builtin-extensions
Builtin extensions
2017-10-13 09:48:56 -07:00
Christopher Willis-Ford
1a9e28bfc9 Small WeDo 2.0 fixups 2017-10-13 01:48:25 -07:00
Paul Kaplan
4599a71dd7 Try to pin the bubbles within the left/right bounds 2017-10-11 16:34:50 -04:00
Paul Kaplan
b00a619e2d Only flip bubble if it would fit the other way 2017-10-11 16:27:51 -04:00
Paul Kaplan
9af9eb1d92 Fix hide/show 2017-10-10 15:35:48 -04:00
Christopher Willis-Ford
ef3feca385 Fix typo in WeDo 2.0 blocks metadata 2017-10-06 10:56:38 -07:00
Paul Kaplan
14600d7893 Update looks implementation 2017-10-06 13:43:07 -04:00
Christopher Willis-Ford
7297341c51 Fixups from code review
- Remove WeDo 2 extension from the runtime's default block packages list
- The WeDo 2.0 extension now calls its own `connect` method on startup

I also renamed `EXTENSION_NAME` to `EXTENSION_ID` for consistency with
the rest of the extension system.
2017-10-06 09:55:19 -07:00
Paul Kaplan
43d061227c WIP 2017-10-05 17:03:30 -04:00
Paul Kaplan
43a17bdaa8 Add say/think functionality to looks blocks 2017-10-05 11:16:27 -04:00
Christopher Willis-Ford
e9aed49a05 Make loadExtensionURL handle built-in extensions
WeDo2 and Pen blocks have been converted to internal extensions, and can
now be loaded by giving `loadExtensionURL` the string 'pen' or 'wedo2'
instead of an actual URL.
2017-10-04 13:00:39 -07:00
Christopher Willis-Ford
6757fb6de9 Convert pen blocks into an "internal" extension 2017-10-04 12:54:30 -07:00
Eric Rosenbaum
58eaeaaf6a Add pen transparency, clamped 0-100 2017-09-05 18:00:34 -04:00
Eric Rosenbaum
2b89063827 Merge branch 'patch-1' of https://github.com/Kenny2github/scratch-vm into Kenny2github-patch-1 2017-09-05 11:38:27 -04:00
Ken
3185eb27e1 Rewrote transparency block
Wrapping of the value is now handled by a new function, _wrapTransparency;
_updatePenColor now handles the transparency value;
DEFAULT_PEN_STATE now includes a transparency value (100).
2017-09-01 14:11:09 +08:00
Ken
f61366643d Clamp transparency value (at least for set) 2017-08-31 09:24:41 +08:00
Ken
fc4f073526 Add glide (number) secs to [dropdown] block (#662)
* Add glide to dropdown block

* Use helper functions instead of copy-paste

* Wrong syntax for array 😒

* Aha

* Fix some Travis issues

* Aha!! This should work

* Wow, Travis is strict about spacing!

* Make requested changes

Rename function getTarget to getTargetXY
Rename parameter TO to targetName
2017-08-28 15:44:34 -04:00
Ray Schamp
f367f2d358 Merge pull request #670 from rschamp/eslint-config-scratch-4
Update eslint and eslint-config-scratch
2017-08-26 13:26:05 -04:00
Ray Schamp
32bc087bba Fix remaining lint issues 2017-08-26 13:24:10 -04:00
Ray Schamp
5113876588 Pass with --fix 2017-08-26 13:24:10 -04:00
Ken
8a77329c79 Fix lint issue and update maximums
Inferring from the issue, the maximum seems to be 100, not 255 (default for set is 50 and change is 10). Changed that.
A comment line was too long (thanks lint) so it has now been reworded.
2017-08-25 15:24:56 +08:00
Ken
e30e5809d1 Add new blocks
change pen transparency by (num)
set pen transparency to (num)
2017-08-25 15:07:38 +08:00
SillyInventor
525b601253 Switch from parseInt to Math.floor 2017-08-22 10:30:41 -04:00
Ken
884e24f782 *facepalm* 2017-08-11 02:23:43 +12:00
Ken
28e61dbf48 Cleaned up 2017-08-11 01:58:59 +12:00
Ken
328514ae63 This kinda doesn’t make sense, but ok 2017-08-11 01:46:26 +12:00
Ken
5af99566fa Wait includes is case sensitive
Made it convert to lowercase before comparing
2017-08-11 01:27:31 +12:00
Ken
3b601e8595 Add string contains string 2017-08-11 00:52:41 +12:00
Paul Kaplan
44298fd71b Use soundId instead of md5 for playing sounds 2017-07-25 12:20:32 -04:00
Paul Kaplan
2ddb6215fd Add tests and fixes for set instrument and play drum 2017-07-06 14:56:46 -04:00
Paul Kaplan
1b6baf8114 Make playSound use one indexing 2017-07-06 14:28:11 -04:00
Chris Willis-Ford
47fc38fd9a Merge pull request #619 from cwillisf/clone-custom-state
Clone custom state
2017-06-27 22:37:30 -07:00
Eric Rosenbaum
01f801a2a2 Remove all audio effects except pitch and pan 2017-06-19 14:56:29 -04:00
Christopher Willis-Ford
06d5994a32 Use targetWasCreated event to clone pen state
Remove explicit cloning of `_customState` in favor of smarter,
state-specific cloning.
2017-06-16 14:22:51 -07:00
DD Liu
fb986effe6 Merge pull request #593 from fsih/fixWaitCalledEveryFrame
Change wait to use a promise instead of being called every frame
2017-06-08 15:35:48 -04:00
Chris Willis-Ford
d41997b58b Merge pull request #556 from cwillisf/wedo2-blocks
Add WeDo 2.0 blocks
2017-06-07 09:57:36 -07:00
DD Liu
e237d24846 fix lint 2017-06-06 10:21:27 -04:00
DD Liu
ab0cef52eb Change wait to use a promise instead of being called every frame 2017-06-05 16:55:15 -04:00
Christopher Willis-Ford
cbfbc5d600 Convert motor duration: seconds -> milliseconds
The block takes seconds, whereas the device takes milliseconds. Turning
on a motor for 1 millisecond isn't very dramatic.
2017-05-24 16:40:55 -07:00
Christopher Willis-Ford
06fe701624 Implement WeDo 2.0 blocks 2017-05-24 16:40:55 -07:00
Christopher Willis-Ford
2625529ebe Create WeDo 2.0 device communication classes 2017-05-24 16:40:55 -07:00
Ray Schamp
548aa6dd70 Fix no-useless-call todo
The linter is correct that `devObject[func].call(devObject, args)` is unnecessary because it's equivalent to `devObject[func](args)`.

@tmickel probably either meant to allow passing an array of arguments to be applied, or to call the function with the provided argument. Since we probably want to be able to use multi-argument functions, use `apply` and fix the one place that uses `ioQuery` with an argument.
2017-05-15 21:11:38 -07:00
Ray Schamp
a4f095db5e Use ES6 style classes 2017-04-17 19:42:48 -04:00
Ray Schamp
e01c4ae108 Pass with --fix 2017-04-17 15:10:04 -04:00
Rasmus Haglund
b693d4f4ef Fix rounded get size reporting 2017-04-08 19:35:29 +02:00
Eric Rosenbaum
092084cc6b Merge pull request #513 from ericrosenbaum/feature/loudness
Add loudness block
2017-04-07 14:06:18 -04:00
Eric Rosenbaum
b74c03dbbd Loudness returns -1 if no audio engine exists
To match Scratch 2.0 behavior
2017-03-27 13:20:44 -04:00
Silly Inventor
77775cdadb Switch to using number directly, instead of toNumber for costume switch (#499) 2017-03-23 18:34:04 -04:00
Eric Rosenbaum
b4a94c266f Add loudness block 2017-03-20 17:01:44 -04:00
Eric Rosenbaum
106db6a024 Clamp range for each audio effect 2017-03-20 14:53:04 -04:00
Eric Rosenbaum
c9338f37ed Clamp tempo range
The function in AudioEngine for change tempo can now be removed
2017-03-17 18:13:33 -04:00
Eric Rosenbaum
f2ac365859 Clamp beat durations for play note, play drum and rest 2017-03-17 17:29:23 -04:00
Eric Rosenbaum
1ba7ad0218 Clamp range for “play note” input
Clamp to 36-96, which is C2-C7.

This is a temporary fix to prevent errors, until we have a new instrument player implementation, which may have a different range.
2017-03-17 17:23:53 -04:00
Chris Willis-Ford
a56db95aba Merge pull request #446 from magmaboat/hasownproperty
Perform hasOwnProperty validation
2017-02-22 13:55:54 -08:00
Eric Rosenbaum
99be466aa7 Merge pull request #444 from ericrosenbaum/bugfix/playnote-volume
Pass volume to audioengine playnote
2017-02-10 14:09:55 -05:00
Magmaboat
85eee4f18e Perform hasOwnProperty validation 2017-02-09 21:12:47 -05:00
Eric Rosenbaum
cd750b5dda pass volume to audioengine playnote 2017-02-09 14:52:15 -05:00
Chris Willis-Ford
cde9ebd6bf Merge pull request #442 from griffpatch/bug/PenColorOpacity
Bug pen opacity reset
2017-02-09 07:53:15 -08:00
griffpatch
2ba177aa0f Bug - Return pen opacity to opaque
When setting the pen color using pen blocks, the opacity should be reset
to fully opaque if no alpha is supplied.
2017-02-09 08:50:37 +00:00
griffpatch
9cb595312e Implement "Stop this script" function
Existing implementation incorrectly terminates the entire thread.
See: http://llk.github.io/scratch-vm/#144142535
2017-02-08 09:44:10 +00:00
Andrew Sliwinski
92ff57de7d Add basic test coverage for the sound blocks 2017-02-03 17:39:36 -05:00
Eric Rosenbaum
9741dc2e35 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-02 16:37:07 -05:00
Ray Schamp
727fcc7875 Lint for eslint-config-scratch@3 2017-02-01 16:27:55 -05:00
Eric Rosenbaum
0947775a31 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-01 10:18:01 -05:00
SillyInventor
1ac89f5aa4 Added new util function that sends tan function infinities correctly
Changed mathop to call new math util
Changed sin & cos to round correctly (to get 0)
Added testing for the new math util function
Added testing for the new mathop functions
2017-01-31 19:05:54 -05:00
Eric Rosenbaum
53127f6320 use customstate for sound volume, instrument, effects 2017-01-31 18:33:32 -05:00
Eric Rosenbaum
2d8491123e Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-01-30 11:28:52 -05:00
Eric Rosenbaum
dd30e07052 comments on getSoundIndex 2017-01-30 10:56:50 -05:00
Eric Rosenbaum
9d8819ddc7 audio engine handles rest block 2017-01-30 10:56:31 -05:00
Eric Rosenbaum
cb4209b27a target handles playnote via audio engine 2017-01-30 10:56:06 -05:00
Eric Rosenbaum
5966a46bbd target manages instrument setting 2017-01-30 10:54:24 -05:00
Eric Rosenbaum
4e4b0b86e1 target manages audio effect values 2017-01-30 10:53:12 -05:00
Eric Rosenbaum
4e57ab561d move playsound function to target 2017-01-30 10:45:15 -05:00
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
9cc1c316d6 wrapclamp drum and instrument to num available 2017-01-11 11:41:21 -05:00
Eric Rosenbaum
f2ad364b90 vm converts one-indexing of drums and instruments to zero-indexing 2017-01-11 11:23:39 -05:00
Eric Rosenbaum
71339874de fix name of DRUM arg 2017-01-11 11:22:58 -05:00
Eric Rosenbaum
76a475c31c cast args to numbers 2017-01-10 18:00:33 -05:00
Eric Rosenbaum
4d7ff97011 instrument number is zero-indexed inside audio engine 2017-01-09 15:48:31 -05:00
Eric Rosenbaum
ce8b069140 include volume reporter 2017-01-09 15:48:02 -05:00
Eric Rosenbaum
2d7cfd128a use a single global tempo owned by audioengine 2017-01-09 15:47:29 -05: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
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
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
Eric Rosenbaum
47c0f18e85 adding more sound blocks 2016-09-15 16:51:24 -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
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
Eric Rosenbaum
d9a703b4ad play sound and play note block 2016-09-13 17:52:54 -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
d93eeed05d More color utilities, touching color, color touching color (#155)
* Fill out color utilities

* Amend Color.decimalToHex name

* Add `Cast.toScaledRgbColor`

* Add touching color, color touching color blocks

* Fix scale of Cast.toRgbColor

* Fix format of colors to use renderer-style lists

* Update `Color.decimalToRgb`

* Lint self
2016-09-12 10:58:50 -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
7709a4095e first working audio engine using audioworker 2016-09-07 16:55:38 -04:00
Tim Mickel
3fcd70a802 KEY_OPTIONS -> KEY_OPTION 2016-09-07 15:57:53 -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
77d0376b15 Merge pull request #107 from tmickel/feature/hats
Hat blocks
2016-09-02 11:12:07 -04:00
liam4
1437a358e1
getDay is zero-based where Sunday = 0; Sunday should be 1 2016-09-02 10:20:54 -03:00
liam4
602cb47a1e
Remove unused util variable 2016-09-02 01:01:17 -03:00
liam4
f981e8747f
Implement 'current' block 2016-09-02 00:48:14 -03:00
Tim Mickel
bdc95cffc0 Rename trigger->activate/start 2016-08-29 10:26:26 -04:00
Tim Mickel
40c90bbcc7 Add isActiveThread and simplify broadcast-and-wait accordingly 2016-08-29 10:01:31 -04:00
Tim Mickel
4f81033762 Remove extra Thread require 2016-08-23 18:46:54 -04:00
Tim Mickel
4f2cccf279 Fix issue when broadcasting in a when-broadcast 2016-08-23 18:37:03 -04:00
Tim Mickel
fe2ba2a536 Implementation of timer > _, broadcast, broadcast and wait 2016-08-23 18:14:05 -04:00
Eric Rosenbaum
5e268d57d3 scale to midi note reporter 2016-08-17 16:45:01 -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
Eric Rosenbaum
d5e46535e8 playing with quantization 2016-08-16 16:32:35 -04:00
Tim Mickel
aebcfde492 Add VM "I/O devices", clock, mouse as demo 2016-08-15 21:37:36 -04:00
Tim Mickel
349cb14c5a Removing extra cast in join implementation 2016-08-11 19:00:11 -04:00
Tim Mickel
bfe007e29f Add casting utilities and apply them to operator blocks 2016-08-11 18:47:55 -04:00
Tim Mickel
07e965261d Implementation of remaining operators 2016-08-11 18:47:55 -04:00
Eric Rosenbaum
8c40e9c383 play sound, play drum and audio effects experiments 2016-08-11 16:47:01 -04:00
Tim Mickel
7780b25c46 Project wide rename substack -> branch 2016-08-10 11:43:49 -04:00
Eric Rosenbaum
951d7771f3 tonejs synth for play note blocks 2016-08-09 15:40:50 -04:00
Tim Mickel
a6ad34f002 Add primitive for math_angle, fixing point in direction 2016-08-08 16:44:48 -04:00
Tim Mickel
0b826c0dc9 Remove unused Promise in scratch3_operators 2016-08-08 15:44:55 -04:00
Tim Mickel
30dc285a37 Add implementations for math_positive_number and math_whole_number 2016-07-06 14:13:03 -04:00
Tim Mickel
460760bd06 Stub "say" and "think" blocks with console.log 2016-07-06 13:47:32 -04:00
Tim Mickel
ce941c6fd8 Add show/hide blocks using ghost effect as backend 2016-07-01 12:56:59 -04:00
Tim Mickel
6891a3a5dd Add direction reporter 2016-07-01 12:56:45 -04:00
Tim Mickel
bb68fcab25 Additional fix for repeat's executedInFrame 2016-07-01 11:41:52 -04:00
Tim Mickel
57217f0044 Rename executed in repeat, ifElse 2016-07-01 11:29:32 -04:00
Tim Mickel
e4f6c9e90c "Repeat until" implementation 2016-07-01 11:25:26 -04:00
Tim Mickel
39c71b559d Update repeat implementation to execute once per frame 2016-07-01 10:50:31 -04:00
Tim Mickel
de6ba08866 Add single-frame yield mode 2016-07-01 10:44:43 -04:00
Tim Mickel
5876681bc7 Version of random that truncates ints 2016-07-01 10:28:47 -04:00
Tim Mickel
1eaed6fff3 Implement graphic effects and size blocks 2016-06-30 18:59:47 -04:00
Tim Mickel
7db2981ddc Add additional motion block implementations 2016-06-30 18:59:47 -04:00
Tim Mickel
42f0f66acd Implement move steps, turn right, turn left, point in direction 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
ab6e0d3839 Remove YieldTimers, unused WeDo blocks 2016-06-30 18:56:31 -04:00
Tim Mickel
6daee9a70e Remove VM-locking yield mode per discussion 2016-06-30 18:56:23 -04:00
Tim Mickel
d72cc55c11 Example that uses promises instead of util.report 2016-06-30 18:56:23 -04:00
Tim Mickel
8f6a88c095 Ensure predicates always return booleans 2016-06-30 18:56:23 -04:00
Tim Mickel
d44b806b4f Add blocking yield mode 2016-06-30 18:56:23 -04:00
Tim Mickel
f802faa461 operator_not in primitive table 2016-06-30 18:56:23 -04:00
Tim Mickel
f210c12d4d Add more operators for testing 2016-06-30 18:56:23 -04:00
Tim Mickel
7ef3807b18 Example of a yielding reporter (returns random number after 1s) 2016-06-30 18:56:23 -04:00
Tim Mickel
652cc8a31c Fix references to window 2016-06-21 14:29:40 -04:00
Tim Mickel
a1be1d6566 Update playground and block implementations to match scratch-blocks 2016-06-14 18:08:41 -04:00
Tim Mickel
0bf9ab59a1 Add implementation for ifElse 2016-06-10 10:40:15 -04:00
Tim Mickel
ca68c55d57 Implement logic_equals, if blocks 2016-06-10 10:36:05 -04:00
Tim Mickel
2cd6bf93bb Fix argument for repeat block 2016-06-09 17:05:08 -04:00
Tim Mickel
27064ce163 Fix implementation of "wait" block 2016-06-09 15:06:11 -04:00
Tim Mickel
b0441e2ef5 Implement stub for number and add blocks 2016-06-09 14:29:07 -04:00
Tim Mickel
bcd058bdc4 Disable unimplemented broadcast block 2016-06-09 14:23:45 -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
c1e30cf2ee Add sequencer-level debug console logs 2016-06-07 21:05:32 -04:00
Tim Mickel
4d4682912d Resolve existing motor timeout (instead of reject) 2016-05-09 14:18:33 -04:00
Andrew Sliwinski
0de30986aa Switch WeDo2 led block to use color index rather than absolute RGB values. 2016-05-05 08:33:44 -04:00
Tim Mickel
85f8e99ca8 Add delay to RGB block 2016-05-03 17:23:59 -04:00
Tim Mickel
9363432456 Hacked implementation of broadcasts 2016-05-03 14:57:10 -04:00
Tim Mickel
beebae0d2e Implement stop block
Using a call to the runtime.
2016-05-03 14:39:33 -04:00
Tim Mickel
6b1eb6df51 Control blocks argValues 2016-05-03 14:26:43 -04:00
Tim Mickel
17d4485695 Fix WeDo args 2016-05-03 14:25:19 -04:00
Tim Mickel
5b834667eb Merge pull request #19 from tmickel/feature/repeats
Stacks management, stack frames, repeat, forever
2016-05-03 14:04:50 -04:00
Tim Mickel
47545e7109 Replacing control_repeat comment 2016-05-03 13:34:39 -04:00
Tim Mickel
379b2dec79 Stack management, stack frames, forever and repeat 2016-05-03 13:28:24 -04:00
Christopher Willis-Ford
63d4f559e3 Fix inconsistent color scale
The HSV-to-RGB function had been returning values in the range [0,1].
Now it uses [0,255] to be consistent with the other values returned by
_getColor.
2016-05-03 10:01:52 -07:00
Christopher Willis-Ford
6f949596d8 Use util.timeout instead of setTimeout 2016-05-03 09:53:37 -07:00
Christopher Willis-Ford
e8089cd2a5 Don't check for methods on window.native
It turns out that `window.native.someMethod` always evaluates as
`undefined` -- even if calling that method would succeed. This change
removes checks for such methods so that the WeDo2 blocks can work.
Note that the hat blocks are still unimplemented, and some assumptions
are made about the form that arguments and `util` will take.
2016-05-03 09:48:26 -07:00
Christopher Willis-Ford
66e4a55b74 Fix _motorOnFor not setting _motorTimeout 2016-05-03 09:44:13 -07:00
Christopher Willis-Ford
b9af4f7894 WIP implementation for WeDo2 blocks
Hat blocks are still TBD.
Motor blocks assume a `util` argument which has methods for `yield()`
and `done()`.
2016-05-03 09:44:13 -07:00
Tim Mickel
4de24cfc30 Implement thread status, YieldTimer, block glow, wait 2016-05-03 11:26:28 -04: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