private void CanvasInitialized(object sender, EventArgs e)//allows the canvas to take input which allows things like image movement { BitmapImage bit = new BitmapImage(); MakeObstacle make = new MakeObstacle(); story.AddIntro("Hi im James you are hurt! I'm calling the police."); story.AddIntro("This is the police how may we help you? Just kidding! We are the thought police. We know the situation. Gather three bandages to save their life."); story.AddDialogue("Have you found the bandages?"); story.AddDialogue("Good good you have just saved this woman's life. I feel some good fortune coming your way sir or madam."); story.AddDialogue("It's sir."); story.AddDialogue("Yeah I don't care your services are no longer needed please leave and continue with your life. By please I mean leave before I bring you in for some made " + "up thought crime."); bit.BeginInit(); bit.UriSource = new Uri(@"../../Object Model/ROAD.png", UriKind.RelativeOrAbsolute); bit.EndInit(); /*<Fix> Added the file and contents of the file to the project. />*/ //road.Source = bit; make.MakeWall(character, canvas, @"../../Object Model/Wall.png", wall1);//gotta open the new graphics in VS before they will work properly make.MakeWall(character, canvas, @"../../Object Model/Wall.png", wall2); make.MakeWall(character, canvas, @"../../Object Model/Wall.png", wall3); make.MakeDoor(character, canvas, "", Door1); make.MakeItem(character, canvas, @"../../Object Model/GUY.png", item1); make.MakeNPC(character, canvas, @"../../Object Model/GUY.png", NPC1); canvas.Focusable = true; canvas.Focus(); }
private void HellCanvas_Initialized(object sender, EventArgs e) { GoodStory.AddIntro("<LevelIntro>Xavier: This is it. The last two pieces and then I confront Satan."); GoodStory.AddDialogue("Satan: Well Well. I see you have collected all of the pieces to the staff. I geuss this means you rule hell now. If you will head left your prize awaits " + "you."); BitmapImage bit = new BitmapImage(); bit.BeginInit(); bit.UriSource = new Uri("../../Object Model/SatanicCircle.png", UriKind.Relative); bit.EndInit(); SatanicGrid.Source = bit; bit = new BitmapImage(); bit.BeginInit(); bit.UriSource = new Uri("../../Object Model/MainCharacter.png", UriKind.Relative); bit.EndInit(); MainCharacter.Source = bit; HellCanvas.Focusable = true; HellCanvas.Focus(); make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/T1.png", Trident1); make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/T2.png", Trident2); make.MakeNPC(MainCharacter, HellCanvas, "../../Object Model/devil.png", Satan); make.MakeDoor(MainCharacter, HellCanvas, "", Door1); make.MakeWall(MainCharacter, HellCanvas, "", Wall3); make.MakeWall(MainCharacter, HellCanvas, "", Wall1); make.MakeWall(MainCharacter, HellCanvas, "", Wall2); press.ConnectCharacter_and_Canvas(MainCharacter, HellCanvas); Canvas.SetRight(MainCharacter, Canvas.GetLeft(MainCharacter) + MainCharacter.Width);//setting right and bottom of character Canvas.SetBottom(MainCharacter, Canvas.GetTop(MainCharacter) + MainCharacter.Height); }
private void HellCanvas_Initialized(object sender, EventArgs e) { HellCanvas.Focusable = true; HellCanvas.Focus(); StoryBox.Focusable = false; BitmapImage bit = new BitmapImage(); bit.BeginInit(); bit.UriSource = new Uri("../../Object Model/MainCharacter.png", UriKind.Relative); bit.EndInit(); MainCharacter.Source = bit; bit = new BitmapImage(); bit.BeginInit(); bit.UriSource = new Uri("../../Object Model/SatanicCircle.png", UriKind.Relative); bit.EndInit(); SatanicCircle.Source = bit; make.MakeDoor(MainCharacter, HellCanvas, "", Door1); make.MakeDoor(MainCharacter, HellCanvas, "", Door2); make.MakeDoor(MainCharacter, HellCanvas, "", Door3); make.MakeDoor(MainCharacter, HellCanvas, "", Door4); make.MakeNPC(MainCharacter, HellCanvas, "../../Object Model/devil.png", Satan); make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/Water.png", water); make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/Ice.png", ice); move.ConnectCharacter_and_Canvas(MainCharacter, HellCanvas); BadStory.AddIntro("<LevelIntro>Narrator: Now all Xavier has to do is collect the ice and the water and talk to Satan to start his new-ish life."); BadStory.AddIntro("<CharacterIntro>Satan: I see you wish to be my new right hand man. Well your gonna have to work for it! Now give me my water and set up my fan. Maybe in a couple " + "thousands years I will consider you. Now LEAVE! Before I get annoyed."); }
private void HellCanvas_Initialized(object sender, EventArgs e) { GoodStory.AddIntro("<LevelIntro>Xavier: Well I suppose that is the first piece of the scepter thing that demon was talking about."); GoodStory.AddIntro("<CharacterIntro>Xavier: One piece down just two more to go. I guess I should try going down or the the left to find the other pieces."); HellCanvas.Focusable = true; HellCanvas.Focus(); make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/T3.png", TridentPiece); make.MakeDoor(MainCharacter, HellCanvas, "", Door1); make.MakeDoor(MainCharacter, HellCanvas, "", Door2); make.MakeWall(MainCharacter, HellCanvas, "", Wall1); make.MakeWall(MainCharacter, HellCanvas, "", Wall2); press.ConnectCharacter_and_Canvas(MainCharacter, HellCanvas); }
private void TraverseCanvas_KeyDown(object sender, KeyEventArgs e) { /*<Summary> Controls player movement, collision checking and the story within the level. />*/ GenObstacle.CollisionCheck(); GenObstacle obs = GenObstacle.ClosestElement(); if (GoodStory.OccuredOnce != true) { GoodStory.PrintLevelIntro(StoryBox); } if (e.Key == Key.Escape) { PauseScreen pause = new PauseScreen(this); pause.WindowStartupLocation = WindowStartupLocation.CenterScreen; pause.ShowDialog(); } else if (obs.CollisionStatus) { if (obs.collideable) { if (Canvas.GetRight(character) == Canvas.GetLeft(GenObstacle.ClosestObstacle))//going right { move.RestrictRight(e); } else if (Canvas.GetBottom(character) == Canvas.GetTop(GenObstacle.ClosestObstacle))//going down { move.RestrictDown(e); } else if (Canvas.GetTop(character) == Canvas.GetBottom(GenObstacle.ClosestObstacle))//going up { move.RestrictUp(e); } else if (Canvas.GetLeft(character) == Canvas.GetRight(GenObstacle.ClosestObstacle))//going left { move.RestrictLeft(e); } else { move.MoveFreely(e); } } else if (obs is NPC) { if (GoodStory.ShouldContinue == false && observe.Count == 0) { /*<Summary> The player chooses the good path. />*/ GoodStory.PrintConversation(StoryBox); make.MakeItem(character, canvas, @"../../Object Model/Band.png", bandage1); make.MakeItem(character, canvas, @"../../Object Model/Band.png", bandage2); make.MakeItem(character, canvas, @"../../Object Model/Band.png", bandage3); GoodStory.ShouldContinue = true; canvas.Children.Remove(money); } else if (GoodStory.ShouldContinue == true && observe.Count == 3 && GoodStory.IsComplete == false) { BitmapImage bit = new BitmapImage(); bit.BeginInit(); bit.UriSource = new Uri("../../Object Model/Amb.png", UriKind.Relative); bit.EndInit(); ambulance.Source = bit; GoodStory.PrintConversation(StoryBox); canvas.Children.Remove(NPC1); observe.Clear(); GameBeaten = true; } move.MoveFreely(e); } else if (obs is Item) { if (GoodStory.ShouldContinue == false && BadStory.IsComplete == false) { BadStory.PrintConversation(StoryBox); } canvas.Children.Remove(GenObstacle.ClosestObstacle); ItmCollect.Collect(GenObstacle.ClosestObstacle); obs.Remove(obs); } else if (obs is Door) { if (BadStory.IsComplete) { obs.Clear(); LevelFinished = true; this.Close(); } else if (GoodStory.IsComplete) { obs.Clear(); GameBeaten = true; this.Close(); } move.RestrictUp(e); } } else { move.MoveFreely(e); } Canvas.SetRight(character, Canvas.GetLeft(character) + character.Width); Canvas.SetBottom(character, Canvas.GetTop(character) + character.Height); }
private void HellCanvas_keyDown(object sender, KeyEventArgs e) { GenObstacle.CollisionCheck(); GenObstacle obs = GenObstacle.ClosestElement(); if (GoodStory.OccuredOnce != true) { GoodStory.PrintLevelIntro(StoryBox); } if (e.Key == Key.Escape) { PauseScreen pause = new PauseScreen(this); pause.WindowStartupLocation = WindowStartupLocation.CenterScreen; pause.ShowDialog(); } else if (obs.CollisionStatus) { if (obs is NPC) { if (GoodStory.ShouldContinue == false) { GoodStory.PrintConversation(StoryBox); GoodStory.ShouldContinue = true; LevelFinished = true; GoodEnding = true; make.MakeItem(MainCharacter, HellCanvas, "../../Object Model/Fan.png", Fan); } move.MoveFreely(e); } else if (obs is Item) { HellCanvas.Children.Remove(GenObstacle.ClosestObstacle); CollectItm.Collect(GenObstacle.ClosestObstacle); obs.Remove(obs); BadStory.ShouldContinue = true; GoodEnding = false; } else if (obs is Door) { if (BadStory.ShouldContinue == true || GoodStory.ShouldContinue == true) { obs.Clear(); this.Close(); } else if (Canvas.GetRight(MainCharacter) == Canvas.GetLeft(GenObstacle.ClosestObstacle))//going right { move.RestrictRight(e); } else if (Canvas.GetBottom(MainCharacter) == Canvas.GetTop(GenObstacle.ClosestObstacle))//going down { move.RestrictDown(e); } else if (Canvas.GetTop(MainCharacter) == Canvas.GetBottom(GenObstacle.ClosestObstacle))//going up { move.RestrictUp(e); } else if (Canvas.GetLeft(MainCharacter) == Canvas.GetRight(GenObstacle.ClosestObstacle))//going left { move.RestrictLeft(e); } else { move.MoveFreely(e); } } } else { move.MoveFreely(e); } Canvas.SetRight(MainCharacter, Canvas.GetLeft(MainCharacter) + MainCharacter.Width); Canvas.SetBottom(MainCharacter, Canvas.GetTop(MainCharacter) + MainCharacter.Height); }