Poll:
You do not have permission to vote in this poll.
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Jacob, you just blew my mind.
#1
You JavaScripted Jeff into the forums.

I can't find words for this. I am going to waste so much time on this stupid little forum game XD
[Image: iwn8gk.gif]
Reply
#2
I don't know what this is. The forum looks perfectly normal.
Nevermind, I see it now.
http://2dworldsfansite.weebly.com
[SPOILER][Image: NDIBirc.gif][/SPOILER]
Reply
#3
It works on other websites too! Copy and paste this into the address bar (or bookmark it):

function init(){character=createEntityImage(CHARACTER_RIGHT);character.onclick=function(){createEntityImage("http://i.imgur.com/NLeAd.png")};root=document.body;sizeX=document.documentElement.clientWidth;sizeY=root.height;window.setTimeout(step,16)}function updatePosition(e){e.style.left=e.posx+"px";e.style.top=e.posy+"px"}function createEntityImage(e,t,n){var r=new Image;r.src=e;r.onload=function(){createEntity(r,true);var e=false;while(!e){var t=Math.random()*document.documentElement.clientWidth;var n=Math.random()*document.documentElement.clientHeight;var i=false;for(tx=t;tx<t+r.width;tx+=2){for(ty=n;ty<n+r.height;ty+=2){if(test(tx,ty)){i=true;break}}if(i)break}if(!i)e=true}r.posx=t;r.posy=n;updatePosition®;r.onload=undefined};return r}function createEntity(e,t){e.e=true;e.mass=1;e.vx=0;e.vy=0;e.stepX=4;e.stepY=4;e.posx=e.x;e.posy=e.y;e.style.zIndex=1e3;e.style.position="absolute";if(e.width==undefined){e.width=e.clientWidth;e.height=e.clientHeight}updatePosition(e);if(t)root.appendChild(e);entities.push(e)}function test(e,t){if(e<=0||t<=0||e>=sizeX||t>=sizeY)return true;else if(t>window.pageYOffset+document.documentElement.clientHeight)return true;else{var n=document.elementFromPoint(e,t-window.pageYOffset);if(n==undefined||n==character)return false;else{var r=false;switch(n.tagName){case"DIV":r=false;break;case"IFRAME":r=true;break;case"OBJECT":r=true;break;case"EMBED":r=true;break;case"IMG":r=true;break;case"A":r=true;break;case"INPUT":r=true;break;case"TEXTAREA":r=true;break;case"H1":r=true;break;case"H2":r=true;break;default:r=false}if®{return n}}}return false}function step(){startTime=new Date;for(var t=0;t<entities.length;t++){e=entities[t];if(xVelocity!=0&&e==character){e.vx=xVelocity}ovx=e.vx;ovy=e.vy;x2=e.posx+e.vx;y2=e.posy+e.vy;a=x2-e.posx;distance=Math.sqrt(e.vx*e.vx+e.vy*e.vy);nx=e.posx;ny=e.posy;xCollision=false;yCollision=false;collideEntity=null;for(var n=0;n<distance;n++){k=(n+1)/distance;if(e.vx>0)testOffsetX=e.width+1;else testOffsetX=-1;if(e.vy>0)testOffsetY=e.height+1;else testOffsetY=-1;if(e.vy!=0){for(tx=nx+1;tx<=nx+e.width-1;tx+=e.stepX){result=test(tx,ny+testOffsetY);if(result!=false){yCollision=true;if(result.e)collideEntity=result;break}}}yPoint=0;if(e.vx!=0){for(ty=ny+1;ty<=ny+e.height-1;ty+=e.stepY){result=test(nx+testOffsetX,ty);if(result!=false){xCollision=true;yPoint=ty;if(result.e)collideEntity=result;break}}}if(yCollision){e.isJumping=false;e.vy=0;if(e.vx==0)break}else ny=(y2-e.posy)*k+e.posy;if(xCollision){e.vx=0;if(e.vy==0)break}else nx=(x2-e.posx)*k+e.posx}e.posx=nx;e.posy=ny;if(collideEntity!=undefined){dvx=ovx-collideEntity.vx;dvy=ovy-collideEntity.vy;dm=e.mass+collideEntity.mass;kx=dvx/dm;ky=dvy/dm;v1x=ovx-kx*2*collideEntity.mass;v1y=ovy-ky*2*collideEntity.mass;v2x=collideEntity.vx+kx*2*e.mass;v2y=collideEntity.vy+ky*2*e.mass;if(xCollision){e.vx=v1x;collideEntity.vx=v2x}else if(yCollision){e.vy=v1y;collideEntity.vy=v2y}}updatePosition(e);if(!yCollision){e.vy+=1}if(xVelocity==0&&e.vy==0)e.vx*=.5;if(Math.abs(e.vx)<.1)e.vx=0}f++;diff=new Date-startTime;sleepTime=Math.max(0,16-diff);window.setTimeout(step,sleepTime)}var KEY_LEFT=37;var KEY_RIGHT=39;var KEY_UP=38;var CHARACTER_LEFT="data:image/gif;base64,R0lGODlhDAAvAMZSAAQKEgoOFAsPFRMVGBQWGBsbGysrKy0tLS8vLzAzODEzODI1OTQ2OTg5PTo6OkQ6Kjw8PD09PUZGRkdHR0pKSktLS2NRNnVfPXZhLXZgPnljLntlLn5mQYRqQ4ltLIVsQ4xvLYxwMIxwRo9yMJFzMZp4LpV3SZt5Lp57MqJ+Mp19TKN/M6WAM6eCM6yHRayIRbSKNLaLNbWQVruVUMWVNsaWN72WWciXN76XWcqYN8qZN8yaN8+cONGdOMadXM2iXtWoYt6rXNytZOGtXeu2YfC5Y/7Hcf/Icv/LdP/NdP/Odf/Odv/Sd//Td//UeP/Uef/Yev/Zev///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAH8ALAAAAAAMAC8AAAf+gAWCg4SFFgGCAgMDBAMCiiIqAgAmD0AdQkcfH0wfP1BMTUY+NkemTBxHGU2mraZJOEc4Sa6tRk1MUTK1pkoZHBdOvMPEw0vHS0a8SH8eJ8/QJyUgf38hN87RHhjVLDQxNeE1NyMs1Ss1MOI1Ohrmf+g86zQs3PA1KOvk7949Of85dpBYUe2aixkIEb54N+LGkFpBNFTbkOOhqyAjqmnQYbFVEIJ/vHU09bEbjZFHMFbDwBGixJAnIbY4V6PIk5s3idhruC4cvYk5etb4+YdnTx32Uggd+u5PAwpQoVY4UK0aAwlYsU4wUPXP1awStnb9mlVsVbJauZ4FG1ZttQUobM1WUxDX7R+6YOXerdsVb1m7ftP25Vs1cNuuCQhXcwChceMICKoFAgA7";var CHARACTER_RIGHT="data:image/gif;base64,R0lGODlhDAAvAMZSAAQKEgoOFAsPFRMVGBQWGBsbGysrKy0tLS8vLzAzODEzODI1OTQ2OTg5PTo6OkQ6Kjw8PD09PUZGRkdHR0pKSktLS2NRNnVfPXZhLXZgPnljLntlLn5mQYRqQ4ltLIVsQ4xvLYxwMIxwRo9yMJFzMZp4LpV3SZt5Lp57MqJ+Mp19TKN/M6WAM6eCM6yHRayIRbSKNLaLNbWQVruVUMWVNsaWN72WWciXN76XWcqYN8qZN8yaN8+cONGdOMadXM2iXtWoYt6rXNytZOGtXeu2YfC5Y/7Hcf/Icv/LdP/NdP/Odf/Odv/Sd//Td//UeP/Uef/Yev/Zev///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH+EUNyZWF0ZWQgd2l0aCBHSU1QACH5BAEKAH8ALAAAAAAMAC8AAAf+gAWCg4SCAwQDAwKCARaDQh1ADyYAAioiigI2PkZNTFA/H0wfH0empk0ZRxxMp65JOEc4Sa6nMlFMTUa1pk4XHBlKvMPEvEi8RkvKS38gJSfQ0Scef38YHtLTNyHVLCM3NeE1MTQs3Ro64jUwNSvVGCw06jzt3d/qKPV/KyQ7Of85epTr9mKGQYMutlXTEKTWkBsjqo1o6GpIjg3VVlA8NUSHhowbTQ0Z+GeiQ5IMHerAUK1FyCMjzVkj8qRmzSL64qkLB7GbvJ0X36Xb2fOPzp01UlT7c6AChadPGyz9Y2CChKtXGUytijXrVqtdtS7lGvZrVwliq5HFusBsVwUhbrHCHQtWbtyrc9XWxXtXQl6qe/32TTAVQQQIiBE7qBYIADs=";var character;xVelocity=0;var speed=6;var root,sizeX,sizeY;var entities=new Array;document.onkeydown=function(e){var t=event.keyCode;switch(t){case KEY_LEFT:xVelocity=-speed;character.src=CHARACTER_LEFT;return false;break;case KEY_RIGHT:xVelocity=speed;character.src=CHARACTER_RIGHT;return false;break;case KEY_UP:character.vy=-10;return false;break}};document.onkeyup=function(e){var t=event.keyCode;switch(t){case KEY_LEFT:xVelocity=0;break;case KEY_RIGHT:xVelocity=0;break;case KEY_UP:break}};document.onscroll=function(e){for(var t=0;t<entities.length;t++){e=entities[t];if(e.posy+e.height>document.documentElement.clientHeight+window.pageYOffset){e.posy=document.documentElement.clientHeight+window.pageYOffset-e.height;updatePosition(e)}}};f=0;init();

