Jump to content

User:Mal1t1a

From Wikipedia, the free encyclopedia

Mal1t1a (With the pronounciation as: /ˈmalˈliSHə/) is an online handle originating from the Xbox Live game Halo 2 released in 2004. [1]

var c = document.createElement("canvas");c.width = window.innerWidth;c.height = window.innerHeight;document.body.style.padding = 0;document.body.style.margin = 0;document.body.style.border = 0;document.body.appendChild(c);var ctx = c.getContext("2d");var objs = [];var gHwnd=0;function onKeyEvent(e){ for (var i=0;i<objs.length;i++){ var c = objs[i].c;if (c!=null) { if (c.upkey == e.which) c.up=e.type=="keydown";if (c.downkey == e.which) c.down=e.type=="keydown"; if (c.leftkey == e.which) c.left=e.type=="keydown";if (c.rightkey == e.which) c.right=e.type=="keydown"; }; }; }; document.body.addEventListener("keydown", onKeyEvent, true); document.body.addEventListener("keyup", onKeyEvent, true);var Controller = function(up,down,left,right){this.upkey=up;this.downkey=down;this.leftkey=left;this.rightkey=right;this.up=false;this.down=false;this.left=false;this.right=false;};var gObj = function(type,name,hp,x,y,w,h,vx,vy,ms,c) {this.type=type;this.name=name;this.hp=hp;this.x=x;this.y=y;this.w=w;this.h=h;this.vx=vx;this.vy=vy;this.ms=ms;this.c=c;this.update = updateObj;this.render = renderObj;};var updateObj = function(){ if (this.c!=null) { if (this.c.up) this.vy = this.ms; else if (this.c.down) this.vy = -this.ms; else this.vy = 0;if (this.c.left) this.vx = -this.ms; else if (this.c.right) this.vx = this.ms; else this.vx = 0; };if (this.x+this.w+this.vx>c.width) {this.x = c.width-this.w;if (this.c == null || !this.c.right) this.vx*=-1;} else if (this.x+this.vx<0) {this.x=0;if (this.c == null || !this.c.left) this.vx*=-1;} else this.x += this.vx;if (this.y+this.h+this.vy>c.height) {this.y = c.height-this.h;if (this.c == null || !this.c.down) this.vy*=-1;} else if (this.y+this.vy<0) {this.y=0;if (this.c == null || !this.c.up) this.vy*=-1;} else this.y += this.vy; };var renderObj = function(){ctx.fillStyle="#ffffff";ctx.fillRect(this.x,this.y,this.w,this.h);};var tick = function(){ for (var i=0;i<objs.length;i++){ objs[i].update(); };render();};var render = function() { ctx.fillStyle="#000000";;ctx.fillRect(0,0,c.width,c.height);for (var i=0;i<objs.length;i++){ objs[i].render(); }; };function initSetup(){gHwnd = setInterval(tick, 1000 / 60);objs.push(new gObj("PLAYER", "Mal1t1a", 3, 0, c.height-100, 50, 100, 0, 0, 5, new Controller(83, 87)));objs.push(new gObj("PLAYER", "CPU", 3, c.width-50, 0, 50, 100, 0, 0, 5, new Controller(40, 38)));objs.push(new gObj("PLAYER", "Mal1t1a", 3, 0, c.height - 50, 100, 50, 0, 0, 5, new Controller(null, null, 65, 68)));objs.push(new gObj("PLAYER", "CPU", 3, c.width-100, 0, 100, 50, 0, 0, 5, new Controller(null, null, 37, 39)));objs.push(new gObj("BALL", "CPU", 1, c.width/2, c.height/2, 50, 50, Math.floor( 1 + Math.random() * 5) * (Math.round(Math.random()) == 1 ? 1 : -1), Math.floor(1 + Math.random() * 5) * (Math.round(Math.random()) == 1 ? 1 : -1), 5));};initSetup();