examples

move-to-back.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Move to back

pl = display.circle(random.pos(), random.num(10, 25))
pl.tail = []

pl.update(() => {
  pl.pointTo(input)
  pl.move(2)
})


pl.collision((e) => {
  other = e.other
  other.moveToBack()
})

times(50, () => {
  circle=display.circle(random.pos(), random.num(10, 25))
  col = random.num(0, 360)
  circle.color=color.hsb(col, 25, 75)
  circle.borderColor=color.hsb(col, 35, 95)
  circle.borderWidth=2
})