# Circle Rotation With Touch

#### omrtha

##### Member
Hi, i am working on this game where i have a circle and i rotate the circle with finger touch. The problem i am having is that every time i begin to touch the screen, my circle jumps to that angle. I want that wherever i touch, the circle should rotate keeping its angle relative to the touch angle. Here is my code:

if mouse_check_button(mb_left){
image_angle = point_direction(x,y,mouse_x,mouse_y);
}

I am not sure if i could explain it but i am really frustrated and i couldn't find a solution in the last 3 days.

#### Nux

##### Member
You need to store the previous angle and rotate by the difference, e.g:
Code:
``````CREATE:
angle_previous = 0;

STEP:
var angle_target = point_direction(x,y,mouse_x,mouse_y);
if(mouse_check_button_pressed(mb_left)){
angle_previous = angle_target; // set starting angle
} else if(mouse_check_button(mb_left)){
image_angle -= angle_difference(angle_previous,angle_target);
angle_previous = angle_target; // update previous angle for next step
}``````

#### omrtha

##### Member
You need to store the previous angle and rotate by the difference, e.g:
Code:
``````CREATE:
angle_previous = 0;

STEP:
var angle_target = point_direction(x,y,mouse_x,mouse_y);
if(mouse_check_button_pressed(mb_left)){
angle_previous = angle_target; // set starting angle
} else if(mouse_check_button(mb_left)){
image_angle -= angle_difference(angle_previous,angle_target);
angle_previous = angle_target; // update previous angle for next step
}``````
Wow, that worked you are my hero mate thanks!!!