I am extremely new to this whole game design thing.
I'm using Flash Actionscript 3. Basically i have 4 walls that form a square inside the square are two circles. 1 circle is red and thats player 1 and the other circle is green thats the NPC.
Player1 starts as "it" (its a tag game)
Comp has to run from Player 1
atm my movement is basically just
if W pressed
player1.x -= speed; (in flash Y is 0 on top of the screen and +x on the bottom)
I had a new idea what if i made a random point that isnt near the player for the npc to run too... so i tried to implement that but now its completely crashing flash when i run this script ... maybe u can see an error that i dont.
public function compRun(){tempSpr.x = Math.random()* 320;tempSpr.y = Math.random()* 320;if (player1.x >= tempSpr.x){while (player1.x – tempSpr.x <= 50){tempSpr.x = Math.random() * 320;}}else if (tempSpr.x >= player1.x){while (tempSpr.x – player1.x <= 50){tempSpr.x = Math.random() * 320;}}if (player1.y >= tempSpr.y){while (player1.y – tempSpr.y <= 50){tempSpr.y = Math.random() * 320;}}else if (tempSpr.y >= player1.y){while(tempSpr.y – player1.y <= 50){tempSpr.y = Math.random() * 320;}}if (tempSpr.x > comp.x && !comp.frozen){comp.x += speed ;}else if(tempSpr.x < comp.x && !comp.frozen){comp.x -= speed ;}if (tempSpr.y > comp.y && !comp.frozen){comp.y == speed;}else if(tempSpr.y < comp.y && !comp.frozen){comp.y -= speed;}}