public PlayerFlame(GameScene game, Vector position, double direction, bool blackPlayer) : base(game, RADIUS, position, Vector.Zero, 4) { this.velocity = SPEED * new Vector(Math.Cos(direction / 180.0 * Math.PI), Math.Sin(direction / 180.0 * Math.PI)); this.direction = direction; animation = 0; }
public GameScene(int numRows, int numCols) { random = new Random(); map = new Map(this, numRows, numCols); player = null; camera = Vector.Zero; players = new ThingList(); enemies = new ThingList(); enemyAddList = new ThingList(); playerBullets = new BulletList(); enemyBullets = new BulletList(); items = new ThingList(); door = null; particles = new ParticleList(); particleAddList = new ParticleList(); quakeRadius = 0; quakeVector = Vector.Zero; flash = 0; numTicks = 0; cleared = false; clearTimer = 0; gameoverTimer = 0; gameover = false; backgroundParticles = new ParticleList(); audio = null; }
public Particle(GameScene game, Vector position, Vector velocity) { this.game = game; this.position = position; this.velocity = velocity; removed = false; }
public PlayerBullet3(GameScene game, Vector position, double direction, double speed, bool blackPlayer) : base(game, RADIUS, position, Vector.Zero, 1) { this.direction = direction; this.velocity = speed * new Vector(Math.Cos(this.direction / 180.0 * Math.PI), Math.Sin(this.direction / 180.0 * Math.PI)); life = 8; animation = 0; }
public PlayerBullet2(GameScene game, Vector position, int direction, bool blackPlayer) : base(game, RADIUS, position, Vector.Zero, 3) { this.direction = (double)direction + 3.0 * game.Random.NextDouble() - 1.5; this.velocity = 12 * new Vector(Math.Cos(this.direction / 180.0 * Math.PI), Math.Sin(this.direction / 180.0 * Math.PI)); life = int.MaxValue; animation = 0; }
public PlayerBullet(GameScene game, Vector position, int direction, bool blackPlayer) : base(game, RADIUS, position, Vector.Zero, 3) { this.velocity = 0.5 * SPEED * new Vector(Math.Cos((double)direction / 180.0 * Math.PI), Math.Sin((double)direction / 180.0 * Math.PI)); this.direction = direction; life = int.MaxValue; animation = 0; }
public StarmanBullet(GameScene game, Vector position, Starman.Direction direction, double x) : base(game, RADIUS, position, new Vector(direction == Starman.Direction.Left ? -1 : 1, 0), DAMAGE) { this.direction = direction; baseHeight = position.Y; count = 0; this.x = x; }
public Worm(GameScene game, Vector position) : base(game, new Rectangle(new Vector(8, 24), new Vector(16, 8)), position, Vector.Zero, INIT_HEALTH / 2) { direction = game.Random.Next(0, 2) == 0 ? Direction.Left : Direction.Right; stateCount = game.Random.Next(30, 60); running = true; animation = 0; }
public Bullet(GameScene game, double radius, Vector position, Vector velocity, int damage) { this.game = game; this.radius = radius; this.position = position; this.velocity = velocity; this.damage = damage; removed = false; }
public KyoroRocket(GameScene game, Vector position, int direction, bool blackPlayer) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.direction = direction; speed = 0; life = 600; maxRotAngle = 0.125; animation = 0; }
public RobotRocket(GameScene game, Vector position, int direction, double rotate) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.direction = direction; speed = 8; this.rotate = rotate; life = 120 - (int)Math.Round(15 * rotate); animation = 0; }
public PlayerFlame(GameScene game, Vector position, double direction) : base(game, RADIUS, position, Vector.Zero, 4) { this.velocity = SPEED * new Vector(Math.Cos(direction / 180.0 * Math.PI), Math.Sin(direction / 180.0 * Math.PI)); this.direction = direction; animation = 0; if (game.DebugMode) damage *= 8; }
public PlayerBullet2(GameScene game, Vector position, int direction) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.direction = (double)direction + 6.0 * game.Random.NextDouble() - 3.0; this.velocity = SPEED * new Vector(Math.Cos(this.direction / 180.0 * Math.PI), Math.Sin(this.direction / 180.0 * Math.PI)); life = 40; animation = 0; if (game.DebugMode) damage *= 8; }
public PlayerBullet3(GameScene game, Vector position, double direction, double speed) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.direction = direction; this.velocity = speed * new Vector(Math.Cos(this.direction / 180.0 * Math.PI), Math.Sin(this.direction / 180.0 * Math.PI)); life = 8; animation = 0; if (game.DebugMode) damage *= 8; }
public PlayerRocket(GameScene game, Vector position, int direction) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.direction = direction; speed = 0; life = 48; animation = 0; if (game.DebugMode) damage *= 8; }
public Hanabi(GameScene game, Vector explosion, bool big, int colorIndex) : base(game, new Vector(explosion.X, 512), new Vector(0, -8)) { explodeY = explosion.Y; exploding = false; animation = -1; this.big = big; this.colorIndex = colorIndex; flip = game.Random.Next(0, 2) == 0; }
public Mushroom(GameScene game, Vector position) : base(game, new Rectangle(new Vector(8, 24), new Vector(16, 8)), position, Vector.Zero, INIT_HEALTH / 2) { direction = game.Random.Next(0, 2) == 0 ? Direction.Left : Direction.Right; currentState = State.Rise; attackCount = 0; attackCount2 = 0; angle = 270; animation = 0; aggressive = true; }
public PlayerFlameParticle(GameScene game, Vector position, Vector velocity, int animation) : this(game, position, velocity) { if (animation == 32) { this.animation = 31; } else { this.animation = animation; } }
public PlayerRocketTail(GameScene game, Vector position, Vector velocity, int animation) : this(game, position, velocity) { if (animation == 32) { this.animation = 31; } else { this.animation = animation; } }
public Father(GameScene game, int row, int col) : base(game, RECTANGLE, new Vector(col * Settings.BLOCK_WDITH, row * Settings.BLOCK_WDITH), Vector.Zero, INIT_HEALTH) { baseHeight = position.Y; basePos = position; targetPos = position; stateCount = 0; teleporting = false; attacking = false; wideAttack = false; numDeathTicks = 0; }
public FatherBullet(GameScene game, Vector position, Vector waitPos, bool facePlayer, int timer) : base(game, RADIUS, position, Vector.Zero, DAMAGE) { this.waitPos = waitPos; this.facePlayer = facePlayer; this.timer = timer; stateCount = 0; direction = 0; color = 2 * game.Random.Next(0, 3); if (game.Random.Next(0, 8) == 0) color++; velocity = 0.015625 * (waitPos - position); }
public Rain(GameScene game, bool background) : base(game, Vector.Zero, Vector.Zero) { this.background = background; if (!background) { position = new Vector(game.Map.Width * game.Random.NextDouble(), game.Map.Height * game.Random.NextDouble()); velocity.Y = 16 + 16 * game.Random.NextDouble(); } else { position = new Vector(1024 * game.Random.NextDouble(), 512 * game.Random.NextDouble()); velocity.Y = 8 + 8 * game.Random.NextDouble(); } }
public Norio(GameScene game, int row, int col, Direction direction) : base(game, RECTANGLE, new Vector(col * Settings.BLOCK_WDITH, row * Settings.BLOCK_WDITH), Vector.Zero, INIT_HEALTH) { this.direction = direction; if (game.Random.Next(0, 2) == 0) { double rand = game.Random.NextDouble(); attackPos = new Vector(-128 - 128 * rand, -128 - 128 * rand); } else { double rand = game.Random.NextDouble(); attackPos = new Vector(128 + 128 * rand, -128 - 128 * rand); } attacking = false; attackCount = 0; attackCount2 = 0; }
public Byaa(GameScene game, Vector position, Direction direction, bool ghost) : base(game, RECTANGLE, position, Vector.Zero, INIT_HEALTH) { this.direction = direction; if (game.Random.Next(0, 2) == 0) { attackPos = new Vector(-128 - 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble()); } else { attackPos = new Vector(128 + 128 * game.Random.NextDouble(), -128 - 128 * game.Random.NextDouble()); } attacking = false; attackCount = 0; attackCount2 = 120; health = 50; dropItem = true; this.ghost = ghost; }
public Player(GameScene game, int row, int col, Direction direction) : base(game, RECTANGLE, new Vector(col * Settings.BLOCK_WDITH, row * Settings.BLOCK_WDITH), Vector.Zero, INIT_HEALTH) { this.direction = direction; arm = ArmDirection.Forward; landState = LandState.InAir; weapon = Weapon.Pistol; ammo = 0; jumpCount = -1; fireCount = -1; animation = 0; enemyDamageCount = 0; freeze = false; armAnimation = 0; visible = true; drawHealth = health; focus = Vector.Zero; ammoHudColorCount = 0; ammoNumColorCount = 0; }
public GameScene(StageData data) { random = new Random(); map = data.GetMap(this); // player = new Player(this, 6, 1, Player.Direction.Right); player = data.GetPlayer(this); MoveCameraFast(player.Focus); players = new ThingList(); players.AddThing(player); // enemies = new ThingList(); enemies = data.GetEnemies(this); enemyAddList = new ThingList(); playerBullets = new BulletList(); enemyBullets = new BulletList(); items = new ThingList(); door = data.GetExitDoor(this); particles = new ParticleList(); particleAddList = new ParticleList(); quakeRadius = 0; quakeVector = Vector.Zero; flash = 0; numTicks = 0; cleared = false; clearTimer = 0; gameoverTimer = 0; gameover = false; backgroundParticles = new ParticleList(); audio = null; /* enemies.AddThing(new TestEnemy(this, 7, 24, TestEnemy.Direction.Left)); enemies.AddThing(new TestEnemy(this, 12, 11, TestEnemy.Direction.Left)); enemies.AddThing(new TestEnemy(this, 12, 24, TestEnemy.Direction.Left)); enemies.AddThing(new TestEnemy(this, 16, 8, TestEnemy.Direction.Left)); enemies.AddThing(new TestEnemy(this, 22, 17, TestEnemy.Direction.Left)); */ }
public HouseBullet(GameScene game, Vector position, Vector velocity) : base(game, RADIUS, position, velocity, DAMAGE) { }
public virtual void Tick() { position += velocity; }
private void MoveCameraFast(Vector target) { Vector focus = target - (0.5 * new Vector(Settings.SCREEN_WIDTH, Settings.SCREEN_HEIGHT)); if (focus.X < 0) { focus.X = 0; } else if (map.Width - Settings.SCREEN_WIDTH < focus.X) { focus.X = map.Width - Settings.SCREEN_WIDTH; } if (focus.Y < 0) { focus.Y = 0; } else if (map.Height - Settings.SCREEN_HEIGHT < focus.Y) { focus.Y = map.Height - Settings.SCREEN_HEIGHT; } camera = focus; }
public override void Tick(GameInput input) { if (attackCount2 > 0) { attackCount2--; } double dx = game.Player.Center.X - Center.X; double dy = game.Player.Center.Y - Center.Y; playerDetected = false; if (attacking) { velocity.X = 0; if (attackCount < 32) { if (attackCount == 0) { game.PlaySound(GameSound.Kue); } attackCount++; if (attackCount == 16) { Vector posFix; if (direction == Direction.Left) { posFix = new Vector(16, 16); } else { posFix = new Vector(48, 16); } game.AddEnemyBullet(new KyoroRocket(game, position + posFix, direction == Direction.Left ? 180 + 15 : -15)); game.PlaySound(GameSound.Rocket); playerRange = game.Random.Next(128, 320); } } if (attackCount >= 32) { attacking = false; attackCount = 0; } playerDetected = true; animation = 0; } else if (Math.Abs(dx) < 320 && Math.Abs(dy) < 128) { playerDetected = true; if (dx < 0) { direction = Direction.Left; } else if (dx > 0) { direction = Direction.Right; } if (attackCount2 == 0) { attacking = true; attackCount2 = game.Random.Next(60, 120); } else { if (Math.Abs(Math.Abs(dx) - playerRange) < 4) { velocity.X = 0; animation = 0; } else if (Math.Abs(dx) < playerRange) { if (dx < 0) { velocity.X = 1; } else if (dx > 0) { velocity.X = -1; } animation = (animation + 1) % NUM_ANIMATIONS; } else { if (dx < 0) { velocity.X = -1; } else if (dx > 0) { velocity.X = 1; } animation = (animation + 1) % NUM_ANIMATIONS; } } } else { if (direction == Direction.Left) { velocity.X = -1; } else { velocity.X = 1; } animation = (animation + 1) % NUM_ANIMATIONS; } velocity.Y += ACCELERATION_FALLING; if (velocity.Y > MAX_FALLING_SPEED) { velocity.Y = MAX_FALLING_SPEED; } MoveBy(input, velocity); base.Tick(input); // Console.Write(attackCount + ","); }