diff options
Diffstat (limited to 'Penguloon/Levels')
| -rw-r--r-- | Penguloon/Levels/IceLevel.cs | 47 | ||||
| -rw-r--r-- | Penguloon/Levels/LevelBase.cs | 52 | ||||
| -rw-r--r-- | Penguloon/Levels/Map.cs | 63 |
3 files changed, 162 insertions, 0 deletions
diff --git a/Penguloon/Levels/IceLevel.cs b/Penguloon/Levels/IceLevel.cs new file mode 100644 index 0000000..984a07f --- /dev/null +++ b/Penguloon/Levels/IceLevel.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework.Input.Touch; +using Penguloon.Scenes; + +namespace Penguloon.Levels +{ + public class IceLevel : LevelBase + { + public IceLevel() : base() + { + this.SplashArt = ContentManager.GetTexture("SplashArt/1"); + } + + public override void DrawUnique(float deltaTime) + { + base.DrawUnique(deltaTime); + } + + public override void UpdateUnique(float deltaTime, TouchLocation[] touchLocations) + { + base.UpdateUnique(deltaTime, touchLocations); + } + + public override void CreateMap() + { + Map = new Map(ParentScene); + + Tile OO = new Tile(0, Direction.None); + Tile DN = new Tile(6, Direction.Down); + + Map.TileMap = new Tile[12, 18] + { + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,DN,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + { OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO,OO }, + }; + } + } +}
\ No newline at end of file diff --git a/Penguloon/Levels/LevelBase.cs b/Penguloon/Levels/LevelBase.cs new file mode 100644 index 0000000..de17caf --- /dev/null +++ b/Penguloon/Levels/LevelBase.cs @@ -0,0 +1,52 @@ +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input.Touch; +using Penguloon.Scenes; + +namespace Penguloon.Levels +{ + public abstract class LevelBase + { + public SceneBase ParentScene { get; set; } + + public Texture2D SplashArt { get; set; } + + public Map Map { get; set; } + + public LevelBase() + { + + } + + public abstract void CreateMap(); + + public virtual void Initialize(SceneBase sceneBase) + { + this.ParentScene = sceneBase; + CreateMap(); + } + + public void Draw(float deltaTime) + { + Map.Draw(deltaTime); + + DrawUnique(deltaTime); + } + + public void Update(float deltaTime, TouchLocation[] touchLocations) + { + Map.Update(deltaTime); + + UpdateUnique(deltaTime, touchLocations); + } + + public virtual void DrawUnique(float deltaTime) + { + + } + + public virtual void UpdateUnique(float deltaTime, TouchLocation[] touchLocations) + { + + } + } +}
\ No newline at end of file diff --git a/Penguloon/Levels/Map.cs b/Penguloon/Levels/Map.cs new file mode 100644 index 0000000..384d011 --- /dev/null +++ b/Penguloon/Levels/Map.cs @@ -0,0 +1,63 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Penguloon.Scenes; + +namespace Penguloon.Levels +{ + public class Map + { + // 18 x 12 + public Tile[,] TileMap { get; set; } + + public int MapWidth { get; private set; } + public int MapHeight { get; private set; } + + public int TileWidth { get; private set; } + public int TileHeight { get; private set; } + + public SceneBase ParentScene { get; set; } + + public Map(SceneBase parentScene) + { + this.ParentScene = parentScene; + + MapWidth = (int)StaticUIValues.ScreenViewport.X - StaticUIValues.IngameUIWidth; + MapHeight = (int)StaticUIValues.ScreenViewport.Y; + + TileWidth = MapWidth / 18; + TileHeight = MapHeight / 12; + } + + public void Draw(float deltaTime) + { + for(int y = 0; y < TileMap.GetLength(0); y++) + { + for (int x = 0; x < TileMap.GetLength(1); x++) + { + Texture2D tileTexture = ContentManager.GetTileTextureByType(TileMap[y, x].Type); + + ParentScene.Main.SpriteBatch.Draw(tileTexture, + destinationRectangle: new Rectangle(x * TileWidth, y * TileHeight, TileWidth, TileHeight)); + } + } + } + + public void Update(float deltaTime) + { + + } + } + + public class Tile + { + public int Type { get; set; } + + public Direction Direction { get; set; } + + public Tile(int type, Direction direction) + { + this.Type = type; + this.Direction = direction; + } + } +}
\ No newline at end of file |
