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.

Syntax

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
ht()
a = 0
dot lightblue, 10000
label a, { fontSize: 60, fontFamily: "Consolas" }
dblclick ->
  cs()
  dot lightblue, 10000
  a += 1
  label a, { fontSize: 60, fontFamily: "Consolas" }