# Phaser 使用 Spine
📆 2022-1-19 22:33
# 实现
var gameConfig={
scene:{
preload:preload,
create:create,
pack:{
files:[
{
type: 'scenePlugin',
key: 'SpinePlugin',
url: 'lib/SpinePlugin.3.55.2.min.js',
sceneKey: 'spine'
}
]
}
}
}
function preload(){
this.load.spine('dog', 'assets/dog.json', 'assets/dog.atlas')
}
function create(){
var dog = this.add.spine(0, 0, 'dog', 'idle', true);
dog.play('idle',true)
}
# 加入物理引擎
this.physics.add.existing(dog)
dog.body.setCollideWorldBounds(true)
dog.body.setVelocityX(10)
# 更多
2D游戏动画 Spine (opens new window)