Documentation ¶
Overview ¶
Package tilecollide provides collision detection for rectangles and 2D tilemaps.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collider ¶ added in v1.4.0
type Collider[T Integer] struct { Collisions []CollisionInfo[T] // List of collisions from last check TileSize [2]int // Width and height of tiles TileMap [][]T // 2D grid of tile IDs NonSolidTileID T // Sets the ID of non-solid tiles. Defaults to 0. }
Collider handles collision detection between rectangles and a 2D tilemap
func NewCollider ¶ added in v1.4.0
NewCollider creates a new tile collider with the given tilemap and tile dimensions
type CollisionCallback ¶ added in v1.1.0
type CollisionCallback[T Integer] func([]CollisionInfo[T], float64, float64)
CollisionCallback is called when collisions occur, receiving collision info and final movement
type CollisionInfo ¶ added in v1.1.0
type CollisionInfo[T Integer] struct { TileID T // ID of the collided tile TileCoords [2]int // X,Y coordinates of the tile in the tilemap Normal [2]int // Normal vector of the collision (-1/0/1) }
CollisionInfo stores information about a collision with a tile
type Integer ¶
type Integer = constraints.Integer
Integer is a constraint that matches any integer type.
Click to show internal directories.
Click to hide internal directories.