This site requires JavaScript, please enable it in your browser!
Greenfoot back
SeafodHalal
SeafodHalal wrote ...

2021/4/17

Actor not in world

SeafodHalal SeafodHalal

2021/4/17

#
So i was trying to follow this tutorial https://www.youtube.com/watch?v=BVC8_7pORJ0 and i'm trying to imply hitByProjectile method but suddenly the game crashes, here's the code on my Enemy1 Class
public class Enemy1 extends Enemy
{
    public Enemy1()
    {
     setRotation(90);
    }
    public void act() 
    {
        // Add your action code here.
     moveEnemy();
     removeEnemy();
     hitByProjectile();
    }    
    public void hitByProjectile()
    {
        Actor projectile = getOneIntersectingObject(Projectile.class);
        if(projectile != null)
        {         
         getWorld().removeObject(projectile);   
         getWorld().removeObject(this);
        }
    }
}
RcCookie RcCookie

2021/4/17

#
Please post the exception stack trace
danpost danpost

2021/4/17

#
In Projectile class, remove any collision with Enemy object code.
You need to login to post a reply.