Example #1
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);
            }
        }
Example #2
0
        //Kick a shell if I got one
        public void KickShell()
        {
            if (tHeld != null)
            {
                if (isUpKeyDown == true)
                {
                    tHeld.Position.Y -= 8;
                    tHeld.KickShell(0);
                    if (isLeft)
                    {
                        tHeld.isMovingLeft = true;
                        tHeld.Position.X -= 8;
                    }
                    else
                    {
                        tHeld.isMovingLeft = false;
                        tHeld.Position.X += 8;
                    }

                    tHeld.vVelocity.X += MathHelper.Clamp(vVelocity.X, -2f, 2f);
                    tHeld.vVelocity.Y = speedShellYKick;
                }
                else
                {
                    tHeld.vVelocity.Y = -2;
                    if (isLeft)
                    {
                        tHeld.isMovingLeft = true;
                        tHeld.Position.X -= 16;
                        tHeld.KickShell(-1);
                    }
                    else
                    {
                        tHeld.isMovingLeft = false;
                        tHeld.Position.X += 16;
                        tHeld.KickShell(1);
                    }
                    tHeld.vVelocity.X += vVelocity.X;
                }

                DoHitFX();
                tHeld.isHeld = false;
                tHeld.Collide = true;
                tHeld = null;

                AudioManager.PlaySfx("kick");
            }
        }
Example #3
0
 //Add a grabbed shell
 public void GrabShell(NPC_Turtle shell)
 {
     tHeld = shell;
     tHeld.Collide = false;
 }