phaser-framework - 从另一个身体的墙壁上弹起一个身体。Phaser3
问题描述
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
backgroundColor: '#1b1464',
parent: 'phaser-example',
physics: {
default: 'matter',
matter: {
debug: true
}
},
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.image('red', 'assets/sprites/columns-red.png');
}
function create ()
{
this.matter.world.setBounds(100, 0, 600, 400, 1).disableGravity();
console.log(this.matter.world.walls.bottom)
var circ = this.matter.add.image(200, 50, 'red');
// Change the body to a Circle with a radius of 48px
circ.setBody({
type: 'circle',
radius: 48
});
// Just make the body move around and bounce
circ.setVelocity(6, 3);
circ.setAngularVelocity(0.01);
circ.setBounce(1);
circ.setFriction(1, 0, 0);
}
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="//cdn.jsdelivr.net/npm/phaser@3.19.0/dist/phaser.js"></script>
<script src="//cdn.jsdelivr.net/npm/phaser@3.19.0/dist/phaser.min.js"></script>
</head>
有一个代码,根据该代码,球被摆正并从墙壁反弹。我怎样才能旋转这个正方形?
我已准备好接受在其他移相器引擎上实施此示例的建议
解决方案
推荐阅读
- python - 我可以使用隐式或不同的方式从弧度转换为度数模式?
- linkedin - LinkedIn 在使用 HttpClient 发出请求时返回 401 REST API
- python - pd cut last 值没有被标记
- pixi.js - TypeError: child.transform is undefined Pixijs Webpack
- java - 在android studio中存储带有索引的数据时字符串数组出错
- spring - 如何使用基本身份验证保护 Spring Cloud Eureka 服务?
- angularjs - 设置选择的某些选项
- c# - Unity 没有找到另一个 DLL 的 DLL 依赖项(都在 Assets 文件夹中)
- javascript - 使用 lodash 将服务响应对象值转换为数组
- javascript - HeadFirst JS:代码示例中的问题