examples

input-aim-shoot.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
line = display.line(
  display.center.x, 630,
  display.center.x, 530
)

update(() => {
  line.pointTo(input)
})

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

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