使用Phaser的黑屏

时间:2018-10-18 10:04:46

标签: javascript phaser-framework game-development

我无法使用Phaser.js。它是phaser.io/examples中示例的副本。那到底是什么?

var game = new Phaser.Game(400, 200, Phaser.AUTO, 'phaser-example', {
  preload: preload,
  create: create,
  update: update,
  render: render
});

function preload() {
  game.load.image('arrow', 'img.png');
}

var sprite;

function create() {
  sprite = game.add.sprite(50, 50, 'arrow');
}

function update() {}

function render() {}
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
  <meta charset="utf-8">
</head>
<body>

</body>
</html>

但是我所拥有的全部->

Google Drive Link - Screenshot result 或在这里 enter image description here

1 个答案:

答案 0 :(得分:1)

问题在于您已经设置了Phaser 2游戏,而在html中则调用了Phaser 3库。 在Phaser 3中,您可以启动这样的游戏:

Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    DataGridView1.DataSource = GetData()
End Sub

Private Function GetData() As DataTable
    Dim table As New DataTable

    'Populate table here.

    Return table
End Function

https://phaser.io/tutorials/making-your-first-phaser-3-game/index