Pencil Code Reference > dblclick


dblclick respond to double clicking

dblclick is an event-handler function. When a user clicks on the screen with the mouse, a function is called and an action is performed.

dblclick is the same as click in every way except the way it's called. click runs every time the mouse is clicked, whereas dblclick responds only if the mouse is quickly clicked twice.


dblclick (e) -> 
    #line 1
  #line 2
  #line 3

Below is the same code found on the click page, but it uses dblclick instead.

speed Infinity
a = 0
dot lightblue, 10000
label a, { fontSize: 60, fontFamily: "Consolas" }
dblclick ->
  dot lightblue, 10000
  a += 1
  label a, { fontSize: 60, fontFamily: "Consolas" }