public virtual void Update(float gameTime, Map map, ParticleManager particleManager, Character[] characters) { location += trajectory * gameTime; frame -= gameTime; if (frame < 0.0f) KillMe(); }
public override void Update(Character[] c, int ID, Map map) { me = c[ID]; if (jobFrame < 0f) { float r = RandomGenerator.GetRandomFloat(0f, 1f); if (r < 0.6f) { job = JOB_MELEE_CHASE; jobFrame = RandomGenerator.GetRandomFloat(2f, 4f); FindTarg(c); } else if (r < 0.8f) { job = JOB_AVOID; jobFrame = RandomGenerator.GetRandomFloat(1f, 2f); FindTarg(c); } else { job = JOB_IDLE; jobFrame = RandomGenerator.GetRandomFloat(.5f, 1f); } } base.Update(c, ID, map); }
public override void Update(float gameTime, Map map, ParticleManager pMan, Character[] c) { if (HitManager.CheckHit(this, c, pMan)) frame = 0f; trajectory.Y = (float)Math.Sin((double)frame * 13.0) * 150f; if (map.CheckParticleCollision(location)) { this.frame = 0f; pMan.MakeExplosion(location, 1f); } pMan.AddParticle(new Fire(location, -trajectory / 8f, .5f, RandomGenerator.GetRandomInt(0, 4))); pMan.AddParticle(new Smoke(location, RandomGenerator.GetRandomVector2(-20f, 20f, -50f, 10f) - trajectory / 10f, 1f, .8f, .6f, 1f, .5f, RandomGenerator.GetRandomInt(0, 4))); pMan.AddParticle(new Heat(location, RandomGenerator.GetRandomVector2(-20f, 20f, -50f, -10f), RandomGenerator.GetRandomFloat(.5f, 2f))); base.Update(gameTime, map, pMan, c); }
public int FindTarg(Character[] c) { int closest = -1; float d = 0f; for (int i = 0; i < c.Length; i++) { if (i != me.ID) { if (c[i] != null) { if (c[i].Team != me.Team) { float newD = (me.Location - c[i].Location).Length(); if (closest == -1 || newD < d) { d = newD; closest = i; } } } } } return closest; }
public HUD(SpriteBatch spriteBatch, Texture2D spritesTexture, Texture2D nullTexture, Character[] characters, Map map) { this.spriteBatch = spriteBatch; this.spritesTexture = spritesTexture; this.nullTexture = nullTexture; this.characters = characters; this.map = map; scoreDraw = new ScoreDraw(spriteBatch, spritesTexture); }
public override void Update(float gameTime, Map map, ParticleManager particleManager, Character[] characters) { if (HitManager.CheckHit(this, characters, particleManager)) frame = 0f; if (map.CheckParticleCollision(location)) { frame = 0f; particleManager.MakeBulletDust(location, trajectory); } base.Update(gameTime, map, particleManager, characters); }
protected bool AvoidTarg(Character[] c, float distance) { if (c[targ] == null) return false; if (me.Location.X < c[targ].Location.X + distance) { me.keyRight = true; return true; } else if (me.Location.X > c[targ].Location.X - distance) { me.keyLeft = true; return true; } return false; }
public virtual void Update(Character[] c, int ID, Map map) { me = c[ID]; me.keyLeft = false; me.keyRight = false; me.keyUp = false; me.keyDown = false; me.keyAttack = false; me.keySecondary = false; me.keyJump = false; jobFrame -= RuinExplorersMain.FrameTime; DoJob(c, ID); }
public void Update(Character[] characters) { updateFrame -= RuinExplorersMain.FrameTime; if (updateFrame > 0) return; updateFrame = 1f; int monsters = 0; for (int i = 0; i < characters.Length; i++) { if (characters[i] != null) if (characters[i].Team == Character.TEAM_NPC) monsters++; } if (monsters < Size) { for (int i = 0; i < bucketItems.Length; i++) { if (bucketItems[i] != null) { for (int n = 0; n < characters.Length; n++) { if (characters[n] == null) { characters[n] = new Character(bucketItems[i].location, RuinExplorersMain.CharacterDefinitions[(int)bucketItems[i].characterType], n, Character.TEAM_NPC); bucketItems[i] = null; return; } } } } if (monsters == 0) IsEmpty = true; } }
public static bool CheckHit(Particle particle, Character[] character, ParticleManager particleManager) { bool r = false; CharacterDirection tFace = GetFaceFromTrajectory(particle.trajectory); for (int i = 0; i < character.Length; i++) { if (i != particle.owner) { if (character[i] != null) { if (character[i].DyingFrame < 0f && !character[i].Ethereal) { if (character[i].InHitBounds(particle.location)) { float hVal = 1f; character[i].LastHitBy = particle.owner; #region hit by bullet if (particle is Bullet) { if (!r) { hVal *= 4f; if (tFace == CharacterDirection.Left) character[i].Face = CharacterDirection.Right; else character[i].Face = CharacterDirection.Left; character[i].SetAnim("idle"); character[i].SetAnim("hit"); character[i].Slide(-100f); Sound.PlayCue("bullethit"); particleManager.MakeBulletBlood(particle.location, particle.trajectory / 2); particleManager.MakeBulletBlood(particle.location, -particle.trajectory); // imho white smoke doesn't look so cool when zombies get hit by bullets! //particleManager.MakeBulletDust(particle.location, particle.trajectory); r = true; } } #endregion #region hit by hit particle else if (particle is Hit) { character[i].Face = (tFace == CharacterDirection.Left) ? CharacterDirection.Right : CharacterDirection.Left; float tX = 1f; if (tFace == CharacterDirection.Left) tX = -1f; character[i].SetAnim("idle"); character[i].SetAnim("hit"); Sound.PlayCue("zombiehit"); if (character[i].State == CharacterState.Ground) character[i].Slide(-200f); else character[i].Slide(-50f); switch (particle.flag) { case Character.TRIG_ZOMBIE_HIT: hVal *= 5f; particleManager.MakeBloodSplash(particle.location, new Vector2(50f * tX, 100f)); break; case Character.TRIG_WRENCH_DIAG_DOWN: hVal *= 5f; particleManager.MakeBloodSplash(particle.location, new Vector2(50f * tX, 100f)); RuinExplorersMain.SlowTime = 0.1f; break; case Character.TRIG_WRENCH_DIAG_UP: hVal *= 5f; particleManager.MakeBloodSplash(particle.location, new Vector2(-50f * tX, -100f)); RuinExplorersMain.SlowTime = 0.1f; break; case Character.TRIG_WRENCH_UP: hVal *= 5f; particleManager.MakeBloodSplash(particle.location, new Vector2(30f * tX, -100f)); RuinExplorersMain.SlowTime = 0.1f; break; case Character.TRIG_WRENCH_DOWN: hVal *= 5f; particleManager.MakeBloodSplash(particle.location, new Vector2(-50f * tX, 100f)); RuinExplorersMain.SlowTime = 0.1f; break; case Character.TRIG_WRENCH_UPPERCUT: hVal *= 15f; particleManager.MakeBloodSplash(particle.location, new Vector2(-50f * tX, -150f)); character[i].Trajectory.X = 100f * tX; character[i].SetAnim("jhit"); character[i].SetJump(700f); RuinExplorersMain.SlowTime = 0.125f; QuakeManager.SetQuake(0.5f); QuakeManager.SetBlast(0.5f, particle.location); break; case Character.TRIG_WRENCH_SMACKDOWN: hVal *= 15f; particleManager.MakeBloodSplash(particle.location, new Vector2(-50f * tX, 150f)); character[i].SetAnim("jfall"); character[i].SetJump(-900f); RuinExplorersMain.SlowTime = 0.125f; break; case Character.TRIG_KICK: hVal *= 15f; particleManager.MakeBloodSplash(particle.location, new Vector2(300f * tX, 0f)); character[i].Trajectory.X = 1000f * tX; character[i].SetAnim("jhit"); character[i].SetJump(300f); RuinExplorersMain.SlowTime = 0.25f; //QuakeManager.SetBlast(0.5f, particle.location); break; } } #endregion #region hitting characters in air if (character[i].State == CharacterState.Air) { if (character[i].AnimationName == "hit") { character[i].SetAnim("jmid"); character[i].SetJump(300f); if (particle is Hit) { if (character[particle.owner].Team == Character.TEAM_PLAYERS) { character[i].Location.Y = character[particle.owner].Location.Y; } } } } #endregion character[i].HP -= (int)hVal; // calculate score if (character[i].LastHitBy == 0) { RuinExplorersMain.Score += (int)hVal * 50; } if (character[i].HP < 0) { if (character[i].AnimationName == "hit") character[i].SetAnim("diehit"); if (i == 0) { if (character[i].AnimationName == "hit") { character[i].SetAnim("jmid"); character[i].SetJump(300f); } RuinExplorersMain.Menu.Die(); } } } } } } } return r; }
/// <summary> /// Updates the Character, checks for collision and handles input. /// This method has been verified! /// </summary> /// <param name="gameTime">The game time.</param> public void Update(Map map, ParticleManager particleManager, Character[] character) { if (Ai != null) Ai.Update(character, ID, map); PressedKey = PressedKeys.None; if (keyAttack) { PressedKey = PressedKeys.Attack; if (keyUp) PressedKey = PressedKeys.Lower; if (keyDown) PressedKey = PressedKeys.Upper; } if (keySecondary) { PressedKey = PressedKeys.Secondary; if (keyUp) PressedKey = PressedKeys.SecUp; if (keyDown) PressedKey = PressedKeys.SecDown; } if (PressedKey > PressedKeys.None) { if (GotoGoal[(int)PressedKey] > -1) { SetFrame(GotoGoal[(int)PressedKey]); if (keyLeft) Face = CharacterDirection.Left; if (keyRight) Face = CharacterDirection.Right; PressedKey = PressedKeys.None; for (int i = 0; i < GotoGoal.Length; i++) GotoGoal[i] = -1; frame = 0f; } } if (StunFrame > 0f) StunFrame -= RuinExplorersMain.FrameTime; #region update dying if (DyingFrame > -1f) { DyingFrame += RuinExplorersMain.FrameTime; } #endregion #region Update Animation if (DyingFrame < 0) { Animation animation = characterDefinition.Animations[Animation]; KeyFrame keyFrame = animation.KeyFrames[AnimationFrame]; frame += RuinExplorersMain.FrameTime * 30.0f; if (frame > (float)keyFrame.Duration) { int pframe = AnimationFrame; script.DoScript(Animation, AnimationFrame); CheckTrigger(particleManager); frame -= (float)keyFrame.Duration; if (AnimationFrame == pframe) AnimationFrame++; keyFrame = animation.KeyFrames[AnimationFrame]; if (AnimationFrame >= animation.KeyFrames.Length) AnimationFrame = 0; } if (keyFrame.FrameReference < 0) AnimationFrame = 0; if (AnimationName == "jhit") { if (Trajectory.Y > -100f) SetAnim("jmid"); } } #endregion #region Collision with other characters for (int i = 0; i < character.Length; i++) { if (i != ID) { if (character[i] != null) { if (!Ethereal && !character[i].Ethereal) { if (Location.X > character[i].Location.X - 90f * character[i].Scale && Location.X < character[i].Location.X + 90f * character[i].Scale && Location.Y > character[i].Location.Y - 120f * character[i].Scale && Location.Y < character[i].Location.Y + 10f * character[i].Scale) { float dif = (float)Math.Abs(Location.X - character[i].Location.X); dif = 180f * character[i].Scale - dif; dif *= 2f; if (Location.X < character[i].Location.X) { CollisionMove = -dif; character[i].CollisionMove = dif; } else { CollisionMove = dif; character[i].CollisionMove = -dif; } } } } } } if (CollisionMove > 0f) { CollisionMove -= 400f * RuinExplorersMain.FrameTime; if (CollisionMove < 0f) CollisionMove = 0f; } if (CollisionMove < 0f) { CollisionMove += 400f * RuinExplorersMain.FrameTime; if (CollisionMove > 0f) CollisionMove = 0f; } #endregion #region Update Location by Trajectory Vector2 previousLocation = new Vector2(Location.X, Location.Y); if (State == CharacterState.Ground || (State == CharacterState.Air && floating)) { if (Trajectory.X > 0f) { Trajectory.X -= RuinExplorersMain.Friction * RuinExplorersMain.FrameTime; if (Trajectory.X < 0f) Trajectory.X = 0f; } if (Trajectory.X < 0f) { Trajectory.X += RuinExplorersMain.Friction * RuinExplorersMain.FrameTime; if (Trajectory.X > 0f) Trajectory.X = 0f; } } Location.X += Trajectory.X * RuinExplorersMain.FrameTime; Location.X += CollisionMove * RuinExplorersMain.FrameTime; if (State == CharacterState.Air) { Location.Y += Trajectory.Y * RuinExplorersMain.FrameTime; } #endregion #region Collision detection if (State == CharacterState.Air) { #region Air State if (floating) { Trajectory.Y += RuinExplorersMain.FrameTime * RuinExplorersMain.Gravity * 0.5f; if (Trajectory.Y > 100f) Trajectory.Y = 100f; if (Trajectory.Y < -100f) Trajectory.Y = -100f; } else Trajectory.Y += RuinExplorersMain.FrameTime * RuinExplorersMain.Gravity; CheckXCollision(map, previousLocation); #region Land on ledge if (Trajectory.Y > 0.0f) { for (int i = 0; i < 16; i++) { if (map.Legdes[i].TotalNodes > 1) { int ts = map.GetLedgeSection(i, previousLocation.X); int s = map.GetLedgeSection(i, Location.X); float fY; float tfY; if (s > -1 && ts > -1) { tfY = map.GetLedgeYLocation(i, s, previousLocation.X); fY = map.GetLedgeYLocation(i, s, Location.X); if (previousLocation.Y <= tfY && Location.Y >= fY) { if (Trajectory.Y > 0.0f) { Location.Y = fY; ledgeAttach = i; Land(); } } else if (map.Legdes[i].isHardLedge == (int)LedgeFlags.Solid && Location.Y >= fY) { Location.Y = fY; ledgeAttach = i; Land(); } } } } } #endregion #region Land on col if (State == CharacterState.Air) { if (Trajectory.Y > 0f) { if (map.CheckCollision(new Vector2(Location.X, Location.Y + 15f))) { Location.Y = (float)((int)((Location.Y + 15f) / 64f) * 64); Land(); } } } #endregion #endregion } else if (State == CharacterState.Ground) { #region Grounded State if (ledgeAttach > -1) { if (map.GetLedgeSection(ledgeAttach, Location.X) == -1) { FallOff(); } else { Location.Y = map.GetLedgeYLocation(ledgeAttach, map.GetLedgeSection(ledgeAttach, Location.X), Location.X); } } else { if (!map.CheckCollision(new Vector2(Location.X, Location.Y + 15f))) FallOff(); } CheckXCollision(map, previousLocation); #endregion } #endregion #region Key input if (AnimationName == "idle" || AnimationName == "run" || (State == CharacterState.Ground && CanCancel)) { if (AnimationName == "idle" || AnimationName == "run") { if (keyLeft) { SetAnim("run"); Trajectory.X = -Speed; Face = CharacterDirection.Left; } else if (keyRight) { SetAnim("run"); Trajectory.X = Speed; Face = CharacterDirection.Right; } else { SetAnim("idle"); } } if (keyAttack) { SetAnim("attack"); } if (keySecondary) { SetAnim("second"); } if (keyJump) { SetAnim("jump"); } if (RightAnalog.X > 0.2f || RightAnalog.X < -0.2f) { SetAnim("roll"); if (AnimationName == "roll") { if (RightAnalog.X > 0f) Face = CharacterDirection.Right; else Face = CharacterDirection.Left; } } } if (AnimationName == "fly" || (State == CharacterState.Air && CanCancel)) { if (keyLeft) { Face = CharacterDirection.Left; if (Trajectory.X > -Speed) Trajectory.X -= 500f * RuinExplorersMain.FrameTime; } if (keyRight) { Face = CharacterDirection.Right; if (Trajectory.X < Speed) Trajectory.X += 500f * RuinExplorersMain.FrameTime; } if (keySecondary) { SetAnim("fsecond"); } if (keyAttack) { SetAnim("fattack"); } } #endregion }
/// <summary> /// Updates all active particles. /// </summary> /// <param name="frameTime">The frame time - time delta that has elapsed since the last update.</param> /// <param name="map">The current map.</param> /// <param name="characters">The characters array.</param> public void UpdateParticles(float frameTime, Map map, Character[] characters) { for (int i = 0; i < particles.Length; i++) { if (particles[i] != null) { particles[i].Update(frameTime, map, this, characters); if (!particles[i].Exists) particles[i] = null; } } }
public void NewGame() { gameMode = GameModes.Playing; particleManager.Reset(); map.Path = "start"; gameType = GameType.Solo; players = 1; for (int i = 0; i < players; i++) { characters[i] = new Character(new Vector2(300f + (float)i * 200f, 100f), characterDefinitions[(int)CharacterType.Player1], i, Character.TEAM_PLAYERS); characters[i].HP = characters[i].MHP = 100; } for (int i = players; i < characters.Length; i++) characters[i] = null; map.GlobalFlags = new MapFlags(64); map.Read(); map.TransDir = TransitionDirection.Intro; map.transInFrame = 1f; }
public void Update(ParticleManager particleManager, Character[] characters) { CheckTransitions(characters); if (transOutFrame > 0f) { transOutFrame -= RuinExplorersMain.FrameTime * 3f; if (transOutFrame <= 0) { path = transitionDestination[(int)TransDir]; Read(); transInFrame = 1.1f; for (int i = 1; i < characters.Length; i++) { characters[i] = null; } particleManager.Reset(); } } if (transInFrame > 0f) { transInFrame -= RuinExplorersMain.FrameTime * 3f; } if (mapScript.IsReading) mapScript.DoScript(characters); if (Bucket != null) { if (!Bucket.IsEmpty) Bucket.Update(characters); } frame += RuinExplorersMain.FrameTime; if (Fog > -1) { if ((int)(previousFrame * 10f) != (int)(frame * 10f)) particleManager.AddParticle(new Fog(RandomGenerator.GetRandomVector2(0f, 1280f, 600f, 1000f))); } for (int i = 0; i < 64; i++) { if (mapSegment[LAYER_MAP, i] != null) { if (segDef[mapSegment[LAYER_MAP,i].Index].Flags == (int)SegmentFlags.Torch) { particleManager.AddParticle(new Smoke( mapSegment[LAYER_MAP,i].location * 2f + new Vector2(10f,13f), RandomGenerator.GetRandomVector2(-50.0f, 50.0f, -300.0f, -200.0f), 1.0f, 0.8f, 0.6f, 1.0f, RandomGenerator.GetRandomFloat(0.25f, 0.5f), RandomGenerator.GetRandomInt(0, 4)), true); particleManager.AddParticle(new Fire( mapSegment[LAYER_MAP, i].location * 2f + new Vector2(10f, 37f), RandomGenerator.GetRandomVector2(-30.0f, 30.0f, -250.0f, -200.0f), RandomGenerator.GetRandomFloat(0.25f, 0.75f), RandomGenerator.GetRandomInt(0, 4)), true); // apparently heat is not the glowing orb I was looking for particleManager.AddParticle(new Heat(mapSegment[LAYER_MAP, i].location * 2f + new Vector2(10f, -37f), RandomGenerator.GetRandomVector2(-50f, 50f, -400f, -300f), RandomGenerator.GetRandomFloat(1f, 2f))); } } } previousFrame = frame; }
public void CheckTransitions(Character[] characters) { if (transOutFrame <= 0f && transInFrame <= 0f) { if (characters[0].DyingFrame > 0f) return; if (characters[0].Location.X > (float)xSize * 64f - 32f && characters[0].Trajectory.X > 0f && characters[0].keyRight && characters[0].AnimationName == "run") { if (transitionDestination[(int)TransitionDirection.Right] != "") { transOutFrame = 1f; TransDir = TransitionDirection.Right; } } if (characters[0].Location.X < 0f + 32f && characters[0].Trajectory.X < 0f && characters[0].keyLeft && characters[0].AnimationName == "run") { if (transitionDestination[(int)TransitionDirection.Left] != "") { transOutFrame = 1f; TransDir = TransitionDirection.Left; } } } }
public Script(Character _character) { this.character = _character; }
protected void DoJob(Character[] c, int ID) { switch (job) { case JOB_IDLE: //do nothing! break; case JOB_MELEE_CHASE: if (targ > -1 && c[targ] != null) { if (!ChaseTarg(c, c[ID].Scale * 100f)) { if (!FaceTarg(c)) { me.keyAttack = true; } } } else targ = FindTarg(c); break; case JOB_AVOID: if (targ > -1 && c[targ] != null) { AvoidTarg(c, 500f); } else targ = FindTarg(c); break; case JOB_SHOOT_CHASE: if (targ > -1 && c[targ] != null) { if (!ChaseTarg(c, 150f)) { if (!FaceTarg(c)) { me.keySecondary = true; } } } else targ = FindTarg(c); break; } if (!me.keyAttack && !me.keySecondary) { if (me.keyLeft) { if (FriendInWay(c, ID, CharacterDirection.Left)) me.keyLeft = false; } if (me.keyRight) { if (FriendInWay(c, ID, CharacterDirection.Right)) me.keyRight = false; } } }
public void DoScript(Character[] characters) { if (waiting > 0f) { waiting -= RuinExplorersMain.FrameTime; } else { bool done = false; while (!done) { currentLine++; if (Lines[currentLine] != null) { switch (Lines[currentLine].Command) { case ScriptCommands.Fog: map.Fog = Lines[currentLine].IntParameter; break; case ScriptCommands.Water: map.Water = (float)Lines[currentLine].IntParameter; break; case ScriptCommands.Monster: for (int i = 0; i < characters.Length; i++) { if (characters[i] == null) { characters[i] = new Character( Lines[currentLine].Vector2Parameter, RuinExplorersMain.CharacterDefinitions[(int)GetMonsterFromString(Lines[currentLine].StringParameter[1])], i, Character.TEAM_NPC); if (Lines[currentLine].StringParameter.Length > 4) characters[i].Name = Lines[currentLine].StringParameter[4]; break; } } break; case ScriptCommands.MakeBucket: map.Bucket = new Bucket(Lines[currentLine].IntParameter); break; case ScriptCommands.AddBucket: map.Bucket.AddItem(Lines[currentLine].Vector2Parameter, GetMonsterFromString(Lines[currentLine].StringParameter[1])); break; case ScriptCommands.IfNotBucketGoto: if (map.Bucket.IsEmpty) { GotoTag(Lines[currentLine].StringParameter[1]); } break; case ScriptCommands.Wait: waiting = (float)Lines[currentLine].IntParameter / 100f; done = true; break; case ScriptCommands.SetFlag: Flags.SetFlag(Lines[currentLine].StringParameter[1]); break; case ScriptCommands.IfTrueGoto: if (Flags.GetFlag(Lines[currentLine].StringParameter[1])) GotoTag(Lines[currentLine].StringParameter[2]); break; case ScriptCommands.IfFalseGoto: if (!Flags.GetFlag(Lines[currentLine].StringParameter[1])) GotoTag(Lines[currentLine].StringParameter[2]); break; case ScriptCommands.SetGlobalFlag: map.GlobalFlags.SetFlag(Lines[currentLine].StringParameter[1]); break; case ScriptCommands.IfGlobalTrueGoto: if (map.GlobalFlags.GetFlag(Lines[currentLine].StringParameter[1])) GotoTag(Lines[currentLine].StringParameter[2]); break; case ScriptCommands.IfGlobalFalseGoto: if (!map.GlobalFlags.GetFlag(Lines[currentLine].StringParameter[1])) GotoTag(Lines[currentLine].StringParameter[2]); break; case ScriptCommands.Stop: IsReading = false; done = true; break; case ScriptCommands.Tag: // break; case ScriptCommands.SetLeftExit: map.transitionDestination[(int)TransitionDirection.Left] = Lines[currentLine].StringParameter[1]; break; case ScriptCommands.SetRightExit: map.transitionDestination[(int)TransitionDirection.Right] = Lines[currentLine].StringParameter[1]; break; case ScriptCommands.SetLeftEntrance: if (map.TransDir == TransitionDirection.Right) { characters[0].Location = Lines[currentLine].Vector2Parameter; characters[0].Face = CharacterDirection.Right; characters[0].SetAnim("fly"); characters[0].State = CharacterState.Air; characters[0].Trajectory = new Vector2(200f, 0f); map.TransDir = TransitionDirection.None; } break; case ScriptCommands.SetRightEntrance: if (map.TransDir == TransitionDirection.Left) { characters[0].Location = Lines[currentLine].Vector2Parameter; characters[0].Face = CharacterDirection.Left; characters[0].SetAnim("fly"); characters[0].State = CharacterState.Air; characters[0].Trajectory = new Vector2(-200f, 0f); map.TransDir = TransitionDirection.None; } break; case ScriptCommands.SetIntroEntrance: if (map.TransDir == TransitionDirection.Intro) { characters[0].Location = Lines[currentLine].Vector2Parameter; characters[0].Face = CharacterDirection.Right; characters[0].SetAnim("fly"); characters[0].State = CharacterState.Air; characters[0].Trajectory = new Vector2(0f, 0f); map.TransDir = TransitionDirection.None; } break; default: break; } } } } }
protected bool FaceTarg(Character[] c) { if (c[targ] == null) return false; if (me.Location.X > c[targ].Location.X && me.Face == CharacterDirection.Right) { me.keyLeft = true; return true; } else if (me.Location.X > c[targ].Location.X && me.Face == CharacterDirection.Right) { me.keyRight = true; return true; } else return false; }
private bool FriendInWay(Character[] c, int ID, CharacterDirection face) { for (int i = 0; i < c.Length; i++) { if (i != ID) { if (c[i] != null) { if (me.Team == c[i].Team) { if (me.Location.Y > c[i].Location.Y - 100f && me.Location.Y < c[i].Location.Y + 10f) { if (face == CharacterDirection.Right) { if (c[i].Location.X > me.Location.X && c[i].Location.X < me.Location.X + 70f) return true; } else { if (c[i].Location.X < me.Location.X && c[i].Location.X > me.Location.X - 70f) return true; } } } } } } return false; }