DrawableGridWalls
Extends: BGE.DrawableWalls
The walls of a grid maze: a BGE.DrawableWalls whose segments come from the map (GridWallsMap.toSegments()), one per straight run of a texture, facing the open cells. Needs a Camera3d; one walls drawable per renderer.
isShaded lights the walls; color/alpha tint them, and flash() works as for other drawables.
Properties
map(BGE.GridWallsMap) — The grid whose solid cells are drawn as walls. Replace it with setMap(), or call setMap()
Constructor
new DrawableGridWalls(
owner: BGE.GameEntity,
map: BGE.GridWallsMap,
textures: roAssociativeArray,
args?: roAssociativeArray,
): DrawableGridWallsParameters
owner(BGE.GameEntity)map(BGE.GridWallsMap)textures(roAssociativeArray) — texture name (as used in the map's legend) to anroRegionone cell wide and the wall height tallargs(roAssociativeArray, optional, default: "{}") — Drawable fields, e.g.{isShaded: true};hideTolerancedefaults to a quarter cell
Instance Methods
setMap(map: BGE.GridWallsMap): void
Sets the grid and rebuilds the walls (and their BSP) from it. setSegments() can still replace them with others until the next setMap().
Parameters
map(BGE.GridWallsMap)
Returns
void
setSegments(segments: Array.<BGE.WallSegment>): void
Inherited from BGE.DrawableWalls#setSegments
Overrides: BGE.DrawableWalls#setSegments
Replaces the walls and builds their BSP now. That takes a while for thousands of walls, so set them while loading rather than mid-game where you can.
Parameters
segments(Array.<BGE.WallSegment>)
Returns
void
getBsp(): BGE.WallsBsp
Inherited from BGE.DrawableWalls#getBsp
Overrides: BGE.DrawableWalls#getBsp
The BSP for the current segments, rebuilt here only if segments was reassigned to a different count without setSegments() (stale part indices would read past the end).
Returns
setTextures(textures: roAssociativeArray): void
Inherited from BGE.DrawableWalls#setTextures
Overrides: BGE.DrawableWalls#setTextures
Replaces the wall textures.
Parameters
textures(roAssociativeArray) — texture name toroRegion
Returns
void
getColumns(name: string, tileCount: integer): dynamic
Inherited from BGE.DrawableWalls#getColumns
Overrides: BGE.DrawableWalls#getColumns
A texture's 1px-wide column regions, left to right, tileCount copies tall and pre-translated so the foot is at the draw point. Invalid if there's no such texture.
Parameters
name(string) — texture nametileCount(integer) — copies stacked up the wall
Returns
dynamic— roRegion[] or invalid
getMipColumns(name: string, tileCount: integer): dynamic
Inherited from BGE.DrawableWalls#getMipColumns
Overrides: BGE.DrawableWalls#getMipColumns
A texture's columns at each mip level: level 0 is getColumns(), and each level after has half as many (rounded up), each the average of two from the level before, as tall as level 0 and pre-translated the same. Down to one column, or level 0 alone when mipmapped is off. Invalid if there's no such texture.
Parameters
name(string) — texture nametileCount(integer) — copies stacked up the wall
Returns
dynamic— roRegion[][] or invalid
addToRenderer(rendererObj: Renderer): BGE.SceneObject
Inherited from BGE.DrawableWalls#addToRenderer
Registers this Drawable with a Renderer, so it gets drawn each frame. The engine calls this for you when a drawable is added to an entity; call it yourself only for a standalone drawable. Subclasses override it to create their SceneObject.
Parameters
rendererObj(Renderer)
Returns
getSceneObjects(): Array.<BGE.SceneObject>
Inherited from BGE.Drawable#getSceneObjects
Overrides: BGE.DrawableWalls#getSceneObjects
Every SceneObject this Drawable currently represents - usually one (a Drawable added to just the game canvas), but can be more than one if the same Drawable instance was also added to a second renderer (e.g. the UI canvas). Useful for consumer code that needs to identify "my own" SceneObject out of a list the renderer hands back (e.g. Renderer.getOverlapClusters()) - comparing two custom class instances directly with = is not supported by BrightScript at runtime (a "Type Mismatch" error, regardless of any as-cast at the BrighterScript type- checker level, which only affects compile-time typing, not the underlying VM operator), so compare SceneObject.id (a string) instead.
Returns
Array.<BGE.SceneObject>
removeFromRenderer(renderer: Renderer): void
Inherited from BGE.Drawable#removeFromRenderer
Overrides: BGE.DrawableWalls#removeFromRenderer
Unregisters every SceneObject this Drawable added to the given Renderer, so it stops being drawn. The engine calls this for you when a drawable is removed from an entity or the entity is destroyed.
Parameters
renderer(Renderer) — The renderer to remove this Drawable from
Returns
void
computeTransformationMatrix(): void
Inherited from BGE.Drawable#computeTransformationMatrix
Overrides: BGE.DrawableWalls#computeTransformationMatrix
Returns
void
hasPendingTransformChange(): boolean
Inherited from BGE.Drawable#hasPendingTransformChange
Overrides: BGE.DrawableWalls#hasPendingTransformChange
Whether offset/rotation/scale changed since the transform was last computed. Read-only (doesn't touch the MotionChecker), so every renderer this drawable is registered with sees the same answer.
Returns
boolean
invalidateGeometry(): void
Inherited from BGE.Drawable#invalidateGeometry
Overrides: BGE.DrawableWalls#invalidateGeometry
Marks this drawable's geometry as changed, so the renderer recomputes its world and canvas geometry on the next frame. Movement is dirty-checked automatically (see MotionChecker), but a change in shape - resizing a rectangle, replacing a polygon's points - isn't visible to that check and has to be declared.
Returns
void
getAnchor(): BGE.Math.Vector
Inherited from BGE.Drawable#getAnchor
Overrides: BGE.DrawableWalls#getAnchor
Returns
BGE.Math.Vector
setAnchor(x: float, y: float): void
Inherited from BGE.Drawable#setAnchor
Overrides: BGE.DrawableWalls#setAnchor
Sets the normalized anchor point this drawable pivots around. (0,0) is top left (the default), (0.5, 1) is bottom-center, etc. This isn't movement, so it can't be picked up by the per-frame MotionChecker dirty-check - invalidateGeometry() tells the renderer to recompute this drawable's projected geometry even though nothing moved.
Parameters
x(float)y(float)
Returns
void
movedLastFrame(includeOwner?: boolean): boolean
Inherited from BGE.Drawable#movedLastFrame
Overrides: BGE.DrawableWalls#movedLastFrame
Parameters
includeOwner(boolean, optional, default: false)
Returns
boolean
update(): void
Inherited from BGE.Drawable#update
Overrides: BGE.DrawableWalls#update
Returns
void
onResume(pausedTimeMs: integer): void
Inherited from BGE.Drawable#onResume
Overrides: BGE.DrawableWalls#onResume
Parameters
pausedTimeMs(integer)
Returns
void
isEnabled(): boolean
Inherited from BGE.Drawable#isEnabled
Overrides: BGE.DrawableWalls#isEnabled
Returns
boolean
getGame(): BGE.Game
Inherited from BGE.Drawable#getGame
Overrides: BGE.DrawableWalls#getGame
The Game this drawable's owner belongs to.
Returns
BGE.Game— the owner's Game, or invalid if this drawable has no owner (or its owner has no Game)
warnOccluderNeedsStaticOwner(): void
Inherited from BGE.Drawable#warnOccluderNeedsStaticOwner
Overrides: BGE.DrawableWalls#warnOccluderNeedsStaticOwner
Logs once per drawable that isOccluder was ignored because its owner isn't static.
Returns
void
log(message: string, level?: BGE.Debug.LogLevel): void
Inherited from BGE.Drawable#log
Overrides: BGE.DrawableWalls#log
Logs a message through the owner's Game. Does nothing if there is no Game to log to.
Parameters
message(string)level(BGE.Debug.LogLevel, optional, default: "BGE.Debug.LogLevel.info")
Returns
void
getOwnerTransformationMatrix(): Array.<Array.<float>>
Inherited from BGE.Drawable#getOwnerTransformationMatrix
Overrides: BGE.DrawableWalls#getOwnerTransformationMatrix
The owner's transformation matrix, or the identity matrix if this drawable has no owner.
Returns
Array.<Array.<float>>
getOwnerPosition(): BGE.Math.Vector
Inherited from BGE.Drawable#getOwnerPosition
Overrides: BGE.DrawableWalls#getOwnerPosition
The owner's position, or the world origin if this drawable has no owner.
Returns
BGE.Math.Vector
getOwnerRotation(): BGE.Math.Vector
Inherited from BGE.Drawable#getOwnerRotation
Overrides: BGE.DrawableWalls#getOwnerRotation
The owner's rotation, or no rotation if this drawable has no owner.
Returns
BGE.Math.Vector
getOwnerScale(): BGE.Math.Vector
Inherited from BGE.Drawable#getOwnerScale
Overrides: BGE.DrawableWalls#getOwnerScale
The owner's scale, or a scale of 1 on every axis if this drawable has no owner.
Returns
BGE.Math.Vector
getSize(): SizeWH
Inherited from BGE.Drawable#getSize
Overrides: BGE.DrawableWalls#getSize
Returns
getDrawnSize(): SizeWH
Inherited from BGE.Drawable#getDrawnSize
Overrides: BGE.DrawableWalls#getDrawnSize
Returns
getWorldPosition(): BGE.Math.Vector
Inherited from BGE.Drawable#getWorldPosition
Overrides: BGE.DrawableWalls#getWorldPosition
Returns
BGE.Math.Vector
getPretranslation(): BGE.Math.Vector
Inherited from BGE.Drawable#getPretranslation
Overrides: BGE.DrawableWalls#getPretranslation
Returns
BGE.Math.Vector
getFillColorRGBA(ignoreColor?: boolean): integer
Inherited from BGE.Drawable#getFillColorRGBA
Overrides: BGE.DrawableWalls#getFillColorRGBA
Parameters
ignoreColor(boolean, optional, default: false)
Returns
integer
flash(
color: integer,
seconds: float,
blinkSeconds?: float,
alpha?: float,
): void
Inherited from BGE.Drawable#flash
Overrides: BGE.DrawableWalls#flash
Tints this drawable with color (RGB, like color), and/or fades it by alpha, for seconds, then goes back to its own look. color and alpha themselves are never touched, so they can keep changing during the flash and are what show afterwards. Flashing again restarts the flash.
The owning entity's flashes tick with the game, just before its onUpdate(), and pause with it. A drawable with no owner must call tickFlash() itself.
Parameters
color(integer) — RGB flash color, e.g. &hFF5050, or -1 to keep its own (see flashAlpha())seconds(float) — how long the flash lastsblinkSeconds(float, optional, default: "0.0") — if above 0, alternates between the flash and the drawable's own look this oftenalpha(float, optional, default: "-1.0") — 0-255, scales its ownalphaduring the flash (255 / -1 keep it as is)
Returns
void
flashAlpha(
alpha: float,
seconds: float,
blinkSeconds?: float,
): void
Inherited from BGE.Drawable#flashAlpha
Overrides: BGE.DrawableWalls#flashAlpha
Fades this drawable by alpha (scaling its own) for seconds, keeping its color - with blinkSeconds, a flicker such as a hit's invulnerability. Shares flash()'s state, so one replaces the other.
Parameters
alpha(float) — 0-255: 60 draws an opaque drawable at 60, a half-faded one at 30seconds(float) — how long it lastsblinkSeconds(float, optional, default: "0.0") — if above 0, alternates betweenalphaand its own alpha this often
Returns
void
stopFlash(): void
Inherited from BGE.Drawable#stopFlash
Overrides: BGE.DrawableWalls#stopFlash
Ends any flash now.
Returns
void
isFlashing(): boolean
Inherited from BGE.Drawable#isFlashing
Overrides: BGE.DrawableWalls#isFlashing
Whether a flash() is still running.
Returns
boolean
tickFlash(dt: float): boolean
Inherited from BGE.Drawable#tickFlash
Overrides: BGE.DrawableWalls#tickFlash
Advances a running flash. The engine calls this for drawables on an entity.
Parameters
dt(float) — seconds
Returns
boolean— true while the flash is still running
getDisplayColor(): integer
Inherited from BGE.Drawable#getDisplayColor
Overrides: BGE.DrawableWalls#getDisplayColor
The RGB color drawn this frame: the flash color while flashing (and on a blink's "on" phase), otherwise color.
Returns
integer
getDisplayAlpha(): float
Inherited from BGE.Drawable#getDisplayAlpha
Overrides: BGE.DrawableWalls#getDisplayAlpha
The alpha drawn this frame: alpha, scaled by a flash's alpha while it shows.
Returns
float
getOutlineColorRGBA(ignoreColor?: boolean): integer
Inherited from BGE.Drawable#getOutlineColorRGBA
Overrides: BGE.DrawableWalls#getOutlineColorRGBA
Parameters
ignoreColor(boolean, optional, default: false)
Returns
integer
hasOutline(): boolean
Inherited from BGE.Drawable#hasOutline
Overrides: BGE.DrawableWalls#hasOutline
Whether this drawable should be stroked with an outline, which is the case once outlineRGBA has been given a color. Setting outlineRGBA is what turns outline drawing on - there is no separate flag - so this is the check the renderer uses to skip all outline work for the (common) drawables that don't want one.
Returns
boolean— true if an outline should be drawn for this drawable
getSceneObjectName(extraBit?: string): string
Inherited from BGE.Drawable#getSceneObjectName
Overrides: BGE.DrawableWalls#getSceneObjectName
Parameters
extraBit(string, optional, default: "\"\"")
Returns
string
addSceneObjectToRenderer(
sceneObj: SceneObject,
renderer: Renderer,
): SceneObject
Inherited from BGE.Drawable#addSceneObjectToRenderer
Overrides: BGE.DrawableWalls#addSceneObjectToRenderer
Parameters
sceneObj(SceneObject)renderer(Renderer)
Returns
drawRegionToCanvas(
region: ifDraw2d,
additionalRotation?: BGE.Math.Vector,
ignoreColor?: boolean,
drawTo?: ifDraw2D,
): void
Inherited from BGE.Drawable#drawRegionToCanvas
Overrides: BGE.DrawableWalls#drawRegionToCanvas
Parameters
region(ifDraw2d)additionalRotation(BGE.Math.Vector, optional, default: "invalid")ignoreColor(boolean, optional, default: false)drawTo(ifDraw2D, optional, default: "invalid")
Returns
void
forEachSceneObject(
operation: function,
context: roAssociativeArray,
): void
Inherited from BGE.Drawable#forEachSceneObject
Overrides: BGE.DrawableWalls#forEachSceneObject
Parameters
operation(function)context(roAssociativeArray)
Returns
void
getVisibility(): BGE.VisibilityState
Inherited from BGE.Drawable#getVisibility
Overrides: BGE.DrawableWalls#getVisibility
The most visible state among this drawable's scene objects, in the order visible > occluded > offCamera > unknown, as of the last frame. unknown before it has been added to a renderer. See GameEntity.getVisibility().
Returns
addToRenderer(rendererObj: Renderer): BGE.SceneObject
Inherited from BGE.DrawableWalls#addToRenderer
Registers this Drawable with a Renderer, so it gets drawn each frame. The engine calls this for you when a drawable is added to an entity; call it yourself only for a standalone drawable. Subclasses override it to create their SceneObject.
Parameters
rendererObj(Renderer)
Returns