Phaser.Component. Health

new Health()

The Health component provides the ability for Game Objects to have a health property that can be damaged and reset through game code. Requires the LifeSpan component.

Source - gameobjects/components/Health.js, line 14

Members

damage

Damages the Game Object. This removes the given amount of health from the health property.

If health is taken below or is equal to zero then the kill method is called.

Source - gameobjects/components/Health.js, line 46

heal

Heal the Game Object. This adds the given amount of health to the health property.

Source - gameobjects/components/Health.js, line 90

health :number

The Game Objects health value. This is a handy property for setting and manipulating health on a Game Object.

It can be used in combination with the damage method or modified directly.

Default Value:
  • 1
Source - gameobjects/components/Health.js, line 26

maxHealth :number

The Game Objects maximum health value. This works in combination with the heal method to ensure the health value never exceeds the maximum.

Default Value:
  • 100
Source - gameobjects/components/Health.js, line 35

setHealth

Sets the health property of the Game Object to the given amount. Will never exceed the maxHealth value.

Source - gameobjects/components/Health.js, line 70
Phaser Copyright © 2012-2015 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.2 on Thu Feb 18 2016 14:41:00 GMT+0000 (GMT Standard Time) using the DocStrap template.

快捷菜单

注意:只有登录才能全文翻译,每个新用户赠送300会员币。
赚取方法:文章评论+1000,分享网站截图给站长+3000,另充10元+100万会员币
支持一下记得截图给站长!

VIP限时免费阅读!登录可得1万币尽情中文阅读!


记得CTRL+D收藏!
站长微信:
支持自学php网
如有问题,记得强刷一下.

  • damage - 方法
  • heal - 方法
  • health :number - 属性
  • maxHealth :number - 属性
  • setHealth - 方法