Alrighty, what I want this code to do is shoot the 'Bullet' OUT OF the character 'Felix' and go in the direction of the mouse all the way to the edge of the screen where it is removed through code in the 'Bullet' class. What is happening now is when I shoot the bullet it comes OUT OF the mouse and goes all the way to the right edge of the screen, so it's not coming out of Felix or going in the direction I want it to. Here is the code:
In advance, thank you!!!
public void shoot() { MouseInfo mouse = Greenfoot.getMouseInfo(); if(shootdelay >= mindelay) { int rot = getRotation()-10; int xOffset = (int)(40 *Math.cos(Math.toRadians(rot))); int yOffset = (int)(40 *Math.sin(Math.toRadians(rot))); Bullet b = new Bullet(getRotation()); getWorld().addObject(b, mouse.getX()+xOffset, mouse.getY()+yOffset); shootdelay = -20; } }