public bool HitMob(MobTop MobTop, MobDown MobDown, MobLeft MobLeft, MobRight MobRight) { if (Globals.GetDistance(pos, MobTop.pos) < MobTop.hitdist) { MobTop.Current -= damage; return(true); } if (Globals.GetDistance(pos, MobDown.pos) < MobDown.hitdist) { MobDown.Current -= damage; return(true); } if (Globals.GetDistance(pos, MobLeft.pos) < MobLeft.hitdist) { MobLeft.Current -= damage; return(true); } if (Globals.GetDistance(pos, MobRight.pos) < MobRight.hitdist) { MobRight.Current -= damage; return(true); } return(false); }
public void Update(Vector2 OFFSET, MobTop MobTop, MobDown MobDown, MobLeft MobLeft, MobRight MobRight) { pos += realtarget * speed; timer.UpdateTimer(); if (timer.Test()) { done = true; } if (HitMob(MobTop, MobDown, MobLeft, MobRight)) { done = true; } }
public virtual bool HitmainChar(mainChar UNITS, bool ISCRIT, MobTop MobTop, MobDown MobDown, MobLeft MobLeft, MobRight MobRight) { if (Globals.GetDistance(pos, UNITS.pos) < UNITS.hitdist) { Globals.SoundControl.PlaySong("eatHeart"); if (!ISCRIT) { if (savedPath == "HeartTop") { MobTop.Current += damage; } else if (savedPath == "HeartDown") { MobDown.Current += damage; } else if (savedPath == "HeartLeft") { MobLeft.Current += damage; } else if (savedPath == "HeartRight") { MobRight.Current += damage; } } else { UNITS.GetHit(damage * 10); } return(true); } return(false); }
//world #region public World(PassObject RESETWORLD) { ResetWorld = RESETWORLD; Random rand = new Random(); offset = new Vector2(0, 0); ResetBtn = new Button2d("ResetButton", new Vector2(450, 750), new Vector2(200, 200), ResetWorld, null); ExitBtn = new Button2d("ExitButton", new Vector2(1480, 750), new Vector2(200, 200), ResetWorld, null); ResetScript = new Basic2d("ResetScript", new Vector2(500, 850), new Vector2(400, 200)); ExitScript = new Basic2d("ExitScript", new Vector2(1450, 850), new Vector2(400, 200)); mainChar = new mainChar("mainChar", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(400, 400)); backGround = new backGround("BackGround", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); GameGlobals.ShootBulletTop = ShootBulletTop; MobTops = new MobTop("MobTop", new Vector2(rand.Next(400, 1500), 110), new Vector2(300, 300)); GameGlobals.ShootBulletDown = ShootBulletDown; MobDowns = new MobDown("MobDown", new Vector2(rand.Next(400, 1500), 1000), new Vector2(400, 400)); GameGlobals.ShootBulletLeft = ShootBulletLeft; MobLefts = new MobLeft("MobLeft", new Vector2(250, rand.Next(350, 800)), new Vector2(400, 400)); GameGlobals.ShootBulletRight = ShootBulletRight; MobRights = new MobRight("MobRight", new Vector2(1700, rand.Next(350, 800)), new Vector2(400, 400)); TopBar = new HealthBar("TopBar", new Vector2(0, 0), new Vector2(400, 175)); DownBar = new HealthBar("DownBar", new Vector2(0, 0), new Vector2(400, 175)); LeftBar = new HealthBar("LeftBar", new Vector2(0, 0), new Vector2(400, 175)); RightBar = new HealthBar("RightBar", new Vector2(0, 0), new Vector2(400, 175)); GameGlobals.ShootBulletMainChar = ShootBulletMainChar; tester = Globals.content.Load <SpriteFont>("MyFont"); power = new Basic2d("power", new Vector2(100, 100), new Vector2(250, 250)); power01 = new Basic2d("power01", new Vector2(100, 100), new Vector2(250, 250)); power02 = new Basic2d("power02", new Vector2(100, 100), new Vector2(250, 250)); power03 = new Basic2d("power03", new Vector2(100, 100), new Vector2(250, 250)); power04 = new Basic2d("power04", new Vector2(100, 100), new Vector2(250, 250)); powerfull01 = new Basic2d("powerfull01", new Vector2(100, 100), new Vector2(250, 250)); powerfull02 = new Basic2d("powerfull02", new Vector2(100, 100), new Vector2(250, 250)); powerfull03 = new Basic2d("powerfull03", new Vector2(100, 100), new Vector2(250, 250)); powerfull04 = new Basic2d("powerfull04", new Vector2(100, 100), new Vector2(250, 250)); backGroundEndGame = new backGround("BackGroundEndGame", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); GameOver01 = new backGround("GameOver01", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); GameOver02 = new backGround("GameOver02", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); GameOver03 = new backGround("GameOver03", new Vector2(Globals.screenWidth / 2, Globals.screenHeight / 2), new Vector2(Globals.screenWidth, Globals.screenHeight)); score00 = new Basic2d("00", new Vector2(1860, 80), new Vector2(100, 100)); score002nd = new Basic2d("00", new Vector2(1800, 80), new Vector2(100, 100)); score003rd = new Basic2d("00", new Vector2(1740, 80), new Vector2(100, 100)); score01 = new Basic2d("01", new Vector2(1800, 80), new Vector2(100, 100)); score02 = new Basic2d("02", new Vector2(1800, 80), new Vector2(100, 100)); score03 = new Basic2d("03", new Vector2(1800, 80), new Vector2(100, 100)); score04 = new Basic2d("04", new Vector2(1800, 80), new Vector2(100, 100)); score05 = new Basic2d("05", new Vector2(1860, 80), new Vector2(100, 100)); score052nd = new Basic2d("05", new Vector2(1800, 80), new Vector2(100, 100)); score06 = new Basic2d("06", new Vector2(1800, 80), new Vector2(100, 100)); score07 = new Basic2d("07", new Vector2(1800, 80), new Vector2(100, 100)); score08 = new Basic2d("08", new Vector2(1800, 80), new Vector2(100, 100)); score09 = new Basic2d("09", new Vector2(1800, 80), new Vector2(100, 100)); score013rd = new Basic2d("01", new Vector2(1740, 80), new Vector2(100, 100)); score023rd = new Basic2d("02", new Vector2(1740, 80), new Vector2(100, 100)); score033rd = new Basic2d("03", new Vector2(1740, 80), new Vector2(100, 100)); score043rd = new Basic2d("04", new Vector2(1740, 80), new Vector2(100, 100)); score053rd = new Basic2d("05", new Vector2(1740, 80), new Vector2(100, 100)); score063rd = new Basic2d("06", new Vector2(1740, 80), new Vector2(100, 100)); score073rd = new Basic2d("07", new Vector2(1740, 80), new Vector2(100, 100)); score083rd = new Basic2d("08", new Vector2(1740, 80), new Vector2(100, 100)); score093rd = new Basic2d("09", new Vector2(1740, 80), new Vector2(100, 100)); score014th = new Basic2d("01", new Vector2(1680, 80), new Vector2(100, 100)); // score end scoreE00 = new Basic2d("00", new Vector2(1080, 150), new Vector2(200, 200)); scoreE05 = new Basic2d("05", new Vector2(1080, 150), new Vector2(200, 200)); scoreE10 = new Basic2d("00", new Vector2(960, 150), new Vector2(200, 200)); scoreE11 = new Basic2d("01", new Vector2(960, 150), new Vector2(200, 200)); scoreE12 = new Basic2d("02", new Vector2(960, 150), new Vector2(200, 200)); scoreE13 = new Basic2d("03", new Vector2(960, 150), new Vector2(200, 200)); scoreE14 = new Basic2d("04", new Vector2(960, 150), new Vector2(200, 200)); scoreE15 = new Basic2d("05", new Vector2(960, 150), new Vector2(200, 200)); scoreE16 = new Basic2d("06", new Vector2(960, 150), new Vector2(200, 200)); scoreE17 = new Basic2d("07", new Vector2(960, 150), new Vector2(200, 200)); scoreE18 = new Basic2d("08", new Vector2(960, 150), new Vector2(200, 200)); scoreE19 = new Basic2d("09", new Vector2(960, 150), new Vector2(200, 200)); scoreE20 = new Basic2d("00", new Vector2(840, 150), new Vector2(200, 200)); scoreE21 = new Basic2d("01", new Vector2(840, 150), new Vector2(200, 200)); scoreE22 = new Basic2d("02", new Vector2(840, 150), new Vector2(200, 200)); scoreE23 = new Basic2d("03", new Vector2(840, 150), new Vector2(200, 200)); scoreE24 = new Basic2d("04", new Vector2(840, 150), new Vector2(200, 200)); scoreE25 = new Basic2d("05", new Vector2(840, 150), new Vector2(200, 200)); scoreE26 = new Basic2d("06", new Vector2(840, 150), new Vector2(200, 200)); scoreE27 = new Basic2d("07", new Vector2(840, 150), new Vector2(200, 200)); scoreE28 = new Basic2d("08", new Vector2(840, 150), new Vector2(200, 200)); scoreE29 = new Basic2d("09", new Vector2(840, 150), new Vector2(200, 200)); scoreE31 = new Basic2d("00", new Vector2(840, 150), new Vector2(200, 200)); maincharCycle = 0; powerCycle = 0; isPower = false; }
public virtual void Update(Vector2 OFFSET, mainChar UNITS, MobTop MobTop, MobDown MobDown, MobLeft MobLeft, MobRight MobRight) { pos += realtarget * speed; timer.UpdateTimer(); if (timer.Test()) { done = true; } if (HitmainChar(UNITS, iscritdmg, MobTop, MobDown, MobLeft, MobRight)) { done = true; } }