JS4Scratch Reference

JS4Scratch

JS4Scratch is our JavaScript based coding language that is used in our Coding Editor to create Scratch (based on MIT Scratch3) games and animations.

JS Console

The JS Console is a component of Coding Editor.

Errors that occur when the code is run are shown in the JS Console along with the line number as shown below.

The JS Console can also be used for debugging e.g. shown below are console logs each time the ball hits and misses. The syntax for console log is:

console.log('Your Text')
// to log variable values
console.log(myVariable)

Reserved

JS4Scratch Reserved

The following are “JS4Scratch Reserved” words and cannot be used as variables, labels or function names.

BackdropdistanceTosetPenColorbroadcastMessageWait
addClassglidesetPenSizecss
addTogoTosetRotationStyledelete
cssgoTowardssetSizehasClass
hasClasshasClasssetXinvoke
removeClasshidesetYisKeyPressed
removeFrominnershownextBackdrop
CostumeinsertstopSoundsplaySound
addClassinvokeswitchCostumeToplaySoundLoop
addToisTouchingswitchCostumeToNumplaySoundUntilDone
cssisTouchingBackdropColorthinkreresh
hasClassisTouchingEdgethinkWaitremoveBackdrop
innermovetouchingremoveBackdropNum
insertnextCostumetouchingBackdropColorremoveClass
removeClasspenCleartouchingEdgeremoveSprite
removeFrompenDownturnLeftsendSpriteBackwards
resizeToImagepenUpturnRightsendSpriteForward
SpriteplaySoundwaitsendSpriteToBack
addClassplaySoundLoopwhenClickedsendSpriteToront
addCostumeplaySoundUntilDonewhenClonedstopSounds
addTopointInDirectionwhenEventswitchBackdropTo
askpointTowardswhenlagswitchBackdropToNum
broadcastMessagerereshwhenKeyPressedwait
broadcastMessageremoveClasswhenLoadedwhenClicked
changePenSizeremoveCostumewhenReceiveMessagewhenEvent
changeSizeremoveCostumeNumStagewhenlag
changeXremoveFromaddBackdropwhenKeyPressed
changeYresizeToImageaddClasswhenLoaded
clonesayaddSpritewhenReceiveMessage
csssayWaitbroadcastMessagezoom

JavaScript Reserved

Additionally, the following are “JavaScript Reserved” words and also cannot be used as variables, labels or function names.

asyncwindowglobal
abstractargumentsawaitboolean
breakbytecasecatch
charclassconstcontinue
debuggerdefaultdeletedo
doubleelseenumeval
exportextendsfalsefinal
finallyfloatforfunction
gotoifimplementsimport
ininstanceofintinterface
letlongnativenew
nullpackageprivateprotected
publicreturnshortstatic
superswitchsynchronizedthis
throwthrowstransienttrue
trytypeofvarvoid
volatilewhilewithyield

Sprites

Create & Import Sprites

Use the Sprite Editor in our ScratchLink Block Coder to create new non-standard Sprites or modify standard inbuilt Sprites. The Sprite and it’s costumes can be exported using the “right mouse click” while hovering over the Sprite in the bottom right. This will export the Sprite as a file “SpriteName.sprite3” into your Downloads folder.

To import go to our WebApp and into your JS4Scratch Project then click on your “Sprites” Tab or use the “+” to add one then go “add sprite” then click “Import Sprite” then click the green button “Import Scratch Sprite (.sprite3) and then give it a name and save.

Extra Sprites

https://scratch.mit.edu/studios/27247

https://freesvg.org/search/

https://www.animatedimages.org/

Supported GamePads

JS4Scratch supports 4 GamePads which can be purchased in our store or use your own Xbox wired or T3 BLE GamePad. We also manufacture two GamePads that utilise the Wii Nunchuk and Wii Classic Controller. You can either use a single GamePad or two of the same type at once. They are automatically detected when connected to our system.

USB wired GamePad (xBox).  Based on the acclaimed design of the Xbox Controller. Suitable for Windows PC USB port.  Our coding systems have been designed to work with this gamepad and supports two identical gamepads simultaneously for 2 player action.  Both the USB wired and T3(BLE) wireless GamePads have the same inputs i.e. 2 x Thumbsticks, D-pad, 6 x top buttons and 4 x front triggers.

T3 Wireless (BLE) GamePad.  Based on the acclaimed design of the Xbox Controller. Suitable for Windows, MAC, Android and IOS.  Our coding systems have been designed to work with this gamepad and supports two identical gamepads simultaneously for 2 player action. Both the USB wired and T3(BLE) wireless GamePads have the same inputs i.e. 2 x Thumbsticks, D-pad, 6 x top buttons and 4 x front triggers.

The ScratchLink NunChuck GamePad is a PC USB wired GamePad. It is two gamepads in one comprising our own design central module with connected Wii NunChuk controller.   So two player action using this single GamePad.  Our coding systems have been designed to work with this gamepad and supports two identical gamepads simultaneously.

Central Gamepad Module: 1 x Thumbstick with button & 4 x buttons

Nunchuck: 1 x Thumbstick + 2 x front triggers + X and Y Gyro

The ScratchLink Classic Controller GamePad is a PC USB wired GamePad. It is two gamepads in one comprising our own design central module with connected Wii Classic Controller.  So two player action using this single GamePad.  Our coding systems have been designed to work with this gamepad and supports two identical gamepads simultaneously.

Central Gamepad Module: 1 x Thumbstick with push button + 4 x buttons

Attached Classic Controller: 2 x Thumbsticks + 4 x front triggers + D-pad + 7 x top buttons.