public override void Initialize() { base.Initialize(); int floor_pos_y = this.GetWindowHeight() - 128; IceBackground background = new IceBackground(new Vector2(0, -800)); this.AddEntity(background); IcePlatform platform = new IcePlatform(new Vector2(0, floor_pos_y)); this.AddEntity(platform); MenuPenguin penguin = new MenuPenguin(new Vector2(1000, floor_pos_y - 128)); this.AddEntity(penguin); MainMenuGUI mainMenuGUI = new MainMenuGUI(); AddEntity(mainMenuGUI); GameState.Instance.SetVar <int>("floor_pos_y", floor_pos_y); this.Camera.SetScreenOffset(0.49, 0.83); this.Camera.FollowOnlyXAxis(); this.Camera.FollowEntity(penguin); }
void Random() { int x = getRandomNumber(); if (!platforms[x].gameObject.GetComponent <CircleCollider2D>().enabled) { myPlatform = platforms[x].gameObject.GetComponent <IcePlatform>(); myPlatform.setLayerInactive(); myPlatform.setColliderActive(); } }
public override void Initialize() { base.Initialize(); int floor_pos_y = this.GetWindowHeight() - 128; IceBackground background = new IceBackground(new Vector2(0, -800)); this.AddEntity(background); IcePlatform platform = new IcePlatform(new Vector2(0, floor_pos_y)); this.AddEntity(platform); Penguin penguin = new Penguin(new Vector2(300, floor_pos_y - 128)); this.AddEntity(penguin); SnakeBackground snakeBackground = new SnakeBackground(new Vector2(GetWindowWidth() / 2, 0)); AddEntity(snakeBackground); Snake snake = new Snake(new Vector2(400, floor_pos_y - 128), new Vector2(GetWindowWidth() / 2, 0), new Rectangle(0, 0, GetWindowWidth() / 2, GetWindowHeight())); AddEntity(snake); GameGUI gameGUI = new GameGUI(); AddEntity(gameGUI); Vector2 spawnPoint = new Vector2((int)penguin.GetPosition().X + this.GetWindowWidth(), floor_pos_y - 64); GameState.Instance.SetVar <int>("floor_pos_y", floor_pos_y); GameState.Instance.SetVar <Penguin>("penguin", penguin); GameState.Instance.SetVar <Vector2>("spawn_point", spawnPoint); GameState.Instance.SetVar <bool>("game_over", false); GameState.Instance.SetVar <double>("score", 0); //this.Camera.SetScreenOffset(0.18, 0.83); this.Camera.SetScreenOffset(0.10, 0.83); this.Camera.FollowOnlyXAxis(); this.Camera.FollowEntity(penguin); EnemySpawnController enemySpawnController = new EnemySpawnController(); AddSpawnController(enemySpawnController); }
public static void ClassInit(TestContext context) { //Textures used don't matter, as none of them are initialized Player = new Player(Vector2.Zero); PrivatePlayer = new PrivateObject(Player); Enemy = new BaseEnemy(Vector2.Zero); PrivateEnemy = new PrivateObject(Enemy); Platform = new Platform(Vector2.Zero); PrivatePlatform = new PrivateObject(Platform); SpikePlatform = new SpikePlatform(Vector2.Zero); PrivateSpikePlatform = new PrivateObject(SpikePlatform); HorizontalPlatform = new HorizontalPlatform(Vector2.Zero); PrivateHorizontal = new PrivateObject(HorizontalPlatform); VerticalPlatform = new VerticalPlatform(Vector2.Zero); PrivateVertical = new PrivateObject(VerticalPlatform); IcePlatform = new IcePlatform(Vector2.Zero); PrivateIcePlatform = new PrivateObject(IcePlatform); CloudPlatform = new CloudPlatform(Vector2.Zero); PrivateCloudPlatform = new PrivateObject(CloudPlatform); }
void Start() { icePlatform = Instantiate(icePlatform); SpecialFireRate = IceMissile.firerate; enerygyPerSpecialAttack = IceMissile.enerygyPerSpecialAttack; myRb2D = GetComponent <Rigidbody2D>(); // Calculate how many jumps we can do jumpsLeft = 1 + extraJumps; // find malee attack time base on animation AnimationClip[] clips = Animate.runtimeAnimatorController.animationClips; foreach (AnimationClip clip in clips) { if (clip.name == "Ice_MaleeAttack") { maleeAttackClipTime = clip.length; } if (clip.name == "Ice_SpecialAttack") { specialAttackClipTime = clip.length; } } }