Ejemplo n.º 1
0
        public Gremlin(GameWorld world, int x, int y, int level)
            : base(world, (x - 1) * 20, (y - 2) * 20, 60, 60)
        {
            this.level = level;

            elapsedTime = random.Next(500) + 500;
        }
Ejemplo n.º 2
0
 public Player(GameWorld world, int x, int y)
     : base(world, x*20, y*20, 20, 40)
 {
     gun = new Gun(this);
     respawnX = x;
     respawnY = y;
 }
Ejemplo n.º 3
0
 public DamageEffect(GameWorld world, double x, double y, double power)
     : base(world,x,y)
 {
     particles = new List<Particle>();
     for (int a = 0; a < 10; a++)
         particles.Add(new Particle(world, x, y, random.NextDouble() * 2 * Math.PI, random.NextDouble() * 30*power + 20*power));
 }
Ejemplo n.º 4
0
            public Particle(GameWorld world, double x, double y, double angle, double speed)
            {
                this.world = world;

                bounds = new Rectangle2D(x, y, 2, 2);

                velocity = new Vector2((float)(speed * Math.Cos(angle)), (float)(speed * Math.Sin(angle)));
            }
Ejemplo n.º 5
0
        public Explosion(GameWorld world, double x, double y, double dir, int life)
            : base(world,x,y,12,12)
        {
            this.vX = Math.Cos(dir) * 60 + (random.NextDouble() - random.NextDouble()) * 15;
            this.vY = Math.Sin(dir) * 60 + (random.NextDouble() - random.NextDouble()) * 15;
            this.life = life;

            currentColor = 4 + random.Next(3);
        }
Ejemplo n.º 6
0
        public Bullet(GameWorld world, Entity origin, double x, double y, double px, double py)
            : base(world,x,y,3,3)
        {
            this.origin = origin;

            double speed = 200;
            vx = speed * (px - x) / Math.Sqrt((px - x) * (px - x) + (py - y) * (py - y));
            vy = speed * (py - y) / Math.Sqrt((px - x) * (px - x) + (py - y) * (py - y));

            Assets.getAssets().pew.Play();
        }
Ejemplo n.º 7
0
        public Boss(GameWorld world, int x, int y)
            : base(world, (x*20) + dist * Math.Cos(Math.PI), (y*20) - dist * Math.Sin(Math.PI),30,30)
        {
            neck = new List<BossNeck>();

            this.origX = x * 20;
            this.origY = y * 20;

            for (int a = 0; a < 10; a++)
                neck.Add(new BossNeck(world, x * 20, y * 20, a * 15, Math.PI/2 + (Math.PI/2) * Math.Sin((a/10.0) * Math.PI/2)));
        }
Ejemplo n.º 8
0
        public Enemy(GameWorld world, Player player, double x, double y, double direction, double power)
            : base(world, x, y, 12, 12)
        {
            this.player = player;

            timePassed = random.Next(1000);

            if (direction == -1)
                return;

            double speed = power * (random.Next(100) + 250);
            this.vX = speed * Math.Cos(direction);
            this.vY = speed * Math.Sin(-direction);
        }
Ejemplo n.º 9
0
        public Transition(Shooter shooter, GameWorld oldWorld, GameWorld newWorld, int direction, Player player)
            : base(shooter)
        {
            this.oldWorld = oldWorld;
            this.newWorld = newWorld;
            this.player = player;

            switch (direction)
            {
                case RIGHT: vx = 1; break;
                case LEFT: vx = -1; break;
                case DOWN: vy = 1; break;
                case UP: vy = -1; break;
            }

            newWorld.Camera.x = 32 * 20 * -vx;
            newWorld.Camera.y = 24 * 20 * -vy;
        }
Ejemplo n.º 10
0
 public TNT(GameWorld world, int x, int y)
     : base(world,x,y,1,0)
 {
 }
Ejemplo n.º 11
0
 public MovableBlock(GameWorld world, int x, int y)
     : base(world, x, y, 2, 0)
 {
 }
Ejemplo n.º 12
0
 public Sign(GameWorld world, int x, int y, uint id)
     : base(world, x, y, id == 6 ? 5 : id == 15 ? 6 : 4, 0)
 {
     this.id = id;
 }
Ejemplo n.º 13
0
 public Entity(GameWorld world, double x, double y, double width, double height)
 {
     this.world = world;
     textures = new Dictionary<string, Texture2D>();
     bounds2D = new Rectangle2D(x, y, width, height);
 }
Ejemplo n.º 14
0
 public SignReadScreen(GameWorld world, uint id)
     : base(world.Game)
 {
     this.world = world;
     this.id = id-1;
 }
Ejemplo n.º 15
0
 public TransparentBlock(GameWorld world, int x, int y)
     : base(world, x, y, 1, 1)
 {
 }
Ejemplo n.º 16
0
 public ExplodingBlock(GameWorld world, int x, int y)
     : base(world, x, y)
 {
     ImageX = 7;
 }
