TileLayer

Description

Holds all background images in a list. Organizes the list based on the depth of the background image. Renders images based on list and then moves them based on speed. All Tiles in a list are tilable to eachother. When the image goes off screen, it goes to the back of the list.

Relationships

Members

  • List<Tile> tiles - array that holds objects of class Tile
  • float depth - How far back in the order is this texture
  • float scrollingSpeed - How fast is this texture going? (negative number is left, positive is right, zero is stationary)
  • int iter - looping iterator
  • Vector2 startingPosition - the bottom-left position on the screen of the layer.
  • Vector2 endPosition - the bottom-right position on the screen of the layer.

Methods

  • TileLayer()
    • sets the default for all the attributes
  • Update(GameTime gameTime)
    • updates the Tiles in the Tile list, checks their position if they have gone off the layer, if off the layer they put them to the back on the other side of the layer
  • Draw(SpriteBatch spriteBatch)
    • draws each of the tiles
  • AddTile(Texture2D texture, bool isBlankTile)
    • adds a new tile to the array
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License