0

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.

MartinH23
  • 13
  • 3
  • Just get the value's which are used in the keypress and used it on click of each arrow. Or you can stimulate a keypress, on arrow click. – jQuerybeast Aug 29 '11 at 01:32
  • @jQuerybeast: Awesome idea!!! Thank you!!! What about if they hold down rather than continuous clicking? It'll still do it right? :) – MartinH23 Aug 29 '11 at 01:37
  • Use this: http://api.jquery.com/category/events/mouse-events/ . .mousedown(), .mouseover() etc. – jQuerybeast Aug 29 '11 at 01:55
  • Perfect! Thank you. Are you able to put that in an answer so I can accept your solution? :) – MartinH23 Aug 29 '11 at 02:00

1 Answers1

0

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.

});
jQuerybeast
  • 14,130
  • 38
  • 118
  • 196