Beispiel #1
0
        public Enemy getEnemyAboveBlock(Block block)
        {
            foreach (Enemy i in enemies)
            {
                if (i.Velocity.Y != 0 || i.Stomped != -1 || i.Hurt != -1)
                    continue;

                if (new Rectangle(block.Position.X, block.Position.Y - block.Position.Height, block.Position.Width, block.Position.Height).Intersects(i.Position))
                    return i;
            }

            return null;
        }
Beispiel #2
0
        public Item getItemAboveBlock(Block block)
        {
            foreach (Item i in items)
            {
                if (i.Velocity.Y != 0 || i is ItemCoin)
                    continue;

                if (new Rectangle(block.Position.X, block.Position.Y - block.Position.Height, block.Position.Width, block.Position.Height).Intersects(i.Position))
                    return i;
            }

            return null;
        }
Beispiel #3
0
        public List<Block> getAdjacentBlocks(Block block)
        {
            List<Block> temp = new List<Block>();

            foreach (Block b in blocks)
            {
                if (((b.Position.X == block.Position.X - block.Position.Width || b.Position.X == block.Position.X + block.Position.Width) && b.Position.Y == block.Position.Y) || ((b.Position.Y == block.Position.Y - block.Position.Height || b.Position.Y == block.Position.Y + block.Position.Height) && b.Position.X == block.Position.X))
                {
                    temp.Add(b);
                }

            }

            return temp;
        }