Getting white screen, not working
Pwego (7)
Jan 1, 2013 at 10:01pm UTC
With knowledge from you guys about while and if statements i cleaned up my code to this.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
while (start < 2){
if (stage1 = true ){
Drawitem(itemx,itemy,0,255,0 );}
if (!stage2){
Drawitem(item2x,item2y,0,255,0 );}
if (!stage3){
Drawitem(item3x,item3y,0,0,255 );
if (facex<400){item3x=item3x+4,item3y=item3y-4;}}
if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
stage1=false ,stage2=false ;}
if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
stage2=true ,stage3=false ;}
if (facex-5 <= item3x+5 && facex+5 >= item3x-5 && facey-5 <= item3y+5 && facey+5 >= item3y-5) {
stage3=true ;}
}
but now it whitescreens instead of working. Help idk what i did wrong.
Disch (8615)
Jan 1, 2013 at 10:04pm UTC
line 2 is an assignment (=). You probably wanted comparison (==)
Pwego (7)
Jan 1, 2013 at 10:14pm UTC
I changed it to
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
if (stage1== true ){
Drawitem(itemx,itemy,0,255,0 );}
if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
stage1=false ,stage2=false ;}
if (stage2==false ){
Drawitem(item2x,item2y,0,255,0 );}
if (facex-5 <= item2x+5 && facex+5 >= item2x-5 && facey-5 <= item2y+5 && facey+5 >= item2y-5) {
stage2=true ,stage3=false ;}
if (stage3==false ){
Drawitem(item3x,item3y,0,0,255 );
if (facex<400){item3x=item3x+4,item3y=item3y-4;}}
if (facex-5 <= item3x+5 && facex+5 >= item3x-5 && facey-5 <= item3y+5 && facey+5 >= item3y-5) {
stage3=true ;}
but now it doesnt work properly with collision. Also if I add a while in there at all!!! it whitescreens
Disch (8615)
Jan 2, 2013 at 12:31am UTC
You are not changing 'start' anywhere in that loop. So once the loop starts, it will continually loop forever because 'start' will always be less than 2.
Last edited on Jan 2, 2013 at 12:31am UTC