MartinH23
MartinH23

Reputation: 13

JQuery (using gamequery) to recognise click rather than keypress?

I'm using gamequery to create a game, however, the documentation has nothing about using a click instead of keypress.

http://gamequery.onaluf.org/documentation.php

I wanted to setup 4 images (left, right, up, and down arrows) and once clicked, it will move the sprite accordingly. If held down, it will continue to move the sprite.

The demo game I am trying to edit is: http://gamequery.onaluf.org/demos/3/

The sprite in that case is the spaceship.

Upvotes: 0

Views: 377

Answers (1)

jQuerybeast
jQuerybeast

Reputation: 14490

Just get the value's which are used in the keypress and use it on click of each arrow. Or you can stimulate a keypress, on mousedown/mouseover etc.

For Example:

$('.arrow-left').mousedown(function() {

    // Do the function which the keypress Left does.

});

Upvotes: 0

Related Questions