# Aim and Shoot with Mouse CodeHS

Hello,

I’m trying to make a game in CodeHS Graphics where the user can shoot circles by aiming with the mouse. The circles should point and move in the direction the mouse is. But I’m stuck on this. Can someone please help? Thank you.

Here’s my code so far:

``````var arr = [];

var mis = [];

var eX;
var eY;

var ship = new Rectangle(40, 60);
ship.setPosition(getWidth()/2, getHeight() * 7/8);

function start(){
setTimer(game, 50);
mouseMoveMethod(move);
mouseClickMethod(shoot);
}

function move(e){
eX = e.getX();
eY = e.getY();
var angle = Math.atan2(eY - ship.getY(), eX - ship.getX() - ship.getWidth()/2);
angle = angle * (180/Math.PI);
if (angle < 0){
angle = 360 - (-angle);
}
ship.setRotation(90 + angle);
}

function shoot(e){
eX = e.getX();
eY = e.getY();
var m = new Circle(10);
m.setPosition(ship.getX(), ship.getY());
m.setColor(Color.blue);
//m.tarX = e
var angle = Math.atan2(eY - ship.getY(), eX - ship.getX());
angle = angle * (180/Math.PI);
if (angle < 0){
angle = 360 - (-angle);
}
m.setRotation(90 + angle);
println(90 + angle);