VeeLang

Follow that kite! ๐Ÿช

When you write kite.center, VeeLang reads where the kite is right now. If the kite flies off, whatever you put there stays behind.

Put @ in front, and it follows the kite instead:

Canvas paper having width 400, length 300, fill "lightskyblue"
draw circle kite at 300, 60 having radius 15, fill "tomato"
draw line string from 60, 280 to @kite.center
forever {
  move kite by -150, 30 in 2 seconds
  move kite by 150, -30 in 2 seconds
}
Open in the Playground

Wherever the kite goes, the end of the string goes too. @ means "follow".

Follow a colour ๐ŸŽจ

You can follow anything about a shape, not just where it is. This flower is always the same colour as the sun:

Canvas paper having width 400, length 250
draw circle sun at 80, 80 having radius 30, fill "gold"
draw circle flower at 300, 180 having radius 20, fill @sun.fill
forever {
  sun.fill = "orange" in 2 seconds
  sun.fill = "gold" in 2 seconds
}
Open in the Playground

Parts that follow ๐Ÿ‘€

Inside a shape's { }, a part can follow another part. The pupil stays in the eye, even when the eye moves:

Canvas paper having width 400, length 300
draw circle face at 200, 150 having radius 100, fill "peachpuff" {
  circle eye at -35, -25 having radius 15, fill "white"
  circle pupil at @eye.center having radius 6, fill "black"
}
forever {
  move face.eye by 40, 0 in 1 second
  move face.eye by -40, 0 in 1 second
}
Open in the Playground

Try it! ๐ŸŽฏ

  • ๐ŸŒŸ Give the kite a tail that follows it.
  • ๐ŸŒŸ Make a shadow under a bouncing ball: draw oval shadow at @ball.x, 280.

Learn more in Making Things Move. Have fun! โœจ

More news