小弟在做一个多人射击游戏
现在需要解决的是4个人同时玩,比如用键盘"a","s","d","f"键分别代表不同鼠标的左健(即射击发射子弹键)
现在关键是
不论用什么办法怎么模拟4个鼠标,如果都用键盘是不是会冲突。
大家有没有什么好办法或是有什么其他的好办法??

解决方案 »

  1.   

    还是搞联机吧,你如何搞4个鼠标到计算机上,windows都不认
      

  2.   

    TO pazee(耙子) 
    真是业内人士呀
    顺便解决我的第一个问题吧
      

  3.   

    TO pazee(耙子) 
    你能搞到射击“靶子”的图片吗?谢拉
      

  4.   

    我不是做游戏的,也不是业内人士。第一个问题。usb 刚刚推广的时候,intel做了一个展示会,在一台电脑上同时连接了 117个鼠标,usb 1.0标准一个口能理论上同时支持128各设备。不要以为屏幕上也是 117个鼠标在动,呵呵,只有一个。window的鼠标是个唯一设备。当然了如果你自己写鼠标的驱动能区分开不同的鼠标,但是代价太大了。你还是应该从键盘模拟或者游戏手柄入手,这个DX都提供了完善的接口。
      

  5.   

    我这个想法不知道行不?
    1.写一个player类;
    2.用4个线程分别控制player的4个实例;
    3.每个实例检测一个键的状态,如果是按下的就打一枪.
      

  6.   

    关于 激光枪 的原理,我同意disney(编程乐园) 说法
      

  7.   

    这样可以同时使用键盘动4个伪鼠标(image)var
      Form1: TForm1;
      Keys:array [0..3,0..3] of boolean;implementation{$R *.dfm}procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key=Ord('A') then
        Keys[0][0]:=true
      else if Key=Ord('F') then
        Keys[1][0]:=true
      else if Key=Ord('J') then
        Keys[2][0]:=true
      else if Key=VK_LEFT then
        Keys[3][0]:=true
      else if Key=Ord('D') then
        Keys[0][1]:=true
      else if Key=Ord('H') then
        Keys[1][1]:=true
      else if Key=Ord('L') then
        Keys[2][1]:=true
      else if Key=VK_RIGHT then
        Keys[3][1]:=true
      else if Key=Ord('W') then
        Keys[0][2]:=true
      else if Key=Ord('T') then
        Keys[1][2]:=true
      else if Key=Ord('I') then
        Keys[2][2]:=true
      else if Key=VK_UP then
        Keys[3][2]:=true
      else if Key=Ord('S') then
        Keys[0][3]:=true
      else if Key=Ord('G') then
        Keys[1][3]:=true
      else if Key=Ord('K') then
        Keys[2][3]:=true
      else if Key=VK_DOWN then
        Keys[3][3]:=true;
    end;procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      if Key=Ord('A') then
        Keys[0][0]:=false
      else if Key=Ord('F') then
        Keys[1][0]:=false
      else if Key=Ord('J') then
        Keys[2][0]:=false
      else if Key=VK_LEFT then
        Keys[3][0]:=false
      else if Key=Ord('D') then
        Keys[0][1]:=false
      else if Key=Ord('H') then
        Keys[1][1]:=false
      else if Key=Ord('L') then
        Keys[2][1]:=false
      else if Key=VK_RIGHT then
        Keys[3][1]:=false
      else if Key=Ord('W') then
        Keys[0][2]:=false
      else if Key=Ord('T') then
        Keys[1][2]:=false
      else if Key=Ord('I') then
        Keys[2][2]:=false
      else if Key=VK_UP then
        Keys[3][2]:=false
      else if Key=Ord('S') then
        Keys[0][3]:=false
      else if Key=Ord('G') then
        Keys[1][3]:=false
      else if Key=Ord('K') then
        Keys[2][3]:=false
      else if Key=VK_DOWN then
        Keys[3][3]:=false;
    end;procedure TForm1.Timer1Timer(Sender: TObject);
    begin
      if Keys[0][0] then
        Image1.Left:=Image1.Left-1;
      if Keys[0][1] then
        Image1.Left:=Image1.Left+1;
      if Keys[0][2] then
        Image1.Top:=Image1.Top-1;
      if Keys[0][3] then
        Image1.Top:=Image1.Top+1;
      if Keys[1][0] then
        Image2.Left:=Image2.Left-1;
      if Keys[1][1] then
        Image2.Left:=Image2.Left+1;
      if Keys[1][2] then
        Image2.Top:=Image2.Top-1;
      if Keys[1][3] then
        Image2.Top:=Image2.Top+1;
      if Keys[2][0] then
        Image3.Left:=Image3.Left-1;
      if Keys[2][1] then
        Image3.Left:=Image3.Left+1;
      if Keys[2][2] then
        Image3.Top:=Image3.Top-1;
      if Keys[2][3] then
        Image3.Top:=Image3.Top+1;
      if Keys[3][0] then
        Image4.Left:=Image4.Left-1;
      if Keys[3][1] then
        Image4.Left:=Image4.Left+1;
      if Keys[3][2] then
        Image4.Top:=Image4.Top-1;
      if Keys[3][3] then
        Image4.Top:=Image4.Top+1;
      Application.ProcessMessages;
    end;
      

  8.   

    BlueTrees(蜗牛) 我觉得你要四个肾才是重要的。
      

  9.   

    to: disney(编程乐园)如果按照你设想的,你没考虑到2个问题,1.扫描线的余辉问题,这个问题在CRT上虽然不是很明显,但是就显示器的扫描速度你是没有办法能识别出来这个点的。2.同步问题,那个游戏机送出来信号需要严格和显示器行同步,这个几乎是没办法做到的,有能力到300线的电视机和200线的电视机他们的行不可能同步的。
      

  10.   

    我觉得你也许应该换一下思路,不是把鼠标插在ps2或串口上用,而是将四个鼠标作为纯粹的电子设备,然后自己改造后连到如并口之类的接口上,然后要作的就是开发一个象跳舞毯之类的驱动程序(或者,也许可以找到正好和你性能指标相同的手柄驱动),然后只要在你的程序中用directinput实现四个关标的运动就可以了,不一定非要windows系统来支持四鼠标!
      

  11.   

    你可以尝试一下USB接口设备,不一定要同鼠标。使用其它的设备。
      

  12.   

    认,谁说不认。我的笔记本就有四个USB口,不过我只有一个鼠标,有条件的朋友可以试哦
      

  13.   

    玩过dos时代的三国志武将争霸(2)吗?
    2个人,一个用大键盘,一个用小键盘,386上从来没有延迟!
    (3)就不行了,486上都会有延迟给你个思路:程序中使用定时器(无限循环也可),将当前的键盘缓冲全部取出(同时清空键盘缓冲),然后进行计算,并将计算的结果反映在屏幕上。关于键盘缓冲,参见下面的地址
    http://pagoda-ooos.51.net/os_book/driver/driver-keyboard_2.htm注意在编程的时候,要自己控制repeat code,而不要使用键盘产生的repeat code
      

  14.   

    自己写驱动?代价稍微大了点
     tonylk(tony)自己做电子设备?有点夸张了
      

  15.   

    小弟在做一个多人射击游戏
    现在需要解决的是4个人同时玩,比如用键盘"a","s","d","f"键分别代表不同鼠标的左健(即射击发射子弹键)
    现在关键是
    不论用什么办法怎么模拟4个鼠标,如果都用键盘是不是会冲突。
    大家有没有什么好办法或是有什么其他的好办法??^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    呵呵。仔细看看楼主的贴,哪里是接四个鼠标?分明是要用四个键来模拟鼠标左键,这么说其实也不对而是楼主不过要实现同时按下四个建不发生键盘冲突.....
    为什么大家都这样?不知道这篇老贴子为什么又翻出来?其实只要一个人用鼠标,另外三个人用键盘不就行了?