Commit graph

480 commits

Author SHA1 Message Date
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