Class Index | File Index

Classes


Class enchant.PhySprite


Extends enchant.Sprite.

Defined in: PhySprite.enchant.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
enchant.PhySprite(width, height)
画像表示機能を持った物理シミュレーションクラス.
Field Summary
Field Attributes Field Name and Description
 
アクティブかどうか 物理シミュレーションが行われて、他の物体に干渉できるか
 
Spriteの角度 (度数法).
 
Spriteの角速度(単位はdeg/s).
 
Spriteの中心のx座標.
 
Spriteの中心のy座標.
 
Spriteの中心座標ベクトル.
 
物理シミュレーションされているか 物体の動きが止まると処理コスト軽減のためsleep状態になる
 
Spriteのタイプ 静的(STATIC_SPRITE)か動的(DYNAMIC_SPRITE)かキネマティック(KINEMATIC_SPRITE)か
 
Spriteの速度(単位はpx/s).
 
表示/非表示(物理シミュレーションも止まる)
 
vx
Spriteのx座標の速度(単位はpx/s).
 
vy
Spriteのy座標の速度(単位はpx/s).
 
x
Spriteのx座標.
 
y
Spriteのy座標.
Method Summary
Method Attributes Method Name and Description
 
applyForce(force)
継続的な力を加える
 
applyImpulse(impulse)
瞬間的な力を加える
 
applyTorque(torque)
継続的な回転力を与える
 
contact(func)
衝突判定
 
createPhyBox(type, density, friction, restitution, awake)
四角形の物理シミュレーション用Sprite生成.
 
createPhyCircle(type, density, friction, restitution, awake)
円形の物理シミュレーション用Sprite生成.
 
createPhyPolygon(vertexs, type, density, friction, restitution, awake)
多角形の物理シミュレーション用Sprite生成.
 
物体の削除 removeChildではなくこちらでSpriteを取り除く
 
bodyの取得 Box2Dの処理を各自行いたい時に取得する
 
動的オブジェクトかどうか
 
キネマティックオブジェクトかどうか
 
静的オブジェクトかどうか
 
setAwake(flag)
物理シミュレーションされていない時、物理シミュレーションを行う(sleep時は動かなくなるので)
 
デバッグ用のイメージをセット
Class Detail
enchant.PhySprite(width, height)
画像表示機能を持った物理シミュレーションクラス.
Parameters:
{Number} width Optional
Spriteの横幅.
{Number} height Optional
Spriteの高さ.
Field Detail
active
アクティブかどうか 物理シミュレーションが行われて、他の物体に干渉できるか

angle
Spriteの角度 (度数法)..

angularVelocity
Spriteの角速度(単位はdeg/s).

centerX
Spriteの中心のx座標.

centerY
Spriteの中心のy座標.

position
Spriteの中心座標ベクトル.

sleep
物理シミュレーションされているか 物体の動きが止まると処理コスト軽減のためsleep状態になる

type
Spriteのタイプ 静的(STATIC_SPRITE)か動的(DYNAMIC_SPRITE)かキネマティック(KINEMATIC_SPRITE)か

velocity
Spriteの速度(単位はpx/s).

visible
表示/非表示(物理シミュレーションも止まる)

vx
Spriteのx座標の速度(単位はpx/s).

vy
Spriteのy座標の速度(単位はpx/s).

x
Spriteのx座標.

y
Spriteのy座標.
Method Detail
applyForce(force)
継続的な力を加える
Parameters:
{b2Vec2} force
加える力のベクトル

applyImpulse(impulse)
瞬間的な力を加える
Parameters:
{b2Vec2} impulse
加える力のベクトル

applyTorque(torque)
継続的な回転力を与える
Parameters:
{Number} torque
加える回転力

contact(func)
衝突判定
  //bearに当たったSpriteを消す
  bear.contact(function (sprite) {
     sprite.destroy(); 
  });
Parameters:
{function(sprite:enchant.PhySprite)} func Optional
ぶつかったSpriteを引数とする関数

createPhyBox(type, density, friction, restitution, awake)
四角形の物理シミュレーション用Sprite生成.
Parameters:
{Boolean} type
静的,動的,キネマティック
{Number} density
Spriteの密度.
{Number} friction
Spriteの摩擦.
{Number} restitution
Spriteの反発.
{Boolean} awake
Spriteが初めから物理演算を行うか.

createPhyCircle(type, density, friction, restitution, awake)
円形の物理シミュレーション用Sprite生成.
Parameters:
{Boolean} type
静的,動的,キネマティック
{Number} density
Spriteの密度.
{Number} friction
Spriteの摩擦.
{Number} restitution
Spriteの反発.
{Boolean} awake
Spriteが初めから物理演算を行うか.

createPhyPolygon(vertexs, type, density, friction, restitution, awake)
多角形の物理シミュレーション用Sprite生成.
Parameters:
{b2Vec2[]} vertexs
多角形の頂点配列
{Boolean} type
静的,動的,キネマティック
{Number} density
Spriteの密度.
{Number} friction
Spriteの摩擦.
{Number} restitution
Spriteの反発.
{Boolean} awake
Spriteが初めから物理演算を行うか.

destroy()
物体の削除 removeChildではなくこちらでSpriteを取り除く

getBody()
bodyの取得 Box2Dの処理を各自行いたい時に取得する

{Boolean} isDynamic()
動的オブジェクトかどうか
Returns:
{Boolean}

{Boolean} isKinematic()
キネマティックオブジェクトかどうか
Returns:
{Boolean}

{Boolean} isStatic()
静的オブジェクトかどうか
Returns:
{Boolean}

setAwake(flag)
物理シミュレーションされていない時、物理シミュレーションを行う(sleep時は動かなくなるので)
Parameters:
{Boolean} flag
物理シミュレーションを行うかどうか

setDegugImage()
デバッグ用のイメージをセット

Documentation generated by JsDoc Toolkit 2.4.0 on Sat Mar 31 2012 19:45:18 GMT+0900 (JST)