Chase The Dot

Discussion in 'Pascal Logic Code Examples' started by watkins, Oct 29, 2005.

  1. watkins

    watkins

    Joined:
    Sep 18, 2004
    Messages:
    12
    Likes Received:
    0
    It's a bit crude but it might give someone some inspiration.

    See if you can hit the dot.

    P.S. Can't see any use for this, was just playing around.






    {Variable definitions}
    positionx : integer;
    positiony : integer;

    {Module Code}

    clearscreen;
    textpos(100,50);
    setpencolor(clblack);
    drawtext('Chase The Dot');

    {Set random position and draw dot}

    positionx := random(630);
    positiony := random(470);
    ellipse(positionx,positiony,positionx+10,positiony+10);
    delay(1);

    {Check Position Of Pointer}

    if (GetClickX >= positionx) and (getclickx <= (positionx+10)) and (GetClickY >= positiony) and (getclicky <= (positiony+10)) then

    begin;
    textpos(100,100);
    setpencolor(clblack);
    drawtext('You Did It. Click Anywhere To Start Again');
    Delay(1);
    waituntil(getclick);
    end;
     
    watkins, Oct 29, 2005
    #1
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.