public override void OnLoad(BWindow Window) { base.OnLoad(Window); // Initialising our player Player = new Player( new Vector2((Level.playerStartPos.X + 0.5f) * AppInfo.GRIDSIZE, (Level.playerStartPos.Y + 0.5f) * AppInfo.GRIDSIZE), BGraphics.LoadTexture("Characters/player.png"), BMovementType.FollowPath ); // Initialise the navmesh this.NavMesh = new BNavigationGrid(0, 0, Level.Width, Level.Height, AppInfo.GRIDSIZE, (int)(Player.CollisionBox.Width * 1.25f), (int)(Player.CollisionBox.Height * 1.25f)); NavMesh.Update(Level); // Initialise our camera settings Camera.SetPosition(Player.position); Camera.Zoom = 1.0f; // Lets put some fences in the game for (int i = 0; i < 6; i++) { Level.CreateEntity(new Fence(new Vector2(500 + (i * 32), 600), Textures[1], new Vector2(32f), new RectangleF(256f, 0, 256f, 256f))); } }
public override void OnLoad(BWindow Window) { base.OnLoad(Window); // Initialise our menu buttons BMenuButton[] buttons = new BMenuButton[] { new BMenuButton(SwitchState, BGraphics.LoadTexture("Textures/Menu/play.png"), 300f, 300f, 250f, 60f), new BMenuButton(Window.ExitWindow, BGraphics.LoadTexture("Textures/Menu/quit.png"), 300f, 380f, 250f, 60f) }; InitialiseMenu(buttons); }
public override void InitialiseLevel() { base.InitialiseLevel(); // Initialising our textures (We can have up to 255 images. Make the most of this by using sprite sheets.) Textures[0] = BGraphics.LoadTexture("Textures/terrain_default.png"); Textures[1] = BGraphics.LoadTexture("Textures/entities_default.png"); // Initialising our blocks (We can have up to 254 blocks, id 1 to 254) Blocks.Initialise(); // Initialising our level Level = new BLevel("test_map"); }