Why does this not work!?!?

Ok I have a working code which is :
1
2
3
4
5
6
7
8
9
10
	//stage 1 (first box)
	 if (!isitem&&!p1&&!p3){
		 Drawitem(itemx,itemy,0,255,0 );}
	 if (facex-5 <= itemx+5 && facex+5 >= itemx-5 && facey-5 <= itemy+5 && facey+5 >= itemy-5) {
			isitem2=false,p1=true;}

	 //stage 2 (second box)
	 if(!isitem2){Drawitem(item2x,item2y,0,255,0 );
		if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
			isitem2=true,p2=false;}}


and my new code which doesn't work, the box is supposed to disappear after you go over top of it and a new box appears but instead it only works if you stay on top of it.

1
2
3
4
5
6
7
8
9
		 if (facex-5 <= itemx+5 && facex+5 >= itemx-5 && facey-5 <= itemy+5 && facey+5 >= itemy-5) {
				 stage1=true,stage2=true;}
		 if(!stage1){
			 Drawitem(itemx,itemy,0,255,0 );}

		 if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
				stage2=false,stage3=true;}
		 if (stage2==true){
			 Drawitem(item2x,item2y,0,255,0);}
Topic archived. No new replies allowed.