Familiar territory. Sprite_Enemy keeps the RPG Maker MZ API, so existing MZ knowledge, tutorials and plugin code apply. Reactor's additions are marked with descriptions below.
Quick Reference
Setup & Creation 8
| initialize() | Sets up a new instance. |
| initMembers() | Initializes the members. |
| createStateIconSprite() | Creates the state icon sprite. |
| loadBitmap() | Loads the bitmap. |
| initVisibility() | Initializes the visibility. |
| setupEffect() | Setup effect. |
| createFragmentCollapse() | The battler cut into triangles that fly apart: glass, not grit. |
| createParticleCollapse() | Creates the particle collapse. |
Checks (True / False) 2
| isEffecting() | Whether it is effecting. |
| isParticleCollapseCellVisible() | Whether it is particle collapse cell visible. |
Actions 14
| setBattler() | Sets the battler. |
| setHue() | Sets the hue. |
| startEffect() | Starts the effect. |
| startAppear() | Starts the appear. |
| startDisappear() | Starts the disappear. |
| startWhiten() | Starts the whiten. |
| startBlink() | Starts the blink. |
| startCollapse() | Starts the collapse. |
| startBossCollapse() | Starts the boss collapse. |
| startInstantCollapse() | Starts the instant collapse. |
| startCorpseCollapse() | Starts the corpse collapse. |
| startCorpseRise() | Starts the corpse rise. |
| startParticleCollapse() | Starts the particle collapse. |
| destroyParticleCollapse() | Destroy particle collapse. |
Events, Commands & Input 1
| emitParticleCollapseSpark() | Emit particle collapse spark. |
Updating & Drawing 18
| update() | Update. |
| updateBitmap() | Updates the bitmap each frame. |
| updateFrame() | Updates the frame each frame. |
| updatePosition() | Updates the position each frame. |
| updateStateSprite() | Updates the state sprite each frame. |
| updateEffect() | Updates the effect each frame. |
| updateWhiten() | Updates the whiten each frame. |
| updateBlink() | Updates the blink each frame. |
| updateAppear() | Updates the appear each frame. |
| updateDisappear() | Updates the disappear each frame. |
| updateCollapse() | Updates the collapse each frame. |
| updateBossCollapse() | Updates the boss collapse each frame. |
| updateInstantCollapse() | Updates the instant collapse each frame. |
| updateCorpseCollapse() | Updates the corpse collapse each frame. |
| updateCorpseRise() | Updates the corpse rise each frame. |
| updateFragmentCollapse() | Move every triangle: thrown out from the middle, turning about its own, falling, and stopped by the floor the… |
| updateParticleCollapse() | Updates the particle collapse each frame. |
| updateParticleCollapseSparks() | Updates the particle collapse sparks each frame. |
Other 11
| revertToNormal() | Revert to normal. |
| layCorpse() | Lays the sprite amount of the way down: 0 standing, 1 flat. |
| particleCollapseArtSprite() | The descendant that actually carries the battler art. |
| particleCollapseArtOffset() | Where the art sprite sits in this sprite's own coordinates, so the particles can stand in for it exactly howe… |
| particleCollapseAlphaMap() | Per-pixel alpha for a texture source, cached on the source itself. |
| particleCollapseSparkTexture() | The soft blob a spark is drawn with, built once per distinct gradient. |
| blendParticleCollapseTint() | Blend particle collapse tint. |
| particleCollapseRoll() | Reads a [min, max] preset range, tolerating a missing or malformed one. |
| unhookParticleCollapseTextures() | Unhooks a collapse's shard textures from the shared battler source at once. |
| damageOffsetX() | Damage offset x. |
| damageOffsetY() | Damage offset y. |
Setup & Creation
initialize
method sourceSprite_Enemy.prototype.initialize(battler)
Sets up a new instance. (Same as the RPG Maker MZ method of this name.)
initMembers
method sourceSprite_Enemy.prototype.initMembers()
Initializes the members. (Same as the RPG Maker MZ method of this name.)
createStateIconSprite
method sourceSprite_Enemy.prototype.createStateIconSprite()
Creates the state icon sprite. (Same as the RPG Maker MZ method of this name.)
loadBitmap
method sourceSprite_Enemy.prototype.loadBitmap(name)
Loads the bitmap. (Same as the RPG Maker MZ method of this name.)
initVisibility
method sourceSprite_Enemy.prototype.initVisibility()
Initializes the visibility. (Same as the RPG Maker MZ method of this name.)
setupEffect
method sourceSprite_Enemy.prototype.setupEffect()
Setup effect. (Same as the RPG Maker MZ method of this name.)
createFragmentCollapse
method sourceSprite_Enemy.prototype.createFragmentCollapse(preset)
The battler cut into triangles that fly apart: glass, not grit.
Details
The battler cut into triangles that fly apart: glass, not grit.
A particle is a quad however small it is cut, so a break made of them reads as chunks. Real shards need real polygons, so this path builds one PIXI.Mesh whose triangles are cut from the battler's own frame -- a jittered grid, each cell split on a random diagonal, so no two pieces are the same shape -- and moves their corners itself each frame. One mesh is one draw call, and a few hundred triangles cost less arithmetic per frame than the particle path.
createParticleCollapse
method sourceSprite_Enemy.prototype.createParticleCollapse(preset)
Creates the particle collapse. (Same as the RPG Maker MZ method of this name.)
Checks (True / False)
isEffecting
method sourceSprite_Enemy.prototype.isEffecting()
Whether it is effecting. (Same as the RPG Maker MZ method of this name.)
isParticleCollapseCellVisible
method sourceSprite_Enemy.prototype.isParticleCollapseCellVisible(map, width, x, y, w, h)
Whether it is particle collapse cell visible. (Same as the RPG Maker MZ method of this name.)
Actions
setBattler
method sourceSprite_Enemy.prototype.setBattler(battler)
Sets the battler. (Same as the RPG Maker MZ method of this name.)
setHue
method sourceSprite_Enemy.prototype.setHue(hue)
Sets the hue. (Same as the RPG Maker MZ method of this name.)
startEffect
method sourceSprite_Enemy.prototype.startEffect(effectType)
Starts the effect. (Same as the RPG Maker MZ method of this name.)
startAppear
method sourceSprite_Enemy.prototype.startAppear()
Starts the appear. (Same as the RPG Maker MZ method of this name.)
startDisappear
method sourceSprite_Enemy.prototype.startDisappear()
Starts the disappear. (Same as the RPG Maker MZ method of this name.)
startWhiten
method sourceSprite_Enemy.prototype.startWhiten()
Starts the whiten. (Same as the RPG Maker MZ method of this name.)
startBlink
method sourceSprite_Enemy.prototype.startBlink()
Starts the blink. (Same as the RPG Maker MZ method of this name.)
startCollapse
method sourceSprite_Enemy.prototype.startCollapse()
Starts the collapse. (Same as the RPG Maker MZ method of this name.)
startBossCollapse
method sourceSprite_Enemy.prototype.startBossCollapse()
Starts the boss collapse. (Same as the RPG Maker MZ method of this name.)
startInstantCollapse
method sourceSprite_Enemy.prototype.startInstantCollapse()
Starts the instant collapse. (Same as the RPG Maker MZ method of this name.)
startCorpseCollapse
method sourceSprite_Enemy.prototype.startCorpseCollapse()
Starts the corpse collapse. (Same as the RPG Maker MZ method of this name.)
startCorpseRise
method sourceSprite_Enemy.prototype.startCorpseRise()
Starts the corpse rise. (Same as the RPG Maker MZ method of this name.)
startParticleCollapse
method sourceSprite_Enemy.prototype.startParticleCollapse(presetName)
Starts the particle collapse. (Same as the RPG Maker MZ method of this name.)
destroyParticleCollapse
method sourceSprite_Enemy.prototype.destroyParticleCollapse()
Destroy particle collapse. (Same as the RPG Maker MZ method of this name.)
Events, Commands & Input
emitParticleCollapseSpark
method sourceSprite_Enemy.prototype.emitParticleCollapseSpark(state, x, y)
Emit particle collapse spark. (Same as the RPG Maker MZ method of this name.)
Updating & Drawing
update
method sourceSprite_Enemy.prototype.update()
Update. (Same as the RPG Maker MZ method of this name.)
updateBitmap
method sourceSprite_Enemy.prototype.updateBitmap()
Updates the bitmap each frame. (Same as the RPG Maker MZ method of this name.)
updateFrame
method sourceSprite_Enemy.prototype.updateFrame()
Updates the frame each frame. (Same as the RPG Maker MZ method of this name.)
updatePosition
method sourceSprite_Enemy.prototype.updatePosition()
Updates the position each frame. (Same as the RPG Maker MZ method of this name.)
updateStateSprite
method sourceSprite_Enemy.prototype.updateStateSprite()
Updates the state sprite each frame. (Same as the RPG Maker MZ method of this name.)
updateEffect
method sourceSprite_Enemy.prototype.updateEffect()
Updates the effect each frame. (Same as the RPG Maker MZ method of this name.)
updateWhiten
method sourceSprite_Enemy.prototype.updateWhiten()
Updates the whiten each frame. (Same as the RPG Maker MZ method of this name.)
updateBlink
method sourceSprite_Enemy.prototype.updateBlink()
Updates the blink each frame. (Same as the RPG Maker MZ method of this name.)
updateAppear
method sourceSprite_Enemy.prototype.updateAppear()
Updates the appear each frame. (Same as the RPG Maker MZ method of this name.)
updateDisappear
method sourceSprite_Enemy.prototype.updateDisappear()
Updates the disappear each frame. (Same as the RPG Maker MZ method of this name.)
updateCollapse
method sourceSprite_Enemy.prototype.updateCollapse()
Updates the collapse each frame. (Same as the RPG Maker MZ method of this name.)
updateBossCollapse
method sourceSprite_Enemy.prototype.updateBossCollapse()
Updates the boss collapse each frame. (Same as the RPG Maker MZ method of this name.)
updateInstantCollapse
method sourceSprite_Enemy.prototype.updateInstantCollapse()
Updates the instant collapse each frame. (Same as the RPG Maker MZ method of this name.)
updateCorpseCollapse
method sourceSprite_Enemy.prototype.updateCorpseCollapse()
Updates the corpse collapse each frame. (Same as the RPG Maker MZ method of this name.)
updateCorpseRise
method sourceSprite_Enemy.prototype.updateCorpseRise()
Updates the corpse rise each frame. (Same as the RPG Maker MZ method of this name.)
updateFragmentCollapse
method sourceSprite_Enemy.prototype.updateFragmentCollapse(state, elapsed)
Move every triangle: thrown out from the middle, turning about its own, falling, and stopped by the floor the battler stood on.
Details
Move every triangle: thrown out from the middle, turning about its own, falling, and stopped by the floor the battler stood on.
updateParticleCollapse
method sourceSprite_Enemy.prototype.updateParticleCollapse()
Updates the particle collapse each frame. (Same as the RPG Maker MZ method of this name.)
updateParticleCollapseSparks
method sourceSprite_Enemy.prototype.updateParticleCollapseSparks(state)
Updates the particle collapse sparks each frame. (Same as the RPG Maker MZ method of this name.)
Other
revertToNormal
method sourceSprite_Enemy.prototype.revertToNormal()
Revert to normal. (Same as the RPG Maker MZ method of this name.)
layCorpse
method sourceSprite_Enemy.prototype.layCorpse(amount)
Lays the sprite amount of the way down: 0 standing, 1 flat.
particleCollapseArtSprite
method sourceSprite_Enemy.prototype.particleCollapseArtSprite()
The descendant that actually carries the battler art.
Details
The descendant that actually carries the battler art.
mainSprite() is not it, whatever its name suggests: VisuStella's Battle Core parents the art under a distortion sprite and returns THAT, so mainSprite() itself holds no bitmap and a collapse reading it would fall back for every enemy in any project running Battle Core. In a stock project mainSprite() is this sprite, and does hold one.
particleCollapseArtOffset
method sourceSprite_Enemy.prototype.particleCollapseArtOffset(art)
Where the art sprite sits in this sprite's own coordinates, so the particles can stand in for it exactly however deeply Battle Core has nested it.
Details
Where the art sprite sits in this sprite's own coordinates, so the particles can stand in for it exactly however deeply Battle Core has nested it.
particleCollapseAlphaMap
method sourceSprite_Enemy.prototype.particleCollapseAlphaMap(source, width, height)
Per-pixel alpha for a texture source, cached on the source itself.
Details
Per-pixel alpha for a texture source, cached on the source itself.
Read through the source's own resource rather than Bitmap#context: the context getter calls _ensureCanvas(), which on an image-backed bitmap builds a canvas AND replaces the bitmap's base texture, re-uploading a cached, shared battler image as a side effect of somebody dying.
particleCollapseSparkTexture
static sourceSprite_Enemy.particleCollapseSparkTexture(stops)
The soft blob a spark is drawn with, built once per distinct gradient.
Details
The soft blob a spark is drawn with, built once per distinct gradient.
Cached by the stops themselves rather than by preset name, so two presets sharing a gradient share one texture and a tuned preset gets its own. The bitmaps are held on the class because each texture only borrows its source.
blendParticleCollapseTint
static sourceSprite_Enemy.blendParticleCollapseTint(from, to, rate)
Blend particle collapse tint. (Same as the RPG Maker MZ method of this name.)
particleCollapseRoll
static sourceSprite_Enemy.particleCollapseRoll(range, min, max)
Reads a [min, max] preset range, tolerating a missing or malformed one.
Details
Reads a [min, max] preset range, tolerating a missing or malformed one.
unhookParticleCollapseTextures
method sourceSprite_Enemy.prototype.unhookParticleCollapseTextures(shards)
Unhooks a collapse's shard textures from the shared battler source at once.
Details
Unhooks a collapse's shard textures from the shared battler source at once.
Every v8 Texture listens for its source's "resize", and EventEmitter3 removes a listener by rescanning and rebuilding the whole listener array -- so dropping the shards one at a time is quadratic in shard count, and it all lands on the single frame the collapse ends. Measured on this PIXI build with a 370x435 battler: 6,305 shards cost 51.0 ms that way and 11,049 cost 146.8 ms. Filtering them out in one pass is linear -- 0.5 ms and 0.6 ms for the same two grids -- and leaves the source holding exactly the same listeners afterwards.
The listeners that stay -- this battler's own sprite, and any other enemy of the same kind collapsing beside it -- are handed back for the caller to put right rather than written straight back, because Texture.destroy() still calls off("resize") once per shard and EventEmitter3 rebuilds that array on every one of those calls. An empty array left in their place costs one rebuild of nothing, after which the event is gone and each remaining off() returns at its first line. Six 350x299 Dragons at 8,400 shards each cost 3,025 ms between them with the survivors in place, and 17.7 ms with them held aside.
This reaches into EventEmitter3's own storage, so each shape it can hold is checked and an unfamiliar one just leaves the per-texture path to do its job.
damageOffsetX
method sourceSprite_Enemy.prototype.damageOffsetX()
Damage offset x. (Same as the RPG Maker MZ method of this name.)
damageOffsetY
method sourceSprite_Enemy.prototype.damageOffsetY()
Damage offset y. (Same as the RPG Maker MZ method of this name.)