public AntiFairy(LevelState parentWorld, Vector2 position) { this.position = position; this.parentWorld = parentWorld; this.dimensions = GlobalGameConstants.TileSize; anim = AnimationLib.getFrameAnimationSet("antiFairy"); animation_time = 0.0f; enemy_type = EnemyType.Guard; enemy_life = 70; prob_item_drop = 0.5; number_drop_items = 7; if (position.X > 0) { other = new AntiFairy(parentWorld, new Vector2(-100, 100)); doubled = false; } else { doubled = true; } fairyState = (AntiFairyState)(Game1.rand.Next() % 4); }
public TestEnemy(LevelState parentWorld, Vector2 position) { this.position = position; dimensions = new Vector2(48f, 48f); state = EnemyState.Moving; direction_facing = GlobalGameConstants.Direction.Right; velocity = new Vector2(0.0f, 0.0f); change_direction_time = 0.0f; change_direction = 0; changeDirectionIdleDuration = 300f; this.parentWorld = parentWorld; enemy_life = 10; enemy_damage = 1; damage_player_time = 0.0f; knockback_magnitude = 1.0f; walk_down = AnimationLib.loadNewAnimationSet("zippyDown"); walk_right = AnimationLib.loadNewAnimationSet("zippyRight"); walk_up = AnimationLib.loadNewAnimationSet("zippyUp"); current_skeleton = walk_right; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("run"); current_skeleton.Skeleton.FlipX = false; enemyAnim = AnimationLib.getFrameAnimationSet("enemyPic"); animation_time = 0.0f; }
public InGameGUI(LevelState parent) { this.parent = parent; if (prices == null) { prices = new PriceDisplay[3]; } for (int i = 0; i < windowIsActive.Length; i++) { windowIsActive[i] = false; } blackFadeOverlay = 0.0f; keyFoundPic = AnimationLib.getFrameAnimationSet("keyPic"); keyNotFoundPic = AnimationLib.getFrameAnimationSet("keyEmptyPic"); coinAnim = AnimationLib.getFrameAnimationSet("testCoin"); medAnim = AnimationLib.getFrameAnimationSet("itemHealth"); ammoAnim = AnimationLib.getFrameAnimationSet("itemBattery"); arrowPointer = AnimationLib.getFrameAnimationSet("compassArrow"); mapIcon = TextureLib.getLoadedTexture("mapPda.png"); testWin = new BoxWindow("foo", 100, 100, 200, "GamePad code overflowing with madness"); flickerTime = 0.0f; playerOutOfSight = false; }
public ReturnChaseEnemy(LevelState parentWorld, float initial_x, float initial_y) { position = new Vector2(initial_x, initial_y); dimensions = new Vector2(48.0f, 48.0f); original_position = CenterPoint; velocity = new Vector2(0.0f, 0.0f); enemy_damage = 10; enemy_life = 15; distance = 0.0f; angle = 0.0f; angle1 = 0.0f; angle2 = 0.0f; knockback_magnitude = 2.0f; disable_movement_time = 0.0f; return_timer = 0.0f; direction_facing = GlobalGameConstants.Direction.Right; change_direction_time = 0.0f; enemy_found = false; state = EnemyState.Idle; component = new IdleSearch(); this.parentWorld = parentWorld; walk_down = AnimationLib.getSkeleton("chaseDown"); walk_right = AnimationLib.getSkeleton("chaseRight"); walk_up = AnimationLib.getSkeleton("chaseUp"); current_skeleton = walk_right; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("idle"); current_skeleton.Skeleton.FlipX = false; chaseAnim = AnimationLib.getFrameAnimationSet("chasePic"); animation_time = 0.0f; }
public AlienChaser(LevelState parentWorld, Vector2 position) { this.parentWorld = parentWorld; this.position = position; this.dimensions = GlobalGameConstants.TileSize; enemy_type = EnemyType.Alien; enemy_life = 15; chaserState = SlowChaserState.Idle; direction_facing = GlobalGameConstants.Direction.Down; animation_time = 0.0f; konamiAlert = AnimationLib.getFrameAnimationSet("konamiPic"); number_drop_items = 4; prob_item_drop = 0.3f; directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("alienChaserUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("alienChaserDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("alienChaserRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("alienChaserRight"); for (int i = 0; i < 4; i++) { directionAnims[i].Animation = directionAnims[i].Skeleton.Data.FindAnimation("run"); } aggressionTime = 0.0f; }
public WandOfGyges() { wandPic = AnimationLib.getFrameAnimationSet("wandProjectile"); shot.active = false; delayTimer = 0; }
public BetaEndLevelFag(LevelState parent, Vector2 position) { this.parentWorld = parent; this.position = position; this.dimensions = GlobalGameConstants.TileSize; anims = AnimationLib.getFrameAnimationSet("flagPic"); }
public Compass() { if (img == null) { img = AnimationLib.getFrameAnimationSet("compassArrow"); img2 = AnimationLib.getFrameAnimationSet("compassOverlay"); } drawPointer = false; }
public Bomb() { hitbox = hitbox_placed; time_explosion = 0.0f; bomb_state = Bomb_State.reset; bomb_damage = 5; bombAnim = AnimationLib.getFrameAnimationSet("bombArmed"); explosionAnim = AnimationLib.getFrameAnimationSet("rocketExplode"); knockback_magnitude = 5.0f; }
public ShotGun() { inactive_pellets = 0; pellet_count = 0; shotgun_active = false; damage_delay_flag = false; damage_delay_timer = 0.0f; bulletAnim = AnimationLib.getFrameAnimationSet("testBullet"); }
public Gun() { if (bulletPic == null) { bulletPic = AnimationLib.getFrameAnimationSet("testBullet"); } bullets = new GunBullet[bulletCount]; fireTimer = float.MaxValue; }
public Sword() { hitbox.X = 48.0f; hitbox.Y = 48.0f; item_state_time = 0.0f; sword_damage = 5; knockback_magnitude = 1.0f; sword_state = Sword_State.preslash; swordAnim = AnimationLib.getFrameAnimationSet("swordPic"); }
public BushidoBlade(Vector2 initial_position) { position = initial_position; hitbox = new Vector2(48.0f, 48.0f); sword_damage = 999999999; item_state_time = 0.0f; player_health = GameCampaign.Player_Health; animation_time = 0.0f; bushidoAnim = AnimationLib.getFrameAnimationSet("bombExplosion"); knockback_magnitude = 1.0f; glowTime = 0; }
public WaveMotionGun() { if (bulletAnimation == null) { bulletAnimation = AnimationLib.getFrameAnimationSet("waveMotionBullet"); } bullet1.active = false; bullet2.active = false; bullet3.active = false; state = WaveMotionState.Wait; }
public Key(LevelState parent, Vector2 position, LevelKeyModule.KeyColor color) { this.parentWorld = parent; this.position = position; this.velocity = Vector2.Zero; this.dimensions = new Vector2(48f, 48f); this.color = color; isKnockedBack = false; knockedBackTime = 0.0f; keyGraphic = AnimationLib.getFrameAnimationSet("keyPic"); }
public GuardMech(LevelState parentWorld, float initial_x, float initial_y) { position = new Vector2(initial_x, initial_y); melee_position = Vector2.Zero; dimensions = new Vector2(96, 120); velocity = new Vector2(0.8f, 0.0f); flame_position = Vector2.Zero; windup_timer = 0.0f; angle = 0.0f; turret_angle = angle; enemy_life = 75; disable_movement = false; disable_movement_time = 0.0f; enemy_found = false; change_direction_time = 0.0f; this.parentWorld = parentWorld; enemy_type = EnemyType.Guard; change_direction_time_threshold = 3000.0f; direction_facing = GlobalGameConstants.Direction.Right; prob_item_drop = 0.6; number_drop_items = 5; component = new MoveSearch(); mech_state = MechState.Moving; enemy_type = EnemyType.Guard; velocity_speed = 3.0f; entity_found = null; death = false; tank_hull_animation_time = 0.0f; explode_timer = 0.0f; rocket_angle = 0.0f; grenade = new Grenades(Vector2.Zero, 0.0f); walk_down = AnimationLib.loadNewAnimationSet("tankTurret"); current_skeleton = walk_down; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("idle"); current_skeleton.Skeleton.FlipX = false; animation_time = 0.0f; range_distance = 600.0f; tankAnim = AnimationLib.getFrameAnimationSet("tank"); tankDeadAnim = AnimationLib.getFrameAnimationSet("tankDead"); plasmaExplode = AnimationLib.getFrameAnimationSet("plasmaExplodeLong"); tankTurretDeadAnim = AnimationLib.getFrameAnimationSet("tankTurretDead"); rocketProjectile = AnimationLib.getFrameAnimationSet("rocketProjectile"); }
public BroodLing(LevelState parentWorld, Vector2 position, BroodLord lord) { minionState = BroodLingState.Dead; this.parentWorld = parentWorld; this.dimensions = GlobalGameConstants.TileSize * 0.6f; this.lord = lord; enemy_life = 0; enemy_type = EnemyType.Alien; animation_time = 0; anim = AnimationLib.loadNewAnimationSet("broodling"); eggAnim = AnimationLib.getFrameAnimationSet("broodEgg"); }
public override void draw(Spine.SkeletonRenderer sb) { AnimationLib.FrameAnimationSet dropAnim = null; dropAnim = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)item_type].pickupImage; if (dropAnim != null) { dropAnim.drawAnimationFrame(0.0f, sb, position, new Vector2(1), 0.5f, 0.0f, Vector2.Zero, Color.White); } else { //sb.Draw(Game1.whitePixel, position, null, Color.Black, 0.0f, Vector2.Zero, dimensions, SpriteEffects.None, 0.5f); } }
public RocketLauncher() { if (rocketSprite == null) { rocketSprite = AnimationLib.getFrameAnimationSet("rocketProjectile"); } if (explosionAnim == null) { explosionAnim = AnimationLib.getFrameAnimationSet("rocketExplode"); } rocket.active = false; state = RocketLauncherState.IdleWait; }
public MutantAcidSpitter(LevelState parentWorld, float initial_x, float initial_y) { position = new Vector2(initial_x, initial_y); velocity_speed = 2.0f; velocity = new Vector2(velocity_speed, 0); dimensions = new Vector2(48.0f, 48.0f); enemy_damage = 4; enemy_life = 5; windup_timer = 0.0f; spitter_count = 0; change_direction_time = 0.0f; change_direction_time_threshold = 1000.0f; angle = 0.0f; range_distance = 500.0f; prob_item_drop = 0.3; number_drop_items = 4; state = SpitterState.Search; this.parentWorld = parentWorld; direction_facing = GlobalGameConstants.Direction.Right; enemy_type = EnemyType.Alien; entity_found = null; acid_pool = AnimationLib.getFrameAnimationSet("acidPool"); for (int i = 0; i < size_of_spit_array; i++) { projectile[i] = new SpitProjectile(new Vector2(0, 0), 0); projectile[i].active = false; } death = false; directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("acidSpitterUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("acidSpitterDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("acidSpitterRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("acidSpitterRight"); for (int i = 0; i < 4; i++) { directionAnims[i].Animation = directionAnims[i].Skeleton.Data.FindAnimation("run"); } }
public Coin(LevelState parentWorld, Vector2 position) { this.position = position; this.parentWorld = parentWorld; dimensions = new Vector2(24, 24); dropItem = DropItemType.CoinDrop; state = DropState.Inactive; coinAnim = AnimationLib.getFrameAnimationSet("testCoin"); medAnim = AnimationLib.getFrameAnimationSet("itemHealth"); ammoAnim = AnimationLib.getFrameAnimationSet("itemBattery"); animationTime = 0.0f; isKnockedBack = false; }
public BallMutant(LevelState parentWorld, float initial_x, float initial_y) { position = new Vector2(initial_x, initial_y); dimensions = new Vector2(48f, 48f); velocity = Vector2.Zero; ball_coordinate = Vector2.Zero; state = mutantBallState.Search; component = new IdleSearch(); direction_facing = GlobalGameConstants.Direction.Right; radius = 0.0f; angle = 0.0f; change_direction_time = 0.0f; agressive_timer = 0.0f; distance = 0.0f; alert_timer = 0.0f; knockback_magnitude = 5.0f; range_distance = 250.0f; this.parentWorld = parentWorld; death = false; enemy_damage = 5; enemy_life = 5; enemy_type = EnemyType.Alien; prob_item_drop = 0.4; number_drop_items = 4; walk_down = AnimationLib.loadNewAnimationSet("ballMutantUp"); walk_right = AnimationLib.loadNewAnimationSet("ballMutantRight"); walk_up = AnimationLib.loadNewAnimationSet("ballMutantUp"); current_skeleton = walk_right; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("run"); current_skeleton.Skeleton.FlipX = false; //chaseAnim = AnimationLib.getFrameAnimationSet("chasePic"); animation_time = 0.0f; entity_found = null; chain_ball = AnimationLib.getFrameAnimationSet("snakeB"); }
public MolotovEnemy(LevelState parentWorld, Vector2 position) { this.parentWorld = parentWorld; this.position = position; this.dimensions = GlobalGameConstants.TileSize; entity_found = null; molotovState = MolotovState.MoveWait; moveWaitStepping = false; moveWaitTimer = 0.0f; flame = new MolotovFlame(position); flame.active = false; this.enemy_type = EnemyType.Prisoner; direction_facing = (GlobalGameConstants.Direction)(Game1.rand.Next() % 4); range_distance = 400.0f; health = 15; prob_item_drop = 0.3; number_drop_items = 3; templateAnim = AnimationLib.getFrameAnimationSet("molotov"); flameAnim = AnimationLib.getFrameAnimationSet("molotovFlame"); animation_time = 0.0f; directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("molotovUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("molotovDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("molotovRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("molotovRight"); for (int i = 0; i < 4; i++) { directionAnims[i].Animation = directionAnims[i].Skeleton.Data.FindAnimation("run"); } enemy_type = EnemyType.Prisoner; }
public KeyDoor(LevelState parent, Vector2 position, LevelKeyModule.KeyColor color, DoorDirection directions) { this.parentWorld = parent; this.position = position; this.velocity = Vector2.Zero; dimensions = GlobalGameConstants.TileSize; this.color = color; this.directions = directions; keyGraphic = AnimationLib.getFrameAnimationSet("keyPic"); // reposition and resize the door to fill the current wall { this.position.X -= this.position.X % GlobalGameConstants.TileSize.X; this.position.Y -= this.position.Y % GlobalGameConstants.TileSize.Y; if (directions == DoorDirection.EastWest) { while (parentWorld.Map.hitTestWall(this.position - new Vector2(1.0f, 0.0f)) != true) { this.position.X -= GlobalGameConstants.TileSize.X; } while (parentWorld.Map.hitTestWall(this.position + new Vector2(this.dimensions.X, 0.0f)) != true) { this.dimensions.X += GlobalGameConstants.TileSize.X; } } else if (directions == DoorDirection.NorthSouth) { while (parentWorld.Map.hitTestWall(this.position - new Vector2(0.0f, 1.0f)) != true) { this.position.Y -= GlobalGameConstants.TileSize.Y; } while (parentWorld.Map.hitTestWall(this.position + new Vector2(0.0f, this.dimensions.Y)) != true) { this.dimensions.Y += GlobalGameConstants.TileSize.Y; } } } }
public SnakeWorm(LevelState parentWorld, Vector2 position) { this.parentWorld = parentWorld; this.position = position; this.dimensions = new Vector2(24); snakeState = SnakeWormState.Moving; velocity = Vector2.Zero; direction = (float)(Game1.rand.NextDouble() * Math.PI * 2); dirModifier = 1.0f; switchTimer = 0.0f; switchDuration = averageSwitchDuration; enemy_life = 16; enemy_type = EnemyType.Alien; prob_item_drop = 0.3; number_drop_items = 4; tailData = new TailPosition[tailPiecesCount, positionsCount]; tailMostRecent = 0; for (int j = 0; j < tailPiecesCount; j++) { for (int i = 0; i < positionsCount; i++) { tailData[j, i] = new TailPosition(position, direction); } } secondaryHitBoxes = new SecondaryHitBox[secondaryHitBoxCount]; for (int i = 0; i < secondaryHitBoxCount; i++) { secondaryHitBoxes[i] = new SecondaryHitBox(position, new Vector2(16)); } testAnim = AnimationLib.getFrameAnimationSet("snakeA"); tailAnimA = AnimationLib.getFrameAnimationSet("snakeB"); tailAnimB = AnimationLib.getFrameAnimationSet("snakeC"); animation_time = 0; }
public PatrolGuard(LevelState parentWorld, Vector2 position) { this.parentWorld = parentWorld; this.position = position; this.dimensions = GlobalGameConstants.TileSize; bulletAnim = AnimationLib.getFrameAnimationSet("testBullet"); deadCushySoundTimer = 0; bullets = new GunBullet[bulletSupply]; for (int i = 0; i < bulletSupply; i++) { bullets[i].active = false; } direction_facing = GlobalGameConstants.Direction.Down; guardState = PatrolGuardState.MoveWait; enemy_type = EnemyType.Guard; prob_item_drop = 0.3; number_drop_items = 3; directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("patrolUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("patrolDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("patrolRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("patrolRight"); for (int i = 0; i < 4; i++) { directionAnims[i].Animation = directionAnims[i].Skeleton.Data.FindAnimation("run"); } health = 15; //calculate the center of the chunk you're placed in chunkCenter.X = (((int)((position.X / (GlobalGameConstants.TileSize.X)) / GlobalGameConstants.TilesPerRoomWide)) * GlobalGameConstants.TilesPerRoomWide * GlobalGameConstants.TileSize.X) + ((GlobalGameConstants.TilesPerRoomWide / 2) * GlobalGameConstants.TileSize.X); chunkCenter.Y = (((int)((position.Y / (GlobalGameConstants.TileSize.Y)) / GlobalGameConstants.TilesPerRoomHigh)) * GlobalGameConstants.TilesPerRoomHigh * GlobalGameConstants.TileSize.Y) + ((GlobalGameConstants.TilesPerRoomHigh / 2) * GlobalGameConstants.TileSize.Y); retreatTimer = 0; }
public HookPrisonerEnemy(LevelState parentWorld, float initial_x, float initial_y) { position = new Vector2(initial_x, initial_y); dimensions = new Vector2(32f, 90.0f); velocity = Vector2.Zero; chain_velocity = Vector2.Zero; chain_dimensions = new Vector2(10.0f, 10.0f); chain_position = position; disable_movement = false; disable_movement_time = 0.0f; knockback_magnitude = 10.0f; enemy_damage = 20; enemy_life = 25; enemy_found = false; change_direction_time = 0.0f; range_distance = 300.0f; angle = 0.0f; animation_time = 0.0f; prob_item_drop = 0.5; number_drop_items = 5; state = ChainState.Moving; enemy_type = EnemyType.Prisoner; component = new MoveSearch(); en_chained = null; death = false; directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("hookUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("hookDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("hookRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("hookRight"); hook = AnimationLib.getFrameAnimationSet("hook"); this.parentWorld = parentWorld; }
public ChaseEnemy(LevelState parentWorld, float initial_x, float initial_y) { this.position = new Vector2(initial_x, initial_y); enemy_speed = 2.0f; velocity = new Vector2(0.0f, -1.0f * enemy_speed); dimensions = new Vector2(48f, 48f); sword_hitbox = new Vector2(48f, 48f); sword_position = position; state = ChaseState.search; chaseComponent = new Chase(); searchComponent = new MoveSearch(); component = searchComponent; direction_facing = GlobalGameConstants.Direction.Up; change_direction_time = 0.0f; this.parentWorld = parentWorld; enemy_found = false; player_in_range = false; chase_target = null; play_sound = true; enemy_type = EnemyType.Prisoner; enemy_damage = 1; enemy_life = 15; knockback_magnitude = 5.0f; wind_anim = 0.0f; number_drop_items = 3; prob_item_drop = 0.3; walk_down = AnimationLib.loadNewAnimationSet("chaseDown"); walk_right = AnimationLib.loadNewAnimationSet("chaseRight"); walk_up = AnimationLib.loadNewAnimationSet("chaseUp"); current_skeleton = walk_up; current_skeleton.Animation = current_skeleton.Skeleton.Data.FindAnimation("run"); current_skeleton.Skeleton.FlipX = false; chaseAnim = AnimationLib.getFrameAnimationSet("chasePic"); animation_time = 0.0f; }
public ShopKeeper(LevelState parentWorld, Vector2 position) { this.parentWorld = parentWorld; this.position = position; this.velocity = Vector2.Zero; this.dimensions = GlobalGameConstants.TileSize; this.direction_facing = GlobalGameConstants.Direction.Down; greetingMessage = "Welcome to " + CampaignLobbyState.randomNames[Game1.rand.Next() % CampaignLobbyState.randomNames.Length] + "'s shop!"; playerInRange = false; state = ShopKeeperState.Normal; health = 40; projectile = new FireBall(new Vector2(-10, -10), 0.0f); projectile.active = false; fireballDelayPassed = 0.0f; switchItemPressed = false; shopKeeperFrameAnimationTest = AnimationLib.getFrameAnimationSet("fireball"); buyPic = AnimationLib.getFrameAnimationSet("buyPic"); leftBuyButton = AnimationLib.getFrameAnimationSet("gamepadLB"); rightBuyButton = AnimationLib.getFrameAnimationSet("gamepadRB"); //test shop data for now { for (int i = 0; i < 3; i++) { int rValue = Game1.rand.Next() % 14; if (rValue == 9) { rValue = 4; } // casting an int to item enum; no index for 9 itemsForSale[i] = (GlobalGameConstants.itemType)rValue; } for (int i = 0; i < 3; i++) { itemPrices[i] = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)itemsForSale[i]].price; itemIcons[i] = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)itemsForSale[i]].pickupImage; } } items[0] = new Pickup(parentWorld, new Vector2(-500, -500), itemsForSale[0]); items[1] = new Pickup(parentWorld, new Vector2(-500, -500), itemsForSale[1]); items[2] = new Pickup(parentWorld, new Vector2(-500, -500), itemsForSale[2]); parentWorld.EntityList.AddRange(items); directionAnims = new AnimationLib.SpineAnimationSet[4]; directionAnims[(int)GlobalGameConstants.Direction.Up] = AnimationLib.loadNewAnimationSet("shopUp"); directionAnims[(int)GlobalGameConstants.Direction.Down] = AnimationLib.loadNewAnimationSet("shopDown"); directionAnims[(int)GlobalGameConstants.Direction.Left] = AnimationLib.loadNewAnimationSet("shopRight"); directionAnims[(int)GlobalGameConstants.Direction.Left].Skeleton.FlipX = true; directionAnims[(int)GlobalGameConstants.Direction.Right] = AnimationLib.loadNewAnimationSet("shopRight"); for (int i = 0; i < 4; i++) { directionAnims[i].Animation = directionAnims[i].Skeleton.Data.FindAnimation("idle"); } for (int i = 0; i < 3; i++) { InGameGUI.prices[i].active = true; InGameGUI.prices[i].description = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)itemsForSale[i]].name; InGameGUI.prices[i].price = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)itemsForSale[i]].price.ToString(); InGameGUI.prices[i].position = position + new Vector2((-3 * GlobalGameConstants.TileSize.X) + (i * 3f * GlobalGameConstants.TileSize.X), (2.5f * GlobalGameConstants.TileSize.Y)) - (Game1.tenbyFive14.MeasureString(InGameGUI.prices[i].price) / 2) + new Vector2(0, 16); } }
public void render(SpriteBatch sb) { Color textColor = Color.Lerp(CampaignLobbyState.getSquareColor(GameCampaign.PlayerColor), Color.White, (float)(Math.Sin(flickerTime / 500f) + 1.0f) / 2); Color text2Color = Color.Lerp(CampaignLobbyState.getSquareColor(GameCampaign.Player2Color), Color.White, (float)(Math.Sin(flickerTime / 500f) + 1.0f) / 2); AnimationLib.FrameAnimationSet player_first_weapon = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)GameCampaign.Player_Right_Item].pickupImage; AnimationLib.FrameAnimationSet player_second_weapon = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)GameCampaign.Player_Left_Item].pickupImage; AnimationLib.FrameAnimationSet player2_first_weapon = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)GameCampaign.Player2_Item_1].pickupImage; AnimationLib.FrameAnimationSet player2_second_weapon = GlobalGameConstants.WeaponDictionary.weaponInfo[(int)GameCampaign.Player2_Item_2].pickupImage; //sb.Draw(Game1.whitePixel, XboxTools.GetTitleSafeArea(AnimationLib.GraphicsDevice, 0.8f), new Color(0.0f, 0.75f, 1.0f, 0.6f)); string player_health_display = "H: "; string ammunition_amount_display = "A: "; string coin_amount_display = GameCampaign.Player_Coin_Amount.ToString(); string Player_Right_Item = "R: "; string Player_Left_Item = "L: "; for (int i = 0; i < prices.Length; i++) { if (prices[i].active) { sb.DrawString(Game1.tenbyFive14, prices[i].price.ToString(), prices[i].position - parent.CameraFocus.Position + new Vector2(GlobalGameConstants.GameResolutionWidth / 2, GlobalGameConstants.GameResolutionHeight / 2), Color.LightBlue); } } //draw a black 1px outline over the GUI font for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if (i == 0 || j == 0) { continue; } Vector2 offset = new Vector2(i, j); //sb.DrawString(Game1.font, player_health_display, , Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); medAnim.drawAnimationFrame(0.0f, sb, new Vector2(140, 80) + offset, new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); //sb.DrawString(Game1.font, ammunition_amount_display, new Vector2(140, 110) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); ammoAnim.drawAnimationFrame(0.0f, sb, new Vector2(140, 110) + offset, new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); coinAnim.drawAnimationFrame(0.0f, sb, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 70) - new Vector2(Game1.font.MeasureString(coin_amount_display).X, 0) / 2 + offset, new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.DrawString(Game1.font, coin_amount_display, new Vector2(GlobalGameConstants.GameResolutionWidth / 2 + 32, 70) - new Vector2(Game1.font.MeasureString(coin_amount_display).X, 0) / 2 + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); sb.DrawString(Game1.font, Player_Right_Item, new Vector2(245, 140) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); sb.DrawString(Game1.font, Player_Left_Item, new Vector2(160, 140) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); player_second_weapon.drawAnimationFrame(0.0f, sb, new Vector2(180, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.Black); player_first_weapon.drawAnimationFrame(0.0f, sb, new Vector2(265, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.Black); if (GameCampaign.IsATwoPlayerGame) { //sb.DrawString(Game1.font, player_health_display, new Vector2(955, 80) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); medAnim.drawAnimationFrame(0.0f, sb, new Vector2(945, 80) + offset, new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); //sb.DrawString(Game1.font, ammunition_amount_display, new Vector2(955, 110) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); ammoAnim.drawAnimationFrame(0.0f, sb, new Vector2(945, 110) + offset, new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.DrawString(Game1.font, Player_Right_Item, new Vector2(1057, 140) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); sb.DrawString(Game1.font, Player_Left_Item, new Vector2(972, 140) + offset, Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); player2_second_weapon.drawAnimationFrame(0.0f, sb, new Vector2(1070 + 16, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.Black); player2_first_weapon.drawAnimationFrame(0.0f, sb, new Vector2(980 + 16, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.Black); } } } // allegiance meter sb.Draw(Game1.healthBar, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.greyBar, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0) + new Vector2(5, 0), null, Color.Orange, 0.0f, Vector2.Zero, new Vector2((1 - GameCampaign.PlayerAllegiance) * 160f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.greyBar, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0) + new Vector2(5 + ((1 - GameCampaign.PlayerAllegiance) * 160f), 0), null, Color.Cyan, 0.0f, Vector2.Zero, new Vector2(GameCampaign.PlayerAllegiance * 160f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.whitePixel, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0) + new Vector2((float)(5 + ((1 - guardBarPosition) * 160.0)), 0), null, Color.White, 0.0f, Vector2.Zero, new Vector2(5, 16), SpriteEffects.None, 0.53f); sb.Draw(Game1.whitePixel, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0) + new Vector2((float)(5 + ((1 - prisonerBarPosition) * 160.0)), 0), null, Color.White, 0.0f, Vector2.Zero, new Vector2(5, 16), SpriteEffects.None, 0.53f); sb.Draw(Game1.energyOverlay, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2, 0), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.52f); sb.Draw(Game1.prisonerIcon, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) - new Vector2(Game1.healthBar.Width / 2 + 32, 20), null, prisonerColor, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.guardIcon, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 100) + new Vector2(Game1.healthBar.Width / 2 + 12, -12), null, guardColor, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); if (GameCampaign.change_guard_icon_color) { if (guardBarPosition >= GameCampaign.PlayerAllegiance) { guardBarPosition = GameCampaign.PlayerAllegiance; guardBarPositionReset = false; } else { if (!guardBarPositionReset) { guardBarPosition = 0.0f; guardBarPositionReset = true; } else { guardBarPosition += 0.01f; } } } else { guardBarPosition = GameCampaign.PlayerAllegiance; } if (GameCampaign.change_prisoner_icon_color) { if (prisonerBarPosition <= GameCampaign.PlayerAllegiance) { prisonerBarPosition = GameCampaign.PlayerAllegiance; prisonerBarPositionReset = false; } else { if (!prisonerBarPositionReset) { prisonerBarPosition = 1.0f; prisonerBarPositionReset = true; } else { prisonerBarPosition -= 0.01f; } } } else { prisonerBarPosition = GameCampaign.PlayerAllegiance; } //player 1 GUI medAnim.drawAnimationFrame(0.0f, sb, new Vector2(140, 80), new Vector2(0.75f), 0.51f, 0.0f, Vector2.Zero, Color.White); sb.Draw(Game1.healthBar, new Vector2(167, 85), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.healthColor, new Vector2(172, 85), null, Color.White, 0.0f, Vector2.Zero, new Vector2(GameCampaign.Player_Health * 1.6f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.energyOverlay, new Vector2(167, 85), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.52f); ammoAnim.drawAnimationFrame(0.0f, sb, new Vector2(140, 110), new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.Draw(Game1.healthBar, new Vector2(167, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.energyColor, new Vector2(172, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(GameCampaign.Player_Ammunition * 1.6f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.energyOverlay, new Vector2(167, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.52f); coinAnim.drawAnimationFrame(0.0f, sb, new Vector2(GlobalGameConstants.GameResolutionWidth / 2, 70) - new Vector2(Game1.font.MeasureString(coin_amount_display).X, 0) / 2, new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.DrawString(Game1.font, coin_amount_display, new Vector2(GlobalGameConstants.GameResolutionWidth / 2 + 32, 70) - new Vector2(Game1.font.MeasureString(coin_amount_display).X, 0) / 2, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); sb.DrawString(Game1.font, Player_Right_Item, new Vector2(245, 140), textColor, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.51f); player_first_weapon.drawAnimationFrame(0.0f, sb, new Vector2(265, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.DrawString(Game1.font, Player_Left_Item, new Vector2(160, 140), textColor, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.51f); player_second_weapon.drawAnimationFrame(0.0f, sb, new Vector2(180, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); if (GameCampaign.IsATwoPlayerGame) { medAnim.drawAnimationFrame(0.0f, sb, new Vector2(945, 80), new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.Draw(Game1.healthBar, new Vector2(972, 83), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.healthColor, new Vector2(977, 83), null, Color.White, 0.0f, Vector2.Zero, new Vector2(GameCampaign.Player2_Health * 1.6f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.energyOverlay, new Vector2(972, 83), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.52f); ammoAnim.drawAnimationFrame(0.0f, sb, new Vector2(945, 110), new Vector2(0.75f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.Draw(Game1.healthBar, new Vector2(972, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.5f); sb.Draw(Game1.energyColor, new Vector2(977, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(GameCampaign.Player2_Ammunition * 1.6f, 1), SpriteEffects.None, 0.51f); sb.Draw(Game1.energyOverlay, new Vector2(972, 113), null, Color.White, 0.0f, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0.52f); sb.DrawString(Game1.font, Player_Left_Item, new Vector2(972, 140), text2Color, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.51f); player2_first_weapon.drawAnimationFrame(0.0f, sb, new Vector2(980 + 16, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); sb.DrawString(Game1.font, Player_Right_Item, new Vector2(1057, 140), text2Color, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.51f); player2_second_weapon.drawAnimationFrame(0.0f, sb, new Vector2(1070 + 16, 140), new Vector2(1.0f), 0.5f, 0.0f, Vector2.Zero, Color.White); } /*sb.Draw(Game1.whitePixel, new Vector2(499, 31), null, Color.Black, 0.0f, Vector2.Zero, new Vector2(66, 26), SpriteEffects.None, 0.0f); * sb.Draw(Game1.whitePixel, new Vector2(500, 32), null, Color.Orange, 0.0f, Vector2.Zero, new Vector2(64 * (1 - GameCampaign.PlayerAllegiance), 24), SpriteEffects.None, 0.0f); * sb.Draw(Game1.whitePixel, new Vector2(500 + (64 * (1 - GameCampaign.PlayerAllegiance)), 32), null, Color.LightBlue, 0.0f, Vector2.Zero, new Vector2(64 * GameCampaign.PlayerAllegiance, 24), SpriteEffects.None, 0.0f); * * for (int i = 0; i < windowIsActive.Length; i++) * { * if (!windowIsActive[i]) * { * continue; * } * * drawBox(ref boxWindows[i], sb); * } * * for (int i = 0; i < parent.KeyModule.NumberOfKeys; i++) * { * if (parent.KeyModule.isKeyFound((LevelKeyModule.KeyColor)i)) * { * keyFoundPic.drawAnimationFrame(0.0f, sb, new Vector2(600 + (i * 49), 10), new Vector2(3.0f, 3.0f), 0.5f, parent.KeyModule.KeyColorSet[i]); * } * else * { * keyNotFoundPic.drawAnimationFrame(0.0f, sb, new Vector2(600 + (i * 49), 10), new Vector2(3.0f, 3.0f), 0.5f, parent.KeyModule.KeyColorSet[i]); * } * }*/ if (parent.RenderNodeMap && !parent.Player1Dead) { Vector2 renderMapPosition = new Vector2(GlobalGameConstants.GameResolutionWidth / 2 - (parent.NodeMap.GetLength(0) * 64 / 2), GlobalGameConstants.GameResolutionHeight / 4); int renderFocusX = (int)((parent.CameraFocus.CenterPoint.X / GlobalGameConstants.TileSize.X) / GlobalGameConstants.TilesPerRoomWide); int renderFocusY = (int)((parent.CameraFocus.CenterPoint.Y / GlobalGameConstants.TileSize.Y) / GlobalGameConstants.TilesPerRoomHigh); sb.Draw(mapIcon, renderMapPosition - (new Vector2(100)) / 2, Color.White); int mapResolution = 2; float mapScale = 2.5f; for (int i = 0; i < parent.Map.Map.GetLength(0); i += mapResolution) { for (int j = 0; j < parent.Map.Map.GetLength(1); j += mapResolution) { if (parent.Map.Map[i, j] == TileMap.TileType.NoWall) { sb.Draw(Game1.whitePixel, renderMapPosition + new Vector2(i, j) * mapScale, null, Color.Lerp(Color.Cyan, Color.LightCyan, (float)(Math.Sin(flickerTime / 1000f))), 0.0f, Vector2.Zero, new Vector2(mapResolution) * mapScale, SpriteEffects.None, 0.5f); } } } Vector2 playerPos = parent.CameraFocus.Position / parent.Map.SizeInPixels; sb.Draw(Game1.whitePixel, renderMapPosition + new Vector2(300) * playerPos, null, Color.Red, 0.0f, Vector2.Zero, new Vector2(mapResolution) * mapScale, SpriteEffects.None, 0.5f); } sb.Draw(Game1.whitePixel, Vector2.Zero, null, Color.Lerp(Color.Transparent, Color.Black, blackFadeOverlay), 0.0f, Vector2.Zero, new Vector2(GlobalGameConstants.GameResolutionWidth, GlobalGameConstants.GameResolutionHeight), SpriteEffects.None, 0.5f); if (playerOutOfSight) { sb.Draw(Game1.p2Icon, new Vector2((float)(((GlobalGameConstants.GameResolutionWidth) * 0.15 * Math.Cos(playerOutOfSightAngle))) + (GlobalGameConstants.GameResolutionWidth / 2), (float)(((GlobalGameConstants.GameResolutionWidth) * 0.15 * Math.Sin(playerOutOfSightAngle)) + (GlobalGameConstants.GameResolutionHeight / 2))), new Rectangle(0, 0, 96, 48), Color.White, playerOutOfSightAngle, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); } if (parent.Player1Dead) { sb.DrawString(Game1.tenbyFive72, deathMessage, (new Vector2(GlobalGameConstants.GameResolutionWidth, GlobalGameConstants.GameResolutionHeight) - Game1.tenbyFive72.MeasureString(deathMessage)) / 2, Color.LightGray); } }