Y
Yemibox
Guest
I'm trying to make a 2D golf game with a drag and shoot. I don't really know how to fully achieve this drag and shoot thing. One way I tried doing it is by
but the value I get back is 0. Does anyone know a way to solve this problem?
Code:
//Slingshot of ball
click = false;
//First instances of X and Y
mouseX = 0;
mouseY = 0;
//Second instances of X and Y
mouseX2 = 0;
mouseY2 = 0;
if(mouse_check_button(mb_left)) {
click = true;
mouseX = mouse_x;
mouseY = mouse_y;
//Testing Purposes
show_message("1. X = " + string(mouseX) + " Y = " + string(mouseY));
}
if(mouse_check_button_released(mb_left)) {
click = false;
mouseX2 = mouse_x;
mouseY2 = mouse_y;
//Testing Purposes
show_message("2. X = " + string(mouseX2) + " Y = " + string(mouseY2));
}
distance = point_distance(mouseX, mouseY, mouseX2, mouseY2);
if (keyboard_check_pressed(ord('S'))) {
show_message("The distance is " + string(distance));
}