Commit graph

249 commits

Author SHA1 Message Date
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
TheBrokenRail
40b530fa7e Offline Support [READY TO MERGE?] [ALONG WITH THE SCRATCH-RENDER PR] (#138)
* Remove Fallback Project

* Added A Newline and Removed Fallback Project

* Made The SB2 Project Import Field Fit In  More With All Other Textboxes

* Better Description Of SB2 Import Field

* Oops!

* The XML Import Area Doses Not Need To Be Resizable!

* That Didn't Work As Planned

* Now it won't rezize

* Added SB3New

* Add Code For SB3New

* Better 404

* Indentation

* NodeJS complains about quotes

* Moved And Renamed SB3New

* Renamed Refrences

* Prefix With ./

* Typo

* Newline Fix

* Scratch Cat By Default!

* Single Quotes And Max Legth Fixed

* Better Comment Above loadProject

* Move newProject to index.js

* Added Dependincies to index.js

* Deleted newProject.js

* Removed Unneeeded Semicolon

* @param {?string}

* Added SVG For Scxratch Cat

* Now Uses Scratch Cat Offline (REQUIRES PULL REQUEST MADE TO SCRATCH-RENDER TO BE MERGED OR IT WILL NOT WORK)

* Added Stage PNG

* Added Stage Creation

* Fix Sizing Issues

* Import And Compatibility With Less Hacky Image Import (Scratch-Render)

* Import And Compatibility With Less Hacky Image Import (Scratch-Render)

* Fixed Line Length

* Added Navigation Bar

* Added CSS For Drop Down Menus

* Nicer Scale

* Nicer Dropdowns

* Remobved Dropdown CSS (It Didn't Work)

* Add Scratch Player Bar CSS

* Add Scratch Player Bar HTML
2016-09-12 11:05: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
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
Tim Mickel
14feb64005 Create a new input if one doesn't exist (#148)
* Create a new input if one doesn't exist

* Add regression tests for move-into-empty and obscuring shadows via move
2016-09-08 09:40:01 -04:00
Tim Mickel
f7e339f7c2 Remove uppercase from keyboard hat activators 2016-09-07 16:00:22 -04:00
Tim Mickel
3fcd70a802 KEY_OPTIONS -> KEY_OPTION 2016-09-07 15:57:53 -04:00
Tim Mickel
3dbfc3fdb6 Tweaks from SB2 importer audit (#137)
* Fix SB2 variable imports!

* Fix expectedArg field types

* motion_pointindirection uses math_angle

* Fix "think for secs" expected input

* Add handling for empty input case (empty if-else, for example)

* Fix opcodes for if_else, repeat_until, set tempo

* Specialized number fields for SB2 import

* Convert color picker numbers to hex in SB2 import

* KEY_OPTIONS -> KEY_OPTION

* Backdrop blocks get BACKDROP

* Update toolbox XML to match naming changes

* Merge in math_angle case

* Move color converter to its own utility

* Fix merge conflicts

* Add negative color check.

* Fix keyoptions naming

* Pen JSON tweak post-scratch-blocks update
2016-09-06 11:46:10 -04:00
Tim Mickel
9a8b68643a Shadow improvements (#135)
* Always add `next` to block representation

* Add `shadow` property to inputs, to maintain obscured shadows

* Create obscured shadows in SB2 import

* Add XML import of obscured shadows

* Alias SB2 shadow inputs to block inputs

* Add shadow to inputs on "delete inputs" test

* Add a small test to ensure obscured shadows are preserved

* Add more obscured shadow tests
2016-09-06 10:55:52 -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
77d0376b15 Merge pull request #107 from tmickel/feature/hats
Hat blocks
2016-09-02 11:12:07 -04:00
Tim Mickel
ae89cfbb6b Comment nit 2016-09-02 09:47:27 -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
c70e9759a9 Add initial SB2 importer and spec map 2016-08-31 13:56:05 -04:00
Tim Mickel
3e749fb9f1 Add loadProject, setEditingTarget, and UI emits 2016-08-31 12:28:09 -04:00
Tim Mickel
23d9999a9f Add runtime.getTargetById helper 2016-08-31 12:18:24 -04:00
Tim Mickel
d4a43639f3 Add editingTarget and map block events to that target 2016-08-31 12:08:54 -04:00
Tim Mickel
08f48c5b30 Always start runtime with an empty target list. 2016-08-31 12:03:41 -04:00
Tim Mickel
ba0cc0dcfc Pass along newCoordinate of Blockly MOVE events 2016-08-31 11:50:29 -04:00
Tim Mickel
ad82a5cb74 Add naming mechanism for targets/clones 2016-08-31 11:50:10 -04:00
Tim Mickel
2c6722b958 Add unique ID for Targets 2016-08-31 11:39:57 -04:00