AddMergedCollisionFromTilesWithProperty

Introduction AddMergedCollisionFromTilesWithProperty  adds rectangles to the calling TileShapeCollection  for all tiles in the first argument (LayeredTileMap). Rather than creating individual rectangles for each tile, the rectangles will be merged – all adjacent rectangles in either a row or column will be combined into one to reduce memory consumption and to speed up collision calls. Merging will[…]

AddCollisionFromTilesWithProperty

Introduction AddCollisionFromTilesWithProperty adds rectangles to the calling TileShapeCollection for all tiles which have the argument custom property. This is the most common way to create collisions from a TMX file in code. Code Example

Additional Information For more control over which tiles create collisions (for example checking a property and its value), see the[…]

TileShapeCollections in Levels

Introduction Typically tile-based games with multiple levels will use one LayeredTileMap (TMX) per level. In this case the base screen (typically called GameScreen) should contain most (if not all) of the logic and collision objects. Creating a Map Object For this example we will begin with three screens: GameScreen (the base screen for level screens)[…]

TileEntityInstantiator

Introduction The TileEntityInstantiator class simplifies the creation of entities through Tiled. It is the most common way to add entities to your game. Defining an Entity for Instantiation Before adding an entity to your screen, you must first define an entity. Fortunately any entity can be created through Tiled, so we won’t go through the steps[…]

CollisionRelationship

Introduction Glue supports the creation and management of CollisionRelationship objects. This document covers the features provided by Glue, and explains common scenarios where you may need to interact with the CollisionsRelationships in code. For information about creating and working with CollisionRelationships in code, see the CollisionManager page. What is a CollisionRelationship? CollisionRelationships are objects which indicate[…]

AddMergedCollisionFromLayer

Introduction AddMergedCollisionFromLayer adds rectangles to the calling TileShapeCollection for all layers in the argument layer which have properties matching the predicate. Rather than creating individual rectangles for each tile, the created rectangles will be merged – all adjacent rectangles in either a row or column will be combined into one to reduce memory consumption and to[…]

CollisionManager

Introduction The CollisionManager class provides methods for handling collision (the touching of game objects) in FlatRedBall games. The CollisionManager has built-in methods for handling collision between collidable entities (entities which implement the ICollidable interface). Use of the CollisionManager is not necessary, but it can reduce and standardize code for handling collisions. Collision Relationships The CollisionManager is[…]

RemoveSurroundedCollision

Introduction RemoveSurroundedCollision  removes all rectangles which are surrounded by other collisions on all four sides. Calling this method removes the “inside” of solid collision areas, resulting in only the outline tiles being preserved. This method can be used to reduce the number of collision objects to improve runtime performance and reduce memory usage. This method[…]

AddCollisionFrom

Introduction The AddCollisionFrom method can be used to add AxisAlignedRectangle instances to the TileShapeCollection from a tile map (MapDrawableBatch). Code Examples AddCollisionFrom provides lots of flexibility for adding collision. The simplest form is to add collision from a tile by the tile name. The following code adds collision for all tiles named “CollisionTile”:

Using[…]

Tile Adventure

Introduction The Tile Adventure starter project provides a working example of using the Tiled plugin to create a multi-level top-down game. Much of the game’s data is defined in the tiled levels that are added to the GameSceen. The Tiled Plugin must be installed to open this project. To install this plugin, visit the Tiled[…]