Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 public override void HandleCollision(ConstHelper.CollisionDir CollDir, String meta)
 {
     if (CollDir == ConstHelper.CollisionDir.LEFT)
         isMovingLeft = false;
     else if (CollDir == ConstHelper.CollisionDir.RIGHT)
         isMovingLeft = true;
 }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
 /// <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;
         }
     }
 }
Exemplo n.º 6
0
 /// <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;
 }
Exemplo n.º 7
0
 public override void HandleCollision(ConstHelper.CollisionDir CollDir, String meta)
 {
     //Remove!
     Remove = true;
 }
Exemplo n.º 8
0
 public NPCCreateArgs(ConstHelper.NPCType type, Vector2 position, Vector2 velocity)
 {
     npctype = type;
     pos = position;
     vel = velocity;
 }