Thursday, June 17, 2010

Why Does The Host Of Tmz Have A Cup With A Straw

Clear the print queue in Windows

Updated 04/06/2010 : I uploaded the latest version, 0.02. In this version the snake dies if it hits herself. Remember that if you unzip the WGZ file like a zip, have available the source code javascript.
time ago I started to create this little game (using the Nokia Web Runtime Widgets, or Nokia WRT). Is the game "snake" of a lifetime, but managed with the accelerometer of the phone, as seen in this video (sorry for the poor quality):




 






Try it. Keys: W, A, S, D.

TiposBloque

To run on mobile simply install the *. WGZ on your machine as you would with a *. sis file. NOT compatible with terminals 3 edition DESCARGAR / DOWNLOAD

# viudeSnakeMainWrapper {overflow: hidden; margin: 0px; width: 270px; height: 435px; margin: auto;}. Block {height : 15px; width: 15px; background-color: black; float: left; margin: 0px! important;}. block.snake.head {background-color: # 0F0;}. block.snake.eatingHead {background-color: # FFF;}. block.snake.body {background-color: # 6F6, / * background-image: url (images / body_up.png );*/}. block.snake.tail {background-color: # BFB; }. block.food.level1 { background-color: green;}. block.food.level2 {background-color: yellow;}. block.food.level3 {background-color: red;}
var empty = {0, comidaAlim1: 1 , comidaAlim2: 2, comidaAlim3: 3, serpCabeza: 4, serpCabezaComiendo: 5, serpCuerpo: 6, serpCola: 7, wall: 8} / / "object" is the corresponding object by type (eg: if food type will have a food object, if snake, the snake will ...) function block (p, type, object) {this.div = div; this.tipo = type; this.objeto = object; this.pintar () ;} Bloque.prototype.set = function (type, object) {this.tipo = type; this.objeto = object; this.pintar ();} Bloque.prototype.pintar = Function () {this.div.className = 'block'; was className = ""; switch (this.tipo) {case TiposBloque.serpCabeza: className = "snakehead"; break; case TiposBloque.serpCabezaComiendo: className = " snake eatingHead "; break; case TiposBloque.serpCuerpo: className =" snake-body "; break; case TiposBloque.serpCola: className =" snake tail "; break; case TiposBloque.comidaAlim1: className =" Food level1 '; break; case TiposBloque . comidaAlim2: className = "Food Level2 '; break; case TiposBloque.comidaAlim3: className =" Food level3 "; break; case TiposBloque.pared: className =" wall "; break;} this.div.className + = className;} Bloque.prototype.contieneComida = Function () {return this.tipo TiposBloque.comidaAlim1 == this.velocidad.y if (keyboardData.keyCode == 65 vely = this.velocidad.y if (Math.abs (axisdata.x)> Math.abs (axisdata.y)) {velX = Math.abs (axisdata.x)> = ACCEL_MIN_INC? -axisdata.x/Math.abs (axisdata.x): velX; vely = velX! = 0? 0: vely;} else {vely = Math.abs (axisdata.y)> = ACCEL_MIN_INC? axisdata.y / Math.abs (axisdata.y): vely, vely velX =! = 0? 0: velX;} / / check that the snake just turned 90 º if (velX * this.velocidad.x == -1) {velX = 0; vely = axisdata.y! = 0? (Axisdata.y / Math.abs (axisdata.y)): 1;} else if (vely * this.velocidad.y == -1) {vely = 0; velX = axisdata.x! = 0? (-axisdata.x/Math.abs (Axisdata.x)): 1;} this.mover (velX, vely, screen);} Serpiente.incrementarPosicion = function (position, increase, limit) {position + = increment; return position> = limit? 0: (this.tamanyo
position) {var bloqueCola = this.bloques.shift (); bloqueCola.set (TiposBloque.vacio);} / / PRESENT PAINTING this.bloques COLA [0]. Set (TiposBloque.serpCola, this ) / / BODY PAINTING BLOCK AS ABOVE (AND NOT HEAD) if (this.bloques.length> 1) this.bloques [this.bloques.length - 2]. set (TiposBloque.serpCuerpo, this); / / PAINTING HEAD this.cabeza (). September ((hayComida? TiposBloque.serpCabezaComiendo: TiposBloque.serpCabeza), this);}} / * CONSTANTS * / var BPS = 7 / / Blocks by segundovar MULTIPLICADOR_VELOCIDAD = 1, / / \u200b\u200bUsed to increase velocidadvar NUM_COMIDAS_SIMULTANEAS = 3 / / Number of meals shown simultaneamentevar MIN_SEGUNDOS_CAMBIO_COMIDA = 5, / / \u200b\u200bMinimum of seconds that must pass to relocate the comidavar MAX_SEGUNDOS_CAMBIO_COMIDA = 15 / / Maximum number of seconds that must pass to relocate the comidavar ACCEL_MIN_INC = 15 / / Minimum angle to rotate / * END CONSTANTS * / / / Objects of juegovar screen; var snake var food; / / Control juegovar interval, / / \u200b\u200bRange to paint so pantallavar / / ServiceObject to sensoresvar axisdata = {x: 0, y: 0}, / / \u200b\u200bData acelerómetrovar keyboardData = {keyCode: null}, / / \u200b\u200bKeyboard data / / Data juegovar punctuation = 0; keypressCallback function (e) {/ / keyboard data keyboardData.keyCode = window.event? event.keyCode: e.keyCode;} function accelerometerSensorCallback (id1, id2, result) {/ / sensor data if (result.ReturnValue) {axisdata.x = result.ReturnValue.XAxisData; axisdata.y = result.ReturnValue.YAxisData ;}} function random (min, max) {return parseInt (min 10) + Math.round (Math.random () * (max - min));} setPortrait function () {if (widget.isrotationsupported) widget. setDisplayPortrait ();}// If we turn the phone, the screen is in "portrait" if (Window.widget) window.onresize = function () {setPortrait ();} / / Called from the onload event handler to initialize the widget.function init () {/ / (only if We Are in the WRT environment) if ( window.widget) {/ / set tab-navigation mode and show softkeys widget.setNavigationEnabled (false); menu.showSoftkeys () / / We use the view "portrait" setPortrait (), / / \u200b\u200binterface for sensor data so = device.getServiceObject (Service.Sensor "," ISensor ") / / Find accelerometer so.ISensor.FindSensorChannel var result = ({SearchCriterion:" AccelerometerAxis "}); if (result.ErrorCode == 0 & & result.ReturnValue. length == 1) {/ / result.ErrorMessage contains the error message / / Define callback for so.ISensor.RegisterForNotification sensor data ({ListeningType: "ChannelData" ChannelInfoMap: result.ReturnValue [0]}, accelerometerSensorCallback) }} else / / Logging keys to move the snake with the keyboard document.onkeydown = keypressCallback / / Create the screen display = new Display (document.getElementById ('viudeSnakeMainWrapper'), 18, 29); / / Creation of the snake snake = new Snake (6), / / \u200b\u200bArray of meals: lunch = new Array (NUM_COMIDAS_SIMULTANEAS) / / Start the game! comenzarJuego ();} comenzarJuego function () { / / Reset score punctuation = 0, / / \u200b\u200bDraw pantalla.dibujar display () / / Reset snake serpiente.nacer (); / / Perform an iteration each 1000/BPS millisecond interval = setInterval ('realizarIteracion ();', 1000 / (BPS * MULTIPLICADOR_VELOCIDAD));} realizarIteracion function () {/ / Move snake if (window.widget) serpiente.moveByAxisData (axisdata, screen); else serpiente.moveByKeyboardData (keyboardData, screen) / / If you need food, created for (var i = 0; i

0 comments:

Post a Comment