/*** player + enemy collion ***/
public void PLAYER_ENEMY_COLLISION(Main m, Enemy e)
{
int enemyX = e.getX();
int enemyY = e.getY();

//test collsion between player and enemy
if(this.getBounds().intersects(e.getBounds()))
{
//set player x postion
x = enemyX - 13;
}
}/*** end of PlAYER_ENEMY_COLLISION METHOD ***/


so i fillay got this code to working. so if my player toch the enemy i go inside the if statment. and stop the player. only problem is that if player touch enemy from back than it will move player to left of enemey. but i want it to stop from right.