Ejemplo n.º 17
0
 public ConveyorBelt(GameWorld world, int x, int y, bool facingLeft)
     : base(world, x, y, 0, facingLeft ? 2 : 3)
 {
 }
Ejemplo n.º 18
0
 public Entity(GameWorld world)
     : this(world,0,0)
 {
 }
Ejemplo n.º 19
0
 public Block(GameWorld world, int x, int y, int imageX, int imageY)
     : base(world, x * 20, y * 20, 20, 20)
 {
     this.imageX = imageX;
     this.imageY = imageY;
 }
Ejemplo n.º 20
0
 public Block(GameWorld world, int x, int y)
     : this(world,x,y,0,0)
 {
 }
Ejemplo n.º 21
0
 public Jabberwocky(GameWorld world, int x, int y)
     : base(world, (x - 1) * 20, (y - 2) * 20, 60, 60)
 {
 }
Ejemplo n.º 22
0
 public Spikes(GameWorld world, int x, int y, bool flip)
     : base(world,x,y,3,flip ? 1 : 0)
 {
 }
Ejemplo n.º 23
0
        public GameWorld load(int levelX, int levelY)
        {
            if (levelX == 3 && levelY == 11)
            {
                shooter.setScreen(new WinScreen(shooter));
                return null;
            }

            currentLevelX = levelX;
            currentLevelY = levelY;

            world = new GameWorld(shooter);

            bool addPlayer = false;

            for (int y = 0; y < 24; y++)
            {
                for (int x = 0; x < 32; x++)
                {
                    uint p = map[(levelY * 24 + y - levelY) * imageWidth + levelX * 32 + x - levelX];
                    switch (p)
                    {
                        case 0xFFFFFFFF:
                            world.add(new Block(world, x, y));
                            break;
                        case 0xFF00FFFF:
                            world.add(new MovableBlock(world, x, y));
                            break;
                        case 0xFFFF00FF:
                            world.add(new TNT(world, x, y));
                            break;
                        case 0xFF0000FF:
                            world.add(new Spikes(world, x, y, map[(levelY * 24 + y - levelY + 1) * imageWidth + levelX * 32 + x - levelX] == 0x000000FF));
                            break;
                        case 0xB7B7B7FF:
                            world.add(new TransparentBlock(world, x, y));
                            break;
                        case 0xFF5050FF:
                            world.add(new ConveyorBelt(world, x, y, true));
                            break;
                        case 0xFF5051FF:
                            world.add(new ConveyorBelt(world, x, y, false));
                            break;
                        case 0x383838FF:
                            world.add(new Door(world, x, y));
                            break;
                        case 0xA3FFFFFF:
                            world.add(new ExplodingBlock(world, x, y));
                            break;
                        case 0x83FFFFFF:
                            world.add(new Boss(world, x, y));
                            break;
                        case 0x80FFFFFF:
                            world.add(new Gremlin(world, x, y, 0));
                            break;
                        case 0x81FFFFFF:
                            world.add(new Gremlin(world, x, y, 1));
                            break;
                        case 0x82FFFFFF:
                            world.add(new Jabberwocky(world, x, y));
                            break;
                        case 0xFFADF8FF:
                            if (hats[currentLevelX,currentLevelY])
                                break;
                            world.add(new Hat(world, x * 20, y * 20, true));
                            break;
                        case 0x0000FFFF:
                            if (player != null)
                            {
                                player.setRespawn(x, y-1, player.IsFacingRight, player.HatLevel);
                                continue;
                            }

                            player = new Player(world, x, y-1);
                            addPlayer = true;
                            break;
                        case 0x00FFFFFF:
                            world.add(new Enemy(world, player, x*20 + 10, y*20 + 8, -1, 1));
                            break;
                        default:
                            if ((p & 0x00FFFFFF) == 0x00FF00FF && (p & 0xFF0000FF) > 256)
                            {
                                world.add(new Sign(world, x, y, (p >> 24) & 0xFF));
                            }
                            break;
                    }
                }
            }

            if(addPlayer && player != null)
                world.add(player);

            return world;
        }
Ejemplo n.º 24
0
            public BossNeck(GameWorld world, double origX, double origY, double dist, double startingRot)
            {
                this.World = world;

                this.origX = origX;
                this.origY = origY;
                this.dist = dist;

                Rot = startingRot;
            }
Ejemplo n.º 25
0
 public Door(GameWorld world, int x, int y)
     : base(world, x, y, 4, 1)
 {
 }
Ejemplo n.º 26
0
 public Hat(GameWorld world, double x, double y, bool isExtra)
     : base(world, x, y, 20, 10)
 {
     this.isExtra = isExtra;
 }
Ejemplo n.º 27
0
 public Entity(GameWorld world, double x, double y)
     : this(world, x, y, 0, 0)
 {
 }