public HauntedHouse() { // Setup the graphics device manager with some default settings this.graphics = new GraphicsDeviceManager(this); this.graphics.PreferredBackBufferWidth = 1280; this.graphics.PreferredBackBufferHeight = 720; //this.graphics.ToggleFullScreen(); screenDebuger = new ScreenDebuger(); // Allow the window to be resized (to demonstrate render target recreation) this.Window.AllowUserResizing = true; // Setup the content manager with some default settings this.Content.RootDirectory = "Content"; // Create Krypton this.krypton = new KryptonEngine(this, "KryptonEffect"); this.ambiantLight = new KryptonEngine(this, "KryptonEffect"); }
public void Intialise(List<Platform> platforms,List<Sprite> sprites,KryptonEngine krypton,ContentManager content,GraphicsDevice graphicsDevice, ScreenDebuger screenDebuger, Level level) { if (EntityType == "Player") { Texture2D playerImage = content.Load<Texture2D>("player"); Sprite testSprite = new Sprite(playerImage, new Vector2(0,0), false, krypton); Player aPlayer = new Player(new Vector2(EntityBounds.X, EntityBounds.Y), testSprite,screenDebuger,content,graphicsDevice,level); level.setPlayer(aPlayer); } if (EntityType == "Hazard") { } if (EntityType == "Platform") { TileCollision tileCollision = TileCollision.Platform; if (Properties["CollisionType"] == "Platform") {tileCollision = TileCollision.Platform;} if (Properties["CollisionType"] == "Passable") { tileCollision = TileCollision.Passable; } if (Properties["CollisionType"] == "Impassable") { tileCollision = TileCollision.Impassable; } Platform platform = new Platform(EntityBounds, tileCollision, Convert.ToBoolean(Properties["IsShadowCaster"]), krypton); platforms.Add(platform); } if (EntityType == "Light") { Color color = new Color(); color.R = (byte)Convert.ToInt32(Properties["R"]); color.G = (byte)Convert.ToInt32(Properties["G"]); color.B = (byte)Convert.ToInt32(Properties["B"]); color.A = 255; /* X = EntityBounds.X, Y = EntityBounds.Y, Range = (float)Convert.ToInt32(Properties["Range"]), Intensity = (float)Convert.ToDouble(Properties["Intensity"]), Color = color, ShadowType = ShadowType.Illuminated, Fov = MathHelper.PiOver2 * (float) (0.5) * */ Light2D light = new Light2D { Texture = LightTextureBuilder.CreatePointLight(graphicsDevice, 1024), X = EntityBounds.X, Y = EntityBounds.Y, Range = (float)Convert.ToInt32(Properties["Range"]), Intensity = (float)Convert.ToDouble(Properties["Intensity"]), Color = color, ShadowType = ShadowType.Illuminated, Fov = MathHelper.PiOver2 * (float)Convert.ToDouble(Properties["Fov"]) }; //Optional Properties if(Properties.ContainsKey("Flicker")){ light.Flicker = (bool)Convert.ToBoolean(Properties["Flicker"]);} krypton.Lights.Add(light); } }
public Player(Vector2 position,Sprite sprite,ScreenDebuger screenDebuger,ContentManager content,GraphicsDevice graphicsDevice,Level level) { this.content = content; this.screenDebuger = screenDebuger; playerSprite = sprite; this.position = position; playerSprite.Position = this.position; Spawn = position; this.level = level; this.platforms = level.Platforms; random = new Random(); Health = 100; runningAnimation = new Animation(content.Load<Texture2D>("SpriteSheets/running"), position, 100, 100, 8, 150, 1f, true, graphicsDevice); currentAnimation = runningAnimation; }
public void Intialise(KryptonEngine krypton, ContentManager content, GraphicsDevice graphicsDevice,ScreenDebuger screenDebuger, List<Sprite> sprites) { this.content = content; this.krypton = krypton; this.sprites = sprites; this.screenDebuger = screenDebuger; placeHolder = content.Load<Texture2D>("PlaceHolder"); interestingLight = content.Load<Texture2D>("player"); platforms = new List<Platform>(); //Texture2D playerImage = content.Load<Texture2D>("playerDraft"); //Sprite testSprite = new Sprite(playerImage, new Vector2(0,0), false, krypton); //player = new Player(new Vector2(100, 100), testSprite); foreach (var layer in TileLayers) { for (int y = 0; y < layer.Height; y++) { for (int x = 0; x < layer.Width; x++) { Tile tile = layer.Tiles[y * layer.Width + x]; if (tile.Exists) { tile.Intialise(new Vector2(x, y), content); } } } } foreach (var layer in EntityLayers) { foreach (Entity entity in layer.Entities) { entity.Intialise(platforms, sprites, krypton, content, graphicsDevice,screenDebuger , this); } } // Create a light we can control torch = new Light2D() { Texture = LightTextureBuilder.CreatePointLight(graphicsDevice, 1024), X = 0, Y = 0, Range = 800, Intensity = 0.6f, Color = Color.White, ShadowType = ShadowType.Illuminated, Fov = MathHelper.PiOver2 * (float)(0.3) }; krypton.Lights.Add(torch); torchGlow = new Light2D() { Texture = LightTextureBuilder.CreatePointLight(graphicsDevice, 1024), X = 0, Y = 0, Range = 700, Intensity = 0.25f, Color = Color.White, ShadowType = ShadowType.Solid, //Fov = MathHelper.PiOver2 * (float)(0.5) }; krypton.Lights.Add(torchGlow); }