简体   繁体   English

使用相位器避免JavaScript游戏中的障碍

[英]Avoiding an obstacle in a JavaScript game using phaser

I am developing a html5/javascript game using the phaser package ( http://phaser.io/ ) 我正在使用Phaser软件包( http://phaser.io/ )开发html5 / javascript游戏

As part of this I need to do some ray-casting to create a vision cone ahead and too the side of the character. 为此,我需要进行一些射线投射,以在角色的前方以及角色的侧面创建视锥。 In the past I have used unity where this is really strait forward but I cant understand how I would go about this using phaser. 过去,我曾经使用过团结,这实际上是向前发展,但我无法理解如何使用移相器实现这一目标。

I have sketched out what I would like to do: 我已经勾勒出我想做的事情:

人物和墙

I really don't know where to start with this in javascript/phaser. 我真的不知道在javascript / phaser中从哪里开始。 The wall is made up of sprites currently. 墙壁目前由精灵组成。 I cant find any good information on how to do ray-casting for obstacle detection anywhere so if someone could point me in the right direction that would be amazing. 我在任何地方都找不到有关如何进行射线投射以进行障碍检测的任何有用信息,因此,如果有人可以将我指向正确的方向,那将是惊人的。

Alternatively, could anyone suggest a better approach to obstacle detection in multiple directions? 或者,有人可以建议一种更好的方法来检测多个方向的障碍吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM