collision between player and ground
flag prints:
true
false
false
false
...
it should prints true, true, true, true, true, bc player is touching the ground rect from arraylist.
Code:
public void levelWCollision(Player p)
{
for(int i = 0; i < rect.size(); i++)
{
if(p.getBounds().intersects(this.rect.get(i))){
flag = true;
break;
}
else
flag = false;
}
}
System.out.println(flag);
if(flag )
System.out.println("hi");
else
System.out.println("bye");
}
true
false
false
false
...
it should prints true, true, true, true, true, bc player is touching the ground rect from arraylist.
Comment