public Fox(GameplayScreen screen, ChicksScene world, /*Screens.GameplayScreen screen,*/ Vector2 position, float rot) : base(87, position, true, world.World, "fox") { this.screen = screen; chicksScene = world; DoDimensions = false; PhysicsPosition = false; Body.Mass = 1.55f; RaiseFlag(Jabber.Flags.ACCEPTINPUT); EventManager.Get.RegisterListner(this); Layer = SpriteLayer.LAYER10; Body.UserData = this; Body.Friction = 10.0f; Body.AngularDamping = 10.0f; Body.LinearDamping = maxDamp; Body.Friction = maxDamp; Body.AngularDamping = maxDamp; // this.screen = screen; for (int i = 0; i < ScreenManager.Get.Screens.Count; i++) { if (ScreenManager.Get.Screens[i] is GameplayScreen) { screen = ScreenManager.Get.Screens[i] as GameplayScreen; } } //screen = Jabber.GameScreenManager.ScreenManager.Get.TopScreen as GameplayScreen; }
public GameCamera(GameplayScreen scene) : base() { this.screen = scene; RaiseFlag(Jabber.Flags.ACCEPTINPUT); UniformWorldScale = 0.4f; EventManager.Get.RegisterListner(this); }
public Cannon(GameplayScreen screen) : base("chickens") { this.screen = screen; Layer = SpriteLayer.LAYER9; RaiseFlag(Jabber.Flags.ACCEPTINPUT); projectileWorld = new FarWorld(); projectileWorld.Initialize(new Vector2(0, -15.0f)); }
public ChickenBience(GameplayScreen screen) : base() { this.screen = screen; }
public ChicksScene(GameplayScreen screen, FarWorld world, ContentManager content) : base(screen, world, null, content) { }
public ThisGamesScene(GameplayScreen screen, JabWorld world, ChicksScene chicksScene, ContentManager content) : base(world, content) { this.screen = screen; this.chicksScene = chicksScene; AddSpriteLoadInterceptor("textures\\fan", LoadFan); AddSpriteLoadInterceptor("textures\\donut", LoadDonut); AddSpriteLoadInterceptor("textures\\donutcase", LoadDonutCase); AddSpriteLoadInterceptor("textures\\basketball", LoadBasketBall); AddSpriteLoadInterceptor("textures\\Physical\\basketball", LoadBasketBall); AddSpriteLoadInterceptor("textures\\tyre", LoadTyre); AddSpriteLoadInterceptor("textures\\Physical\\tyre", LoadTyre); }
public LevelEndScreen(GameplayScreen gp) : base() { gameplay = gp; EventManager.Get.RegisterListner(this); }
public override void Update(GameTime dt) { base.Update(dt); #if WINDOWS_PHONE AdSystem.TargetTop = false; #endif if (blank != null) { if (blank.StateFlag == Jabber.StateFlag.FADE_IN_COMPLETE) { gameplay.RaiseFlag(Flags.DELETE); RaiseFlag(Flags.DELETE); if (NextLevelLoad) { if (ChicksnVixensGame.Get.GetTotalLevels(gameplay.location) >= gameplay.levelNum + 1) { GameplayScreen s = new GameplayScreen(gameplay.location, gameplay.levelNum + 1); s.Initialize(Content); ScreenManager.Get.AddScreen(s); } else { if (gameplay.location != "vesuvius") { ChicksnVixensGame.Get.PlayNextLocationStory(gameplay.location); } else { MainMenuScreen s = new MainMenuScreen(); s.Initialize(Content); ScreenManager.Get.AddScreen(s); } } } else { WorldSelectScreen s = new WorldSelectScreen(); s.Initialize(Content); s.SetCurrentCountry(gameplay.location); ScreenManager.Get.AddScreen(s); } } } }
public override void Update(GameTime gameTime) { if (invincibilityTime < maxTime) { invincibilityTime += gttf(gameTime); Body.Awake = true; return; } else { invincibilityTime += gttf(gameTime); } if (screen == null) { for (int i = 0; i < ScreenManager.Get.Screens.Count; i++) { if (ScreenManager.Get.Screens[i] is GameplayScreen) { screen = ScreenManager.Get.Screens[i] as GameplayScreen; } } } if (health > 0) { if (ThingStandingOnIsMoving && IsBox) { // SwitchActiveBody(); } if ((Body.LinearVelocity.Length() + Math.Abs(Body.AngularVelocity) >= 0.5f && IsBox) || (!StandingOnSomething && IsBox)) { SwitchActiveBody(); if (AsType.Animation != "Roll") { AsType.Animation = "Roll"; } } else if ((!IsBox && Body.LinearVelocity.Length() + Math.Abs(Body.AngularVelocity) < 0.5f) && StandingOnSomething && !ThingStandingOnIsMoving) { SwitchActiveBody(); if (AsType.Animation != "Idle" && chicksScene.ActiveChicken == null) { AsType.Animation = "Idle"; } else { Chicken active = chicksScene.ActiveChicken; AsType.Animation = ""; AsType.CurrentFrame = "fox-watch-00010"; } } if (AsType.Animation == "Idle" && CarryingSomething) { AsType.Animation = "Carrying"; } else if (AsType.Animation == "Carrying" && !CarryingSomething) { AsType.Animation = "Idle"; } if ((AsType.Animation == "Idle" || AsType.Animation == "") && chicksScene.ActiveMotion != null) { Chicken active = chicksScene.ActiveMotion; AsType.Animation = ""; Vector2 dirToChicken = active.Position - AsType.Position; dirToChicken.Normalize(); float rotToChicken = (float)Math.Atan2((float)-dirToChicken.X, (float)-dirToChicken.Y); rotToChicken -= 0.5f * (float)Math.PI + AsType.Rot; while (rotToChicken < 0) { rotToChicken += 2 * (float)Math.PI; } while (rotToChicken > 2 * (float)Math.PI) { rotToChicken -= 2 * (float)Math.PI; } rotToChicken /= 2 * (float)Math.PI; int num = (int)(rotToChicken * 11); if (num.ToString().Length == 2) { AsType.CurrentFrame = "fox-watch-000" + num.ToString(); } else { AsType.CurrentFrame = "fox-watch-0000" + num.ToString(); } } else if (AsType.Animation == "") { AsType.Animation = "Idle"; } if (health > 0) { if (PosX > screen.scene.GetRightMaxPos() + 1000 || PosX < screen.scene.startPos.X - 1000 || PosY < -10 || PosY > 10000) { health = -1; } if (!(ScreenManager.Get.TopScreen is PauseScreen) && ScreenManager.Get.TopScreen != screen) { if (AsType.Animation != "Celebrate" && AsType.Animation != "Roll" && AsType.Animation != "Carrying") AsType.Animation = "Celebrate"; } else if (AsType.Animation == "Celebrate") { AsType.Animation = "Idle"; } } SetPos(); } else { if (AsType.Animation == "Roll") { SetPos(); if (Body.LinearVelocity.Length() < 0.3f && StandingOnSomething) { if(AsType.Animation != "Die") AudioQueue.PlayOnce("Sounds/Fox_Death_2" + Jabber.BaseGame.Random.Next(0, 3)); AsType.Animation = "Die"; } else if (Body.LinearVelocity.Length() < 0.3f || InFan) { deadWhileInRollButStillTimer += gttf(gameTime); if (deadWhileInRollButStillTimer > 1.0f) { if (AsType.Animation != "Die") AudioQueue.PlayOnce("Sounds/Fox_Death_2" + Jabber.BaseGame.Random.Next(0, 3)); AsType.Animation = "Die"; } } else { deadWhileInRollButStillTimer = 0.0f; } } else if (AsType.Animation != "Die" && AsType.Animation != "Corpse") { if (AsType.Animation != "Die") AudioQueue.PlayOnce("Sounds/Fox_Death_2" + Jabber.BaseGame.Random.Next(0, 3)); AsType.Animation = "Die"; Body.CollisionGroup = FOX_NONE_COLLISION_GROUP; Body.IgnoreRayCast = true; PhysicsPosition = false; PhysicsRotate = false; } else if (AsType.Animation == "Die" || AsType.Animation == "Corpse") { Body.CollisionGroup = FOX_NONE_COLLISION_GROUP; Body.IgnoreRayCast = true; PhysicsPosition = false; PhysicsRotate = false; RayCastHit hit = World.RayCast(AsType.Position, AsType.Position + new Vector2(0, -(AsType.Height / 1.4f))); if ( hit.actor != null) { if (true)//AsType.PosY - (hit.worldImpact.Y + AsType.Height / 2.0f) > 0) todo: fix { AsType.PosY = hit.worldImpact.Y + AsType.Height / 2.0f; AsType.Rot = (float)Math.Atan2((float)hit.worldNormal.X, (float)hit.worldNormal.Y); deathFallTimer = 0; } if(AsType.Animation == "Corpse") alphaOutTimer += gttf(gameTime); if (alphaOutTimer > 1.0f) { alphaingOut += gttf(gameTime); float val = 1.0f - alphaingOut; if (alphaingOut > 1) { RaiseFlag(Jabber.Flags.DELETE); } else { Colour = new Color(val, val, val,val); } } } else { alphaOutTimer = 0.0f; deathFallTimer += gttf(gameTime); AsType.PosY -= deathFallTimer * 9.8f; } Body.IgnoreRayCast = true; } } base.Update(gameTime); if (InFan) { Body.LinearDamping = 0.0f; } else if (InFanLastFrame) { Body.Friction = 0.5f; Body.AngularDamping = 0.5f; Body.LinearDamping = 0.5f; AsType.Animation = "Roll"; } InFanLastFrame = InFan; InFan = false; if (AsType.Animation == "Roll" || AsType.Animation == "Die" || AsType.Animation == "Corpse") { if (WearHat && invincibilityTime > maxTime * 2.0f) { ThrownHat hat = new ThrownHat(LocationToHat); hat.Initialize(Jabber.BaseGame.Get.Content); hat.Position = Body.Position + ActorStandingOn.worldNormal*64; hat.Rot = Rot; chicksScene.AddNode(hat); WearHat = false; } } }
void NextLevel() { RaiseFlag(Jabber.Flags.DELETE); GameplayScreen s = new GameplayScreen(location, levelNum); s.Initialize(Content); ScreenManager.Get.AddScreen(s); }
public AudioQueue(GameplayScreen screen) : base() { this.screen = screen; EventManager.Get.RegisterListner(this); }
public override void ProcessEvent(Event ev) { base.ProcessEvent(ev); if ((ev is MenuEvent)) { if ((ev as MenuEvent).sender is BackButton) { EventManager.Get.SendEvent(new ScreenCancelEvent(this)); for (int i = 0; i < levelButtons.Count; i++) { // levelButtons[i].fadeOut = true; levelButtons[i].RaiseFlag(Flags.FADE_OUT); } screenCamera.RaiseFlag(Flags.FADE_OUT); blank.RaiseFlag(Flags.FADE_OUT); RaiseFlag(Flags.FADE_OUT); } else if ((ev as MenuEvent).sender is LevelButton) { GameplayScreen s = new GameplayScreen(location, ((ev as MenuEvent).sender as LevelButton).Level); s.LevelDir = "Content/Levels/" + location + "/Level" + ((ev as MenuEvent).sender as LevelButton).Level + ".xml"; s.Initialize(null); ScreenManager.Get.AddScreen(s); LowerFlag(Flags.ACCEPTINPUT); } else if ((ev as MenuEvent).sender is Button) { Button b = (ev as MenuEvent).sender as Button; if (b.CurrentFrame == "movie") { RaiseFlag(Flags.FADE_OUT); enterMovieSequence = true; LowerFlag(Flags.ACCEPTINPUT); for (int i = 0; i < levelButtons.Count; i++) { levelButtons[i].RaiseFlag(Flags.FADE_OUT); } screenCamera.RaiseFlag(Flags.FADE_OUT); blank.RaiseFlag(Flags.FADE_OUT); RaiseFlag(Flags.FADE_OUT); } } } if (ev is FadeOutEvent) { if ((ev as FadeOutEvent).Sender is FallingFeathers) { RaiseFlag(Flags.DELETE); } } }