0
votes

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.NaijaProgrammer

1 Answers

1
votes

Some thing like this should work.

    var newEvent = $.Event('keydown', {
        keyCode: event.keyCode
    });
    newEvent.keyCode = $.ui.keyCode.DOWN;
    $(this).trigger(newEvent);