C# Class Platformer.Tiles.MoveableTile

A tile that moves in a given direction. Once the tile collides with a solid object, it reverses its direction. Code inspired from: http://robotfootgames.com/2011/05/movable-platforms/
Inheritance: Tile
Show file Open project: zmthy/play-dead Class Usage Examples

Public Methods

Method Description
MoveableTile ( Microsoft.Xna.Framework.Graphics.Sprite sprite, TileCollision collision, Vector2 velocity ) : System

Creates a new Moveable tile.

bindToLevel ( Level level ) : void

Protected Methods

Method Description
getCollidingTile ( ) : Tile

Private Methods

Method Description
getAdjacentCellAtAngle ( Vector2 currentCell, float angleRadians ) : Vector2

Method Details

MoveableTile() public method

Creates a new Moveable tile.
public MoveableTile ( Microsoft.Xna.Framework.Graphics.Sprite sprite, TileCollision collision, Vector2 velocity ) : System
sprite Microsoft.Xna.Framework.Graphics.Sprite Sprite representing texture, size, and position of the tile.
collision TileCollision Type of collision for the tile.
velocity Vector2 Tile velocity: .X is the movement angle in radians and .Y is the speed in pixels per second.
return System

bindToLevel() public method

public bindToLevel ( Level level ) : void
level Platformer.Levels.Level
return void

getCollidingTile() protected method

protected getCollidingTile ( ) : Tile
return Tile