Point&Click adventure game

Hello:

I'm looking for some example code for a

Point & Click Graphic adventure.

What I need are routines to move a characture

from it's current position to a new position

given from a mouse click while going around

obsticles or staying on a path.

I can only find info for tile maps and that is

not what I want.

Any help would be appreciated.


Comments

  • * Which platform are you using?



    * Which programming language are you using?



    * Which compiler are you using?

    - If windows, are you using some API?

    - Are you using some library?



    --- DOS ---



    In DOS the mouse interrupt is 33h which has a lot of functions. You have to initiate the mouse to be able to scan position and buttons. If you're using VESA for higher resolutions you'll probably need to set the mouse movement range (the area to which the mouse is restricted).



    --- Watcom C (11.0) Example of get mouse position and button state (32bit environment) ---

    /*

    --------

    i_mouse_init



    initiates the mouse using mouse interrupt 33h with function 00h. The AX register will resturn the "success" of the procedure, if AX is 0x0 (i.e. 0) the initialization failed, if AX is 0xffff (i.e. 65535) the initialization was a success.

    --------

    */

    bool i_mouse_init(void)

    {

    short success = 0;

    union REGS regs;



    regs.w.ax = 0x0;

    int86(0x33,&regs,&regs);



    success = regs.w.ax;



    return success;

    }



    /*

    --------

    mouse_position_abs



    get mouse absolute position, you can also get

    the mouse relative position which returns the increment movement of the mouse.

    --------

    */

    void mouse_position_abs(int *mouse_x,int *mouse_y)

    {

    union REGS regs;



    regs.x.eax = 0x03;

    int86(0x33,&regs,&regs);



    *mouse_x = regs.x.ecx;

    *mouse_y = regs.x.edx;

    }



    /*

    --------

    mouse_button



    gets the mouse-button's states



    the register bx (in this case ebx) is a byte and the first three bits holds the button states so we need to do three bitwise ANDs in order to get the bitvalues.

    --------

    */

    void mouse_button(int *b_left,int *b_middle,int *b_right)

    {

    union REGS regs;

    unsigned char button;



    regs.x.eax = 0x3;

    int86(0x33,&regs,&regs);



    button = regs.x.ebx;



    // this is not really needed if you reset the variables before calling this function

    *b_left = *b_middle = *b_right = 0;



    if ((button & 0x01))

    *b_left = 1;

    if ((button & 0x02))

    *b_right = 1;

    if ((button & 0x04))

    *b_middle = 1;

    }



    --- end of Watcom C Example ---

    --- end of DOS ---



    Hope this helps you out, don't hesitate to email me if you have any questions.



    --- pelle


  • Sorry I was not clear,

    I am programming in c on Amiga & IBM compatible.

    I was'nt having trouble with the mouse but

    finding a path around obsticles. The information

    that I can find are tile based and I need something suitible for a game like King's Quest,

    Quest for Glory or Secret to Monky Island.

    These Games have a background to interact with

    and have irregular shaped obsticles and paths.

    I can use pseodo code or code in any language

    except assembly, I know nothing of assembly.

    Thanks for your responce.

    Alan Fullarton




Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories