public override void HandleCollision(ConstHelper.CollisionDir cDir, String meta) { if (cDir == ConstHelper.CollisionDir.LEFT) isMovingLeft = false; else if (cDir == ConstHelper.CollisionDir.RIGHT) isMovingLeft = true; //I got jumped on :( if (cDir == ConstHelper.CollisionDir.UP && meta == "player") { isSquished = true; isDeadly = false; AudioManager.PlaySfx("stomp"); this.Source = new Rectangle(32, 0, 16, 16); } //Plonk'd by a turtle shell if (meta == "turtle") { Collide = false; isDeadly = false; isPlonked = true; vVelocity.Y = -1.0f; vVelocity.X = -1.0f; } }
public override void HandleCollision(ConstHelper.CollisionDir CollDir, String meta) { if (CollDir == ConstHelper.CollisionDir.LEFT) isMovingLeft = false; else if (CollDir == ConstHelper.CollisionDir.RIGHT) isMovingLeft = true; }
public override void HandleCollision(ConstHelper.CollisionDir cDir, String meta) { if (cDir == ConstHelper.CollisionDir.LEFT) { isMovingLeft = false; vVelocity.X *= -1; this.FlipHorz = true; AudioManager.PlaySfx("shell_rico"); } else if (cDir == ConstHelper.CollisionDir.RIGHT) { isMovingLeft = true; vVelocity.X *= -1; this.FlipHorz = false; AudioManager.PlaySfx("shell_rico"); } //I got jumped on :( if (cDir == ConstHelper.CollisionDir.UP && meta == "player" && isShell == false) { isShell = true; isDeadly = false; AudioManager.PlaySfx("stomp"); this.Source = new Rectangle(0 + spriteOffset, 36, 16, 16); doesThrow = true; canThrow = true; throwableObject = ConstHelper.NPCType.LILTURTLE; ThrowObject(1); } else if (meta == "player" && isShell == true && isKicked == false && airState == ConstHelper.AirState.GROUND) { isKicked = true; } if (cDir == ConstHelper.CollisionDir.UP && meta == "player" && isShell == true && isKicked == true && airState == ConstHelper.AirState.GROUND) { isDeadly = false; isKicked = false; vVelocity.X = 0; } }
public void CreateNPC(ConstHelper.NPCType type, Vector2 position, Vector2 velocity) { if (type == ConstHelper.NPCType.GOOMBA) { NPC_Goomba g = new NPC_Goomba(); g.Load(ConstHelper.content, "Assets\\goomba.png", 16, 16); g.Position = position; g.Height = 16; g.vVelocity = velocity; //g.requestCreateNPCEvent += g_RequestCreateNPCEvent; listNPC.Add(g); } else if (type == ConstHelper.NPCType.TURTLE) { NPC_Turtle t = new NPC_Turtle(); t.Load(ConstHelper.content, "Assets\\turtle.png", 16, 26); t.Position = position; t.Height = 26; t.vVelocity = velocity; t.isRed = false; t.requestCreateNPCEvent += g_RequestCreateNPCEvent; listNPC.Add(t); } else if (type == ConstHelper.NPCType.LILTURTLE) { NPC_LilTurtle t = new NPC_LilTurtle(); t.Load(ConstHelper.content, "Assets\\lilturtle.png", 16, 26); t.Position = position; t.Height = 16; t.Eject(true); listNPC.Add(t); } }
/// <summary> /// Collision handling /// </summary> /// <param name="CollDir">Direction of the collision</param> /// <param name="meta">Extra data as to what hit me</param> public void HandleCollision(ConstHelper.CollisionDir CollDir, String meta) { //Player hit me from below if ((CollDir == ConstHelper.CollisionDir.DOWN && meta == "player") || meta == "shell") { if (blockType == BlockType.ITEM && isHit == false && itemContents != null) { foreach (Item_Base item in itemContents) { item.DeployItem(); isHit = true; item.isVisible = true; Source = new Rectangle(16*4, 0, 16, 16); } Position.Y -= moveOffset; isMoveHit = true; } } }
/// <summary> /// Collision handling for NPCs, etc /// </summary> /// <param name="CollDir">Direction of the collision</param> /// <param name="meta">Extra data as to what hit me</param> public virtual void HandleCollision(ConstHelper.CollisionDir CollDir, String meta) { return; }
public override void HandleCollision(ConstHelper.CollisionDir CollDir, String meta) { //Remove! Remove = true; }
public NPCCreateArgs(ConstHelper.NPCType type, Vector2 position, Vector2 velocity) { npctype = type; pos = position; vel = velocity; }