Skip to content

How to run the project locally #47

@1594865160

Description

@1594865160

方法1:将F.LF和LF2_19放到同一目录下,打开F.LF\game\game.html游戏就启动了,但file://这种方式会因为浏览器的强制安全策略导致读取不了本地的声音文件,游戏没有声音
方法2:在本地使用python或者node在F.LF和LF2_19的上级目录启动服务器,然后使用类似
http://localhost:3000/F.LF/game/game
这样的链接,启动游戏,但是中国大陆的用户会遇到素材加载慢,无法正常运行游戏的问题,是因为作者把图片存在 Google 图床。当通过 http:// 访问时,用远程图片;当通过 file:// 打开时,用项目本地的图片,而远程图片所在的地址是被中国大陆屏蔽的,所以会获取不到图片或者加载速度很慢,这个时候需要修改LF2_19项目中的resourcemap.js文件,这个文件的condition属性里写明了如果通过 http:// 访问时,用远程图片,所以这里需要将condition的判断条件写死为false,这样就不会读取远程图片了,我写的是condition: 'location contain never',修改完这里,保存然后启动服务器,就可以正常游戏了。

Method 1: Place F.LF and LF2_19 in the same directory, then open F.LF\game\game.html to launch the game. However, using the file:// protocol will cause the browser's strict security policy to block access to local sound files, resulting in no audio in the game.

Method 2: Use Python or Node.js to start a local server in the parent directory of F.LF and LF2_19, then access the game through a URL like http://localhost:3000/F.LF/game/game. However, users in mainland China may experience slow resource loading or failure to run the game properly. This is because the author stored images on Google's image hosting service. When accessed via http://, the game uses remote images instead of local ones. Since the remote image URLs are blocked in mainland China, the images either fail to load or load extremely slowly.

To fix this, you need to modify the resourcemap.js file in the LF2_19 project. The condition property in this file specifies that when accessed via http://, remote images should be used. You need to hardcode this condition to false so that remote images will not be loaded. For example, I changed it to condition: 'location contain never'. After making this change, save the file and start the server, and the game should run normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions