
-----------------------------------
Confused Child
Wed Nov 26, 2008 12:11 pm

How to make it so that game exits when circles hit mouse
-----------------------------------
Hey guys I made a game that has circles bouncing around the screen and the point is to dodge them. However I want to make it so that when one circle hits the mouse (which has a small circle on it) the game exits and you lose. That is what I am having trouble on.

Please do help me because it is my ISU

Here's the code: 



var counter, circle_1, circle_2, circle_1_x, circle_1_y, circle_1_radius : int
var circle_2_x, circle_2_y, circle_2_radius : int
var distance_between_centres : real
var c_1x_inc, c_2x_inc, c_1y_inc, c_2y_inc, mouseball_radius : int
%give our two circles values. These can obviously be changed.
counter := 0
c_1x_inc := 15
c_2x_inc := 25
c_1y_inc := 15
c_2y_inc := 25
circle_1_x := 5
circle_1_y := 5
circle_1_radius := 55
circle_2_x := 210
circle_2_y := 190
circle_2_radius := 20

%main program
loop
    var x, y, button : int

    mousewhere (x, y, button)
    locate (1, 1)
    
    drawfilloval (x, y, 5, 5, 13)
    delay (10)
    drawfilloval (x, y, 5, 5, 31)



    %draw our circles. Remember, the x-radius and y-radius are the same!
    cls
    drawoval (circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 12)
    delay (20)
    drawoval (circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 9)

    %Move the first oval diagonally
    circle_1_x += c_1x_inc
    circle_1_y += c_1y_inc

    circle_2_x += c_2x_inc
    circle_2_y += c_2y_inc
    if circle_1_x >= maxx or circle_1_x = maxy or circle_1_y = maxx or circle_2_x = maxy or circle_2_y 