在 Flash / AS3 游戏中使用 2 个鼠标实例
我必须编写 2 人 Flash/AS3 视频游戏。每个玩家必须控制一个盒子,并用它们来捕捉从“天”上掉下来的元素。一分钟后捕捉到更多这些元素的用户获胜。
用户应该用鼠标移动他们的盒子,但为此我需要监听来自两个不同源的鼠标事件。
我可以从它们的来源(鼠标设备 - 播放器)获取每个 MouseEvent.CLICK、MouseEvent.MOUSE_MOVE 和 MouseEvent.MOUSE_UP 吗?
感谢您的帮助!
约尔迪
I have to code a 2-Player Flash / AS3 Video game. Each player must control a box, and with them, they have to catch elements that fall from the "sky". The user that after one minute has caught more of these elements wins.
The users are supposed to move their boxes with the mouse, but for it I'd need to listen mouse events from 2 different sources.
Could I get for each MouseEvent.CLICK, MouseEvent.MOUSE_MOVE and MouseEvent.MOUSE_UP from what source (mouse device - player) they came?
Thanks for your help!
Jordi
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是说一台计算机将插入两个鼠标,并且您想在 Flash 中使用它们? Flash 根本不支持此功能,因为大多数操作系统甚至不支持此功能。如果您正在谈论两台计算机上的多人游戏,则必须使用网络套接字来依赖实时数据。
作为替代方案,您可以制作一种类型的输入鼠标和另一种类型的键盘以进行共享屏幕多人游戏。希望这有帮助!
You are saying that one computer will have two mice plugged into it, and you want to use them from within Flash? Flash does not support this at all as most operating systems don't even support this feature. If you are talking about multiplayer over two computers, you will have to use network sockets to rely the realtime data.
As an alternative, you can make one type of input mouse and the other type keyboard for shared screen multiplay. Hope this helps!