Page 2 of 2

Re: Retro RPG/MUD

Posted: Fri Nov 06, 2009 7:18 pm
by hallsofvallhalla
ugh blaahaha this is a struggle.

this is a snippet of the movement code and tryinh to make collisions to work

Code: Select all

 function keyListener(e){
            if(!e){
                //for IE
                e = window.event;
            }
     //////////////////////////////////////////////////west(left)//////////////////////////////////      
		     if(e.keyCode==65 && playerLeft > 5){
                //keyCode 37 is left arrow
            ////////////////collison//////////////////
				for(i=treeamount;k>0;k=k-1)
			   {
				   if (eval(tree+k).style.left < player.style.left);
			    {collision = 1;}
				  }
				if (collision != 1){
				playerLeft -= 8;
                                player.style.left = playerLeft + 'px';
				}
				movewest();
								 
            }
i finally got the php array that holds all locations for x number of trees into JS but left and top have px in it. So no way of comparing the two. I need to think of an alternative. Not only that its going to massive coding adding each image height and width to the top and left then checking each type of image. My god so much coding :)

Re: Retro RPG/MUD

Posted: Fri Nov 06, 2009 7:32 pm
by hallsofvallhalla
ah good ole clip string...:) i am back in business

Re: Retro RPG/MUD

Posted: Fri Nov 06, 2009 8:26 pm
by SpiritWebb
Glad that helped you out!! I can seem to find things when people need them, but when I need it, I cant seem to find it...story of my life!!! lol

Re: Retro RPG/MUD

Posted: Fri Nov 06, 2009 8:54 pm
by hallsofvallhalla
yeah same here.