Hello community,
i have a little spaceship that shoots lasers. For that i used this code:
The lasers always spawn at the tip of my spaceship. I would like to have two lasers coming out of the front like this:
But if i use getX()-2 (for example) and turn the ship, the position is messed up.
So how do i fix that?
Thanks for the help :)
private int ProjectileTime; private static int ShootTime = 15;
public void shoot()
{
ProjectileTime++ ;
if(ProjectileTime >= ShootTime)
{
if(Greenfoot.isKeyDown("space"))
{
Laser laser = new Laser();
getWorld().addObject(laser, getX(), getY());
laser.setRotation(getRotation()-180);
LaserSound.play();
ProjectileTime = 0 ;
}
}
}
