在VSCode中构建typescript时,我收到以下错误:
错误TS6082:在--out旁边只支持'amd'和'system'模块.
我的设置如下:
tsconfig.json
{
"compilerOptions": {
"target": "ES5",
"module": "commonjs",
"out": "current/game.js",
"removeComments": true,
"sourceMap": false
}
}
Run Code Online (Sandbox Code Playgroud)
.vscode/tasks.json:
{
"version": "0.1.0",
// The command is tsc. Assumes that tsc has been installed using npm install -g typescript
"command": "tsc",
// The command is a shell script
"isShellCommand": true,
// Show the output window only if unrecognized errors occur.
"showOutput": "silent",
// args is the HelloWorld program to compile.
"args": [],
// use the standard tsc problem matcher to …Run Code Online (Sandbox Code Playgroud) 所有:
我的学校项目之一就是制作一个实时的多重播放器网页游戏,我目前很难决定是否应该去Pixi.js或Phaser进行游戏图形和控制,任何人都可以谈谈他们擅长什么和彼此更好?
谢谢
我正在使用phaser.js来制作游戏,我找不到任何关于如何使背景无限滚动的教程.我希望背景能够横向平铺/重复,并且随着角色向右移动而无限.
我目前正在使用相机并让相机跟随角色.
以下是关于如何执行此操作的想法:在update()中不断检查摄像机的位置,然后将其移动到游戏玩法的开头(最左侧)以及当时的角色.我认为这可能不是一个平稳的过渡,所以我想知道是否有更好的方法来做到这一点.
我在Phaser中摧毁精灵时遇到了麻烦.
我有一个JavaScript对象,我们称之为Block.Block有一个sprite属性,设置如下:
this.sprite = this.game.add.sprite(this.x, this.y, 'blocks', this.color);
Run Code Online (Sandbox Code Playgroud)
在我的代码中的某个点,Block由两个不同的数组引用:
square[0] = Block;
destroy[0] = Block;
Run Code Online (Sandbox Code Playgroud)
在某个Update()循环中,我需要销毁精灵,所以我使用以下代码:
square[0].sprite.destroy(true); //Destroy the sprite.
square[0] = null; //Remove the reference.
Run Code Online (Sandbox Code Playgroud)
在下一个Update()循环中,当我查看destroy [0]时,我希望看到:
destroy[0].sprite: null
Run Code Online (Sandbox Code Playgroud)
然而,我所看到的是:
destroy[0].sprite: b.Sprite
Run Code Online (Sandbox Code Playgroud)
属性只是默认并设置为false.我担心的是,如果我现在将destroy [0]设置为null,那个sprite对象会发生什么?
它会浮动还是自动清理?我应该先以某种方式破坏Block对象吗?另外,如果destroy()没有使引用为空,那么它与kill()有什么不同?
任何有关此事的想法将不胜感激.
我一直在寻找一种解决方案,能够使用 Phaser 3 让我的游戏完全响应任何屏幕分辨率,例如:

这个例子是用Construct 2制作的,顺便说一下,实现这个效果非常简单。
有谁知道使用 Phaser 3 实现这一目标的最佳方法是什么?
我正在使用Matter.js物理来创建柔体.我能够创建这样的身体:
但是我不确定这是否是我想要的"软体".确实,这个身体并不是完全僵硬的,并且当它碰撞并被拖拽时具有那种有弹性的感觉.我正在寻找一个与凝胶有相似之处的身体.此图像可能在视觉上有助于解释概念:
我想知道如何制作这些类型的尸体.它与as matter.js软体相同,但具有非常特殊的属性类型吗?我只能让身体变得僵硬,而不是像我希望的那样可塑造和圆形.
我也很有兴趣通过游戏中的相互作用操纵物理体,这会增加或减少物理体的大小,这使我再次得出结论,我想要的身体类型必须是相当可塑的.
may.js可以处理这个还是我必须更改物理引擎?任何接近这个的解决方案?
注意:我使用Phaser.js作为一些游戏中的组件,但是物理操作的物理问题是物理操作,因为我相信Phaser集成的物理学不能模拟这种类型的复杂体.
谢谢
编辑:它非常类似于这个Box2d:滚动软体球.我想我只需要使用js引擎.有没有?
目前在phaser中构建一个基于浏览器的游戏并尝试将其添加到我创建的容器div标签中,但是phaser似乎正在将自己推向容器div之下.
http://gyazo.com/3cc9b9333cf89d7fc879bd2cdc741609(这是我目前在里面的标题div的容器div,这就是我想让我的相位器游戏做的事情)
http://gyazo.com/5a7cea7514a9e295355c87933c3d14ac(这是我的移相器游戏目前在页脚div上面做的,你可以看到容器div,也清楚地看到当前位于页脚div下的移相器游戏)
这是我的HTML页面的代码:
<!DOCTYPE html>
<html>
<head>
<title>This is our menu bar!</title>
<link rel="stylesheet" type="text/css" href="styles.css"/>
</head>
<body>
<ul id="menu">
<li><a href="file:///H:/AINT103/xampp/htdocs/Weekfour/index.html" class="highlight"><span>Home</span></a></li>
<li><a href="file:///H:/AINT103/xampp/htdocs/Weekfour/index.html"><span>Link1</span></a></li>
<li><a href="file:///H:/AINT103/xampp/htdocs/Weekfour/index.html"><span>Link2</span></a></li>
<li><a href="file:///H:/AINT103/xampp/htdocs/Weekfour/index.html"><span>Link3</span></a></li>
<li><a href="file:///H:/AINT103/xampp/htdocs/Weekfour/index.html"><span>Link4</span></a></li>
</ul>
<div class="container">
<script rel="javascript" type="text/javascript" src="phaser.js"></script>
<script rel="javascript" type="text/javascript" src="game.js"></script>
<div class="header">
Title of game & small talk about about with some a box surrounding this text before another text box surrounding the game below
</div>
<div class="instructions">
</div>
Instructions
</div>
<div id="footer">
Copyright 2013 …Run Code Online (Sandbox Code Playgroud) 我正在使用一些我希望在实际游戏中缩小的大图像在Phaser中制作游戏:
create() {
//Create the sprite group and scale it down to 30%
this.pieces = this.add.group(undefined, "pieces", true);
this.pieces.scale.x = 0.3;
this.pieces.scale.y = 0.3;
//Add the players to the middle of the stage and add them to the 'pieces' group
var middle = new Phaser.Point( game.stage.width/2, game.stage.height/2);
var player_two = this.add.sprite(middle.x - 50, middle.y, 'image1', undefined, this.pieces);
var player_one = this.add.sprite(middle.x, middle.y-50, 'image2', undefined, this.pieces);
}
Run Code Online (Sandbox Code Playgroud)
然而,因为精灵的大小是缩放的,它们的起始位置也是缩放的,所以相反出现在舞台的中间,它们只出现到中间距离的30%.
如何缩放精灵图像而不影响它们的位置?
(代码偶然出现在Typescript中,但我认为这个特定的示例也是javascript,因此可能无关紧要)
我使用Phaser.js开发了一款游戏应用程序.我把代码放入Ionic空白启动应用程序.因此,基本上使用Ionic应用程序渲染视图,然后Phaser通过id获取div并显示游戏.
它是一个简单的飞扬的鸟类克隆.它的工作正常,但块运动有点不稳定(好像它们在颤抖).由于Phaser使用WebGL,它可能是缓慢渲染的原因还是由于离子框架(/ angularjs)?
我是否应该使用其他一些工具来构建游戏应用程序?
提前致谢.
你可以在这里查看代码:https://github.com/vamshisuram/ionic-flappybird-clone.git 我将所有代码上传到Git.所以,我想你可以直接在你的手机上安装平台/ ant-build/Hello-Cordova-debug.apk并进行测试.或者再次尝试构建并安装.
我在用户本地服务器上相当新.我正在使用http-server,它是Node的一个软件包.我正在使用它来使用Phaser库托管HTML5游戏.我有在游戏中使用的图像资源,有时我会更新这些资产.当我这样做时,对图像的更改不会反映在游戏中.我已经尝试重新启动服务器,但这没有帮助.他们通常需要一些时间来更新,大约一个小时.有什么想法会出错吗?
phaser-framework ×10
javascript ×7
html5 ×2
pixi.js ×2
angularjs ×1
css ×1
game-engine ×1
game-physics ×1
html ×1
httpserver ×1
matterjs ×1
node.js ×1
physics ×1
sprite ×1
typescript ×1