Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2070
Number of posts: 5361

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
Point&Click adventure game Posted by Alan Fullarton on 23 Jul 2000 at 7:24 PM
Hello:<br>
I'm looking for some example code for a<br>
Point & Click Graphic adventure.<br>
What I need are routines to move a characture<br>
from it's current position to a new position<br>
given from a mouse click while going around<br>
obsticles or staying on a path.<br>
I can only find info for tile maps and that is<br>
not what I want.<br>
Any help would be appreciated.


Edit Report
Pelle : Platform, language? Posted by Pelle Lindstrand on 24 Jul 2000 at 3:37 PM
* Which platform are you using?<br>
<br>
* Which programming language are you using?<br>
<br>
* Which compiler are you using?<br>
- If windows, are you using some API?<br>
- Are you using some library?<br>
<br>
--- DOS ---<br>
<br>
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).<br>
<br>
--- Watcom C (11.0) Example of get mouse position and button state (32bit environment) ---<br>
/*<br>
--------<br>
i_mouse_init<br>
<br>
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.<br>
--------<br>
*/<br>
bool i_mouse_init(void)<br>
{<br>
short success = 0;<br>
union REGS regs;<br>
<br>
regs.w.ax = 0x0;<br>
int86(0x33,&regs,&regs);<br>
<br>
success = regs.w.ax;<br>
<br>
return success;<br>
}<br>
<br>
/*<br>
--------<br>
mouse_position_abs<br>
<br>
get mouse absolute position, you can also get<br>
the mouse relative position which returns the increment movement of the mouse.<br>
--------<br>
*/<br>
void mouse_position_abs(int *mouse_x,int *mouse_y)<br>
{<br>
union REGS regs;<br>
<br>
regs.x.eax = 0x03;<br>
int86(0x33,&regs,&regs);<br>
<br>
*mouse_x = regs.x.ecx;<br>
*mouse_y = regs.x.edx;<br>
}<br>
<br>
/*<br>
--------<br>
mouse_button<br>
<br>
gets the mouse-button's states<br>
<br>
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.<br>
--------<br>
*/<br>
void mouse_button(int *b_left,int *b_middle,int *b_right)<br>
{<br>
union REGS regs;<br>
unsigned char button;<br>
<br>
regs.x.eax = 0x3;<br>
int86(0x33,&regs,&regs);<br>
<br>
button = regs.x.ebx;<br>
<br>
// this is not really needed if you reset the variables before calling this function<br>
*b_left = *b_middle = *b_right = 0;<br>
<br>
if ((button & 0x01))<br>
*b_left = 1;<br>
if ((button & 0x02))<br>
*b_right = 1;<br>
if ((button & 0x04))<br>
*b_middle = 1;<br>
}<br>
<br>
--- end of Watcom C Example ---<br>
--- end of DOS ---<br>
<br>
Hope this helps you out, don't hesitate to email me if you have any questions.<br>
<br>
--- pelle


Edit Report
Re: Pelle : Platform, language? Posted by Alan Fullarton on 24 Jul 2000 at 7:38 PM
Sorry I was not clear,<br>
I am programming in c on Amiga & IBM compatible.<br>
I was'nt having trouble with the mouse but<br>
finding a path around obsticles. The information<br>
that I can find are tile based and I need something suitible for a game like King's Quest,<br>
Quest for Glory or Secret to Monky Island.<br>
These Games have a background to interact with<br>
and have irregular shaped obsticles and paths.<br>
I can use pseodo code or code in any language<br>
except assembly, I know nothing of assembly.<br>
Thanks for your responce.<br>
Alan Fullarton<br>






 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.