Hello guys, I am very new to coding and i am very confused with what i have to do to fix the issue. Any solution?
this is the code for my bullet:
This code is for my Enemy:
public class Bullet extends Actor
{
/**
* Act - do whatever the Bullet wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Bullet(){
}
public void act()
{
move(10);
if (isAtEdge())
getWorld().removeObject(this);
killenemy();
}
public void killenemy(){
if(isTouching(Enemy.class)){
Actor Enemy = getOneIntersectingObject(Enemy.class);
getWorld().removeObject(this);
getWorld().removeObject(Enemy);
}
}
}public class Enemy extends Actor
{
/**
* Act - do whatever the Enemy wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
followPlayer();
}
public void followPlayer(){
if ( ! getObjectsInRange( 300, player.class ).isEmpty() )
{
Actor player = getObjectsInRange( 300, player.class ).get( 0 );
turnTowards( player.getX(), player.getY() );
move(3);
}
}
}
