Contains flow control, messaging, looping, variables, and conditionals.
each frameframeelapsedsettoupdatetoloop overbroadcastmessage with datawhen I receive messagewith dataififelseifthenelselogAskand store answer asignore blockscommentalert
Sprites are images or shapes that can have momentum and heading direction applied to them for animation and games.
sprite withaccelerate byset velocity toget velocityget speedget X velocityget Y velocityget X positionget Y positionrotatebyrotatetodegreesmovemove todrawapply forcebounce at edgewrap at edgestop at edgeis collision
Play and manipulate existing sound files or synthesize new sounds.
Images are pictures loaded from the web. They can be positioned and resized.
image from urlblank image with widthheightimage widthimage heightsetwidthsetheightscalebyflip horizontalflip verticalflip bothsetsizedrawatdraw on
In addition to performing math on numbers you can also use many operations on arrays and vectors too.
as number+−×÷=≠<≤>≥modulusroundabsolute valuesign offloorceilingto the power of
square root ofcube root ofroot ofto degreelogarithm ofto basemaxminsinecosinetangentarcsinearcosinearctangentpietaudegrees to radiansradians to degrees
There are many types of randomness in Waterbear.
random floatrandom int fromtonoise from xyzrandom item from
Waterbear vectors are x,y coordinates that can be used as points, but also have a direction and magnitude (useful for speed, acceleration, distance).
vector at xyvector at anglemagnituderotatetodegreesrotatebydegreesdegreesmagnitudexy×+normalizerandom unit vectorfrom arrayrandom pointunit vector <1,1>zero vector <0,0>as array
Objects are general-purpose containers where you can associate names (keys) with objects (values) like in a dictionary.
with value fromvalue ofkeys from
Strings are simple bits of text. You can search them, combine them, and break them up.
get characterfromget characterfrom end ofsubstring ofstarting atof lengthsubstring offromtois substring ofposition ofininreplacewithtrim whitespace ofconvert to uppercase
convert to lowercase
matchesdoesn't matchstarts withends withfontalign text to thetext baselinefill textxyfill textxymax widthstroke textxystroke textxymax widthwidth of text
Shapes are pictures made by drawing a geometric shape rather than loading an image file.
draw the shapeline widthline cap styleline join stylecircle atradiusellipse athorizontal radiusverticle radiusrotationrectangle atwidthheighttriangle with points abcpolygon with pointsregular polygon atsidescorner radiusstar atpointsinner radiusouter radiusline fromtoarc with radiuscentered at pointstart angleend anglebezier curve fromtofirst control pointsecond control pointquadratic curve fromtocontrol pointclip withpathtype
bezier point at positionstart pointend pointfirst control pointsecond control pointtangent to bezier curve at positionstart pointend pointfirst control pointsecond control point
It turns out to be frequently useful to be able to represent a rectangle.
xywidthheightpositionsizefrom arrayposition ofsize ofx ofy ofwidth ofheight of
Programs can get input from the mouse, touch, key presses, and more.
Pointer xPointer yPointer Down KeyPressed?whenkey pressedwhen pointer pressedwhen pointer releasedwhen pointer moves
Where in the world is your progam running?
my current location
when my location changesmy current locationlatitude oflongitude ofaltitude (m) ofdirection from north ofspeed (m/s) of
A size captures both width and height in one convenient package.
size from widthwidth unitsheightheight unitssize from arraywidth unitsheight unitswidth from sizewidth unitsheight from sizeheight unitssize as array