examples

arrows-aim-shoot.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
25
26
27
28
29
30
31
32
33
back = display.circle(display.center.x, 650, 80)
back.color = color.hsb(0, 0, 40)
back.borderColor = back.color.darker(5)
back.borderWidth = 15

line = display.line(
  display.center.x, 650,
  display.center.x, 550
)
line.width = 20
line.color = back.color


input.left(() => {
  line.rotate(-4)
})

input.right(() => {
  line.rotate(4)
})

input.space((e) => {
  if (e.ended) {
    bu=display.rect(line.end, 10, 5)
    bu.angle = line.angle
  }
})

update(() => {
  display.each("rect", (elem) => {
    elem.move(10)
  })
})