0

Hi,

I realise I might be asking quite a lot here but I have no idea what I need to do in order to get this to work correctly.

I have the following.
http://jsfiddle.net/Stealthbird97/6k8es/
Just press the "a" key on your keyboard to see what it does.

Now, I want the to only be able to run once a specific sequence on keys have been pressed beforehand [the konami code].

Does anyone know how I'd be able to integrate the code I have with
http://namuol.github.io/cheet.js/ or a similar keylogging script?

I have very little knowledge with scripting this seems completely incomprehendable to me. It's possible but I don't know how to go about doing it.

3
Contributors
3
Replies
17
Views
3 Years
Discussion Span
Last Post by Stealthbird97
0

So based on your description, you want to integrate this cheet.js into your code? You have to download the files and integrate the scripts by placing these into the <head> section of your page...of course referencing the correct path in your folder structure. Then follow the documentation provided on that site.

<script src="/bower_components/cheet.js/cheet.js" ></script>
<script src="/components/namuol-cheet.js/cheet.js" ></script>
0

Thanks for the replies..

At the time of writing the question I was quite tired but after revisiting the task today, I've mangaed to get it to work as I wanted it to.

It was simply creating a new funciton and then calling it

like so,

<script>
    cheet('↑ ↑ ↓ ↓ ← → ← → b a', function () {
  Appear()
});
    </script>
    <script>
    function Appear()
{
$(function () {
    var images = [
        'http://fileserve.stealthbird97.co.uk/renders/charl.png',
      'http://fileserve.stealthbird97.co.uk/renders/cecilia.png',
        'http://fileserve.stealthbird97.co.uk/renders/houki.png',
        'http://fileserve.stealthbird97.co.uk/renders/ling.png',
        'http://fileserve.stealthbird97.co.uk/renders/laura.png',
        'http://fileserve.stealthbird97.co.uk/renders/tatenashi.png',
        'http://fileserve.stealthbird97.co.uk/renders/tank1.png',
        'http://fileserve.stealthbird97.co.uk/renders/tank2.png',
        'http://fileserve.stealthbird97.co.uk/renders/misakared.png',
        'http://fileserve.stealthbird97.co.uk/renders/misakablue.png',
        'http://fileserve.stealthbird97.co.uk/renders/shiro.png',
        'http://fileserve.stealthbird97.co.uk/renders/kudo.png',
        'http://fileserve.stealthbird97.co.uk/renders/azusa.png',
        'http://fileserve.stealthbird97.co.uk/renders/minami.png',
        'http://fileserve.stealthbird97.co.uk/renders/himeji.png',
        'http://fileserve.stealthbird97.co.uk/renders/accelerator.png'];
    var index = 0;
    $(document).on('keypress', function (event) {
        var c = String.fromCharCode(event.charCode);
        if(c === 'a') {
            var image = images[index];
            console.log(image);
            var newindex = Math.floor((Math.random()*15)+1);
            if(newindex===index){
            do{
            newindex = Math.floor((Math.random()*15)+1);
            }while(newindex===index);
            }
            index = newindex;
            $('<img style="position: fixed; bottom: 0; right: -400" src="' + image + '"/>').appendTo(document.body).animate({right: '200%'}, 3500, function() {
                $(this).remove();
            });
        }
    })
});

};

    </script>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.