I'm planning on making a browser minigame that lets you blow up any website, and this seemed like the best way to test it! The physics code is all copied from my other game so I can copy the rocket explosions too.

Edit: put ja[va-s]crip[t: with no punctuation before everything, the forum won't let me post it...
Reply
#4
How man..
I have 2 years experience with java and i can't do this :c
Hi, I'm ShiftHappens. And yes, I am a brony. Don't judge me.

I know HTML and Java, So i'm learning lua just for this site!

[Image: attachment.php?attachmentid=29299&d=1326402936]
Reply
#5
Just telling you, it glitches sometimes... what I mean is when I scroll down it stays at one point and doesn't want to fall down.
:O now 3 block parts fell down and I'm able to move the jeff around with my arrow keys. Big Grin amazing.
Sorry for posting 3 times in a row but, are there suppose to be any platforms cause they are invisible for me? :/
[Image: 9xgr3l5t0zw.png] This is the map of how many countries Iran will take over.
Reply
#6
(12-22-2012, 06:06 AM)VenomSinister Wrote: Sorry for posting 3 times in a row but, are there suppose to be any platforms cause they are invisible for me? :/

I appears that all collidible objects are either links, images, text boxes, or ads.
Reply
#7
(12-22-2012, 05:02 AM)ShiftHappens Wrote: How man..
I have 2 years experience with java and i can't do this :c

This isn't Java. This is JavaScript. There is a big difference.
[Image: iwn8gk.gif]
Reply
#8
(12-22-2012, 01:54 PM)Ghosty Wrote:
(12-22-2012, 05:02 AM)ShiftHappens Wrote: How man..
I have 2 years experience with java and i can't do this :c

This isn't Java. This is JavaScript. There is a big difference.

Oh. I see now
Hi, I'm ShiftHappens. And yes, I am a brony. Don't judge me.

I know HTML and Java, So i'm learning lua just for this site!

[Image: attachment.php?attachmentid=29299&d=1326402936]
Reply
#9
That's pretty cool. Nice job.
Reply
#10
Qwerty, mine doesn't work on other websites. :/
[Image: 9xgr3l5t0zw.png] This is the map of how many countries Iran will take over.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)