leopard: Support most Scratch blocks

Built-in

✔ Motion

  • Move steps
  • Turn right
  • Turn left
  • Go to [menu]
    • Random position
    • Mouse
    • Sprite
  • Go to x y
  • Glide secs to [menu]
    • Random position
    • Mouse
    • Sprite
  • Glide secs to x y
  • Point in direction
  • Point towards
    • Mouse
    • Sprite
  • Change x by
  • Set x to
  • Change y by
  • Set y to
  • If on edge, bounce: #120
  • Set rotation style
  • x position
  • y position
  • direction

Looks

  • Say for secs
  • Say
  • Think for secs
  • Think
  • Switch costume to
  • Next costume
  • Switch backdrop to
    • Name
    • Next
    • Previous
    • Random
  • Switch backdrop and wait
  • Next backdrop
  • Change size by
  • Set size to
  • Change effect by
  • Set effect to
    • Color
    • Fisheye
    • Whirl
    • Pixelate
    • Mosaic
    • Brightness
    • Ghost
  • Clear graphic effects
  • show
  • hide
  • go to front/back layer
  • go forward/backward layers
  • costume number/name
  • backdrop number/name
  • size

✔ Sound

  • Play sound until done
  • Play sound
  • Stop all sounds
  • Change effect by
  • Set effect to
    • Pitch
    • Pan
  • Clear sound effects
  • Change volume by
  • Set volume to
  • volume

✔ Events

  • When green flag clicked
  • When key pressed
  • When this sprite clicked
  • When backdrop switches to: #121
  • When greater than: #122
  • When I receive
  • Broadcast
  • Broadcast and wait

Control

  • Wait secs
  • Repeat
  • Forever
  • If
  • If else
  • Wait until
  • Repeat until
  • Stop
    • All: #124
    • This script
    • Other scripts in this sprite: #124
  • When I start as a clone
  • Create clone of
  • Delete this clone

Sensing

  • Touching
    • Mouse
    • Edge: #125
    • Sprite
  • Touching color
  • Color is touching color
  • Distance to
    • Mouse
    • Sprite
  • Ask and wait
  • Answer
  • Key pressed
  • Mouse down
  • Mouse x
  • Mouse y
  • Set drag mode: #123
  • Loudness: #122
  • Timer: this.timer
  • Reset timer
  • [property] of [object]
  • Current
    • Year
    • Month
    • Date
    • Day of week
    • Hour
    • Minute
    • Second
  • Days since 2000
  • ~Username~ (N/A)

✔ Operators

  • Add
  • Subtract
  • Multiply
  • Divide
  • Pick random
  • Greater than
  • Less than
  • Equal to
  • And
  • Or
  • Not
  • Join
  • Letter of
  • Length of
  • Contains
  • Mod
  • Round
  • Math “of”
    • abs
    • floor
    • ceiling
    • sqrt
    • sin
    • cos
    • tan
    • asin
    • acos
    • atan
    • ln
    • log
    • e ^
    • 10 ^

✔ Variables

Variables

  • Get variable value
  • Set variable to
  • Change variable by
  • Show variable
  • Hide variable

Lists

  • Get list value
  • Add to list
  • Delete of list
  • Delete all of list
  • Insert at position of list
  • Replace item of list
  • Item of list
  • Item # of string in list
  • Length of list
  • List contains item
  • Show list
  • Hide list

✔ My Blocks

Custom blocks are a feature. There aren’t any predefined blocks to support, because… well. You know.

Extensions

Music

  • Overall support tracked in #135
  • Play drum for beats
  • Rest for beats
  • Play note for beats
  • Set instrument
  • Set tempo
  • Change tempo
  • Tempo

✔ Pen

  • Erase all
  • Stamp
  • Pen down
  • Pen up
  • Set pen color
  • Change pen [property]
  • Set pen [property]
  • Change pen size
  • Set pen size

Other Extensions…

Supporting hardware/api scratch extensions natively is out of the scope of Leopard.

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

  • If on edge, bounce: #59
  • Touching edge: #59
  • Loudness: #60
  • When backdrop switches to: #58
  • When greater than: #60

Cloud variables could be supported with this (extremely simple) Javascript library that seems to be very Scratch-inspired: https://kihtrak.com/cloud_variable/

Looking through the author’s other projects, it appears that he’s a lifelong Scratcher. 😃

The code for the client is quite minimalistic, and the server code isn’t much larger. We could either link to this project or copy / adapt it more wholesale – there is no license attached to the code, so we may want to inquire about it.

Sound blocks can all be marked complete now!

Do we implement proper speech bubbles

Yes. Especially because window.alert() completely pauses all JavaScript, which is completely different to the way the say et al. blocks work. What would the sayForNSecs block even do?

How do we handle blocks with sprite-selection dropdowns?

Import the sprite class! Magic strings are

  • bad
  • not good
  • confusing, because we’ve just learnt that a ‘string’ is just text - why does it suddenly refer to Cat? Cat != “Cat”!
  • very bad

(You could also provide a String.prototype.toSprite or something, like

import Cat from './cat.mjs'

createCloneOf("Cat".toSprite())
createCloneOf(Cat)

but ehhhh)

@micahlt That would be fantastic! 😃