examples

drag-drop2.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
box = display.rect(860, 540, 50, 50)

box2 = display.rect(100, 100, 50, 50)

box2.point((e) => {
  if (e.updated) {
    box2.position = e.position
  }
  if (e.ended) {
    if (box2.collide(box)) {
      box2.height += box.height
      box.destroy()

      box = display.rect(random.pos(), 50, 50)
    }
  }
})