A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

Teclado y mover Nave - Stikked
From Beefy Tortoise, 10 Years ago, written in JavaScript.
Embed
  1. var teclado = {};
  2.  
  3. function agregarEventosTeclado() {
  4.     agregarEvento(document, "keydown", function (e) {
  5.                     //ponemos en true la tecla presionada
  6.                    teclado[e.keyCode] = true;//evento que identifica la tecla que se ha pulsado
  7.                    });
  8.     agregarEvento(document, "keyup", function (e) {
  9.                     //ponemos en false la tecla que dejo de ser presionada
  10.                    teclado[e.keyCode] = false;
  11.                    });
  12. }
  13.  
  14. function moverNave() {
  15.     //movimiento a a la izquierda
  16.     if (teclado[37] ) {
  17.         nave.x -= 15;
  18.         if(nave.x <0) {
  19.             nave.x = 0;
  20.         }
  21.     }
  22.     //movimiento a a la derecha
  23.     if (teclado[39] ) {
  24.         var limitex = canvas.width - nave.width;
  25.         nave.x += 15;
  26.         if(nave.x > limitex) {
  27.             nave.x = limitex;
  28.         }
  29.     }
  30.     if (teclado[38] ) {
  31.         //movimiento a a la arriba
  32.         nave.y -= 15;
  33.         if(nave.y < 0) {
  34.             nave.y = 0;
  35.         }
  36.     }
  37.     if (teclado[40] ) {
  38.         //movimiento a a la abajo
  39.         var limitey = canvas.height - nave.height;
  40.         nave.y += 15;
  41.         if(nave.y > limitey) {
  42.             nave.y = limitey;
  43.         }
  44.     }
  45.     if (teclado[32] ) {
  46.         //disparos
  47.         if(!teclado.fire){
  48.             fire();
  49.             teclado.fire = true;
  50.         }
  51.     }