Hi, I’ve a tilemap game… I’ve writed an enemy class with a move method like this:
public void move()
{
switch((int)(4 * Math.random()))
{
case 0: setDx(getMaxSpeed());
setDy(0);
break;
case 1: setDx(0);
setDy(getMaxSpeed());
break;
case 2: setDx(-getMaxSpeed());
setDy(0);
break;
case 3: setDx(0);
setDy(-getMaxSpeed());
break;
default: setDx(getMaxSpeed());
setDy(0);
}
}
The enemy can run around randomly and at each intersection, they have to look all four ways.
I’ve to put this scannig on the collision detection method? and what kind of scanning?
I’m a little confused… I hope you can help me!