0

I tried to put down a shape of Tetris with setInterval, and I had a function implemented that with keydown pressed, if it can, the shape will bi down 1 block, but I want do that every second... So, how can I trigger a keydown event in code to reuse my function?

Thanks and sorry for my english!

Arkaitz

1
  • Show us some bit of code of what you have tried that failed to work. Commented May 17, 2015 at 7:11

1 Answer 1

1

Some thing like this should work.

    var newEvent = $.Event('keydown', {
        keyCode: event.keyCode
    });
    newEvent.keyCode = $.ui.keyCode.DOWN;
    $(this).trigger(newEvent);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.