# How do I detect image clicks in Dark GDK?

I am trying to determine if an image has been clicked, using the Dark GDK game engine. I've found no methods in the engine that do this.

I would rather not brute force this with a large nested if/else structure. I was thinking of setting up a container that takes an object which records the mouse position when clicked, as well as a bool value to determine if the image has already been clicked.

I apologize for not adding any example code here; I don't know how I would go about setting something like that up.

The way I would do it is detect the mousex and mousey position when it is clicked and then use something like the following:

if (xmouse > something AND xmouse < something_else)
AND (ymouse > whatever AND ymouse < whatever_else)
THEN
pic_clicked = True


something, something_else, whatever and whatever_else would be the x and y top, bottom, left and right co-ordinates of the image.

This is just pseudo code and not GDK specific.

• Although a good answer, OP specifically said they'd rather not brute force all images with if .. else .. statements. Maybe you can edit your answer to do the same using an array or with a container like OP suggested? Sep 27 '18 at 11:05