Skip to content

Image ​

Phaser v4.1.0 · 英文原文

一个Matter 物理图像游戏对象.

A MatterImage 是一个标准 Phaser 图像游戏对象,其上有一个 Matter.js 物理体自动创建并附着,它将静态图像的轻量渲染与 Matter.j 硬体物理模拟的全套组合结合,包括引力,摩擦,弹跳,质量,以及与其他 Matter 体的精确碰撞反应.

默认情况下,会创建一个与图像显示维度相匹配的矩形物理体。您可以通过 options 参数提供自定义形状,以使用一个圆形,多边形,或者物理编辑器等物理编辑器中定义的复合体.

使用 MatterImage 来表示您场景中的非动画物理对象, 如平台、 箱子、 墙壁、 碎片或收藏物。 如果您需要与 Matter.js 物理并列的帧动画, 请使用 Phaser.Physics.Matter.Sprite 。 MatterImge 和 MatterSprite 的主要区别在于 MatterImice 没有动画组件, 无法播放基于纹理的动画 。

构造函数

new Image(world, x, y, texture, [frame], [options])

参数

名称类型可选说明
worldPhaser.Physics.Matter.World否提到这个实体,这个机构所属的世界实例。
xnumber否这个游戏对象在世界的横向位置.
ynumber否此游戏对象在世界的垂直位置 。
texturestring | Phaser.Textures.Texture否此游戏对象将使用用于渲染的纹理的键或实例, 如保存在纹理管理器中 。
framestring | number是游戏对象正在用此渲染的纹理的可选框架 。
optionsPhaser.Types.Physics.Matter.MatterBodyConfig是一个可选的 body 配置对象,用于设定创建时的初始 body 属性 。

作用域: static

继承

Phaser.GameObjects.Image
Phaser.Physics.Matter.Components.Bounce
Phaser.Physics.Matter.Components.Collision
Phaser.Physics.Matter.Components.Force
Phaser.Physics.Matter.Components.Friction
Phaser.Physics.Matter.Components.Gravity
Phaser.Physics.Matter.Components.Mass
Phaser.Physics.Matter.Components.Sensor
Phaser.Physics.Matter.Components.SetBody
Phaser.Physics.Matter.Components.Sleep
Phaser.Physics.Matter.Components.Static
Phaser.Physics.Matter.Components.Transform
Phaser.Physics.Matter.Components.Velocity
Phaser.GameObjects.Components.Alpha
Phaser.GameObjects.Components.BlendMode
Phaser.GameObjects.Components.Depth
Phaser.GameObjects.Components.Flip
Phaser.GameObjects.Components.GetBounds
Phaser.GameObjects.Components.Mask
Phaser.GameObjects.Components.Origin
Phaser.GameObjects.Components.ScrollFactor
Phaser.GameObjects.Components.Size
Phaser.GameObjects.Components.Texture
Phaser.GameObjects.Components.Tint
Phaser.GameObjects.Components.Transform
Phaser.GameObjects.Components.Visible

源码:src/physics/matter-js/MatterImage.js#L14
引入版本:3.0.0

继承的成员 ​

From Phaser.GameObjects.Components.Alpha:

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.Flip:

From Phaser.GameObjects.Components.Lighting:

From Phaser.GameObjects.Components.Mask:

From Phaser.GameObjects.Components.Origin:

From Phaser.GameObjects.Components.RenderNodes:

From Phaser.GameObjects.Components.ScrollFactor:

From Phaser.GameObjects.Components.Size:

From Phaser.GameObjects.Components.TextureCrop:

From Phaser.GameObjects.Components.Tint:

From Phaser.GameObjects.Components.Transform:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject:

From Phaser.Physics.Matter.Components.Mass:


公开成员 ​

world ​

world: Phaser.Physics.Matter.World ​

说明:

提到这个实体,这个机构所属的世界实例。

源码:src/physics/matter-js/MatterImage.js#L111
引入版本:3.0.0


继承的方法 ​

From Phaser.Events.EventEmitter:

From Phaser.GameObjects.Components.Alpha:

From Phaser.GameObjects.Components.BlendMode:

From Phaser.GameObjects.Components.Depth:

From Phaser.GameObjects.Components.Filters:

From Phaser.GameObjects.Components.Flip:

From Phaser.GameObjects.Components.GetBounds:

From Phaser.GameObjects.Components.Lighting:

From Phaser.GameObjects.Components.Mask:

From Phaser.GameObjects.Components.Origin:

From Phaser.GameObjects.Components.RenderNodes:

From Phaser.GameObjects.Components.RenderSteps:

From Phaser.GameObjects.Components.ScrollFactor:

From Phaser.GameObjects.Components.Size:

From Phaser.GameObjects.Components.TextureCrop:

From Phaser.GameObjects.Components.Tint:

From Phaser.GameObjects.Components.Transform:

From Phaser.GameObjects.Components.Visible:

From Phaser.GameObjects.GameObject:

From Phaser.Physics.Matter.Components.Bounce:

From Phaser.Physics.Matter.Components.Collision:

From Phaser.Physics.Matter.Components.Force:

From Phaser.Physics.Matter.Components.Friction:

From Phaser.Physics.Matter.Components.Gravity:

From Phaser.Physics.Matter.Components.Mass:

From Phaser.Physics.Matter.Components.Sensor:

From Phaser.Physics.Matter.Components.SetBody:

From Phaser.Physics.Matter.Components.Sleep:

From Phaser.Physics.Matter.Components.Static:

From Phaser.Physics.Matter.Components.Transform:

From Phaser.Physics.Matter.Components.Velocity:



社区翻译