Solid

class Solid(source)

Something a particle cannot enter: a rectangle with the given edges (y grows down) filled as shape says. A tile's solid knows its grid cell, so the grid can tell which faces are buried against a neighbour; a moving one has none. Make a tile's solid with SolidGrid.fill.

toString gives its shape, edges and cell, for example Solid(BOX, left=16.0, top=32.0, right=32.0, bottom=48.0, column=1, row=2).

Types

Link copied to clipboard
object Companion

Builds solids that move.

Properties

Link copied to clipboard

Its box: the bottom edge. A moving solid's moves.

Link copied to clipboard
val column: Int

The tile's column in its grid, or -1 for a moving solid.

Link copied to clipboard

true if this solid moves, such as a crusher, rather than filling a grid cell. It has no neighbours to bury its faces against.

Link copied to clipboard
val left: Float

Its box: the left edge.

Link copied to clipboard

How it grips and bounces what touches it.

Link copied to clipboard

Its box: the right edge.

Link copied to clipboard
val row: Int

The tile's row in its grid, or -1 for a moving solid.

Link copied to clipboard

Which part of its box is solid: all of it, or a slope.

Link copied to clipboard

Tags the game gives this solid, such as "bounce pad", reported by Events.floorTagsOf when a particle stands on it.

Link copied to clipboard
var top: Float

Its box: the top edge. A moving solid's moves.

Functions

Link copied to clipboard
fun contains(x: Float, y: Float, margin: Float = 0.0f): Boolean

Returns true if the point (x, y) is inside this solid by more than margin units, measured straight out of the nearest face (the slope's own surface, for a slope). A point on the surface is outside. This is the one place that decides what "inside" means: collision and SolidGrid.isSolidAt both ask it.

Link copied to clipboard
open override fun toString(): String