public void Initialize() { buddydeath = 0; // If game is being in full screen update the SCALE /*if (GameEngine.Instance.full_screen) * { * int min = Math.Min(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height); * GameEngine.Instance.ResizeWindow(min, min); * Vector2 size = GameEngine.Instance.GetWindowSize(); * SCALE = size.X < size.Y ? size.X / WIDTH : size.Y / HEIGHT; * } * else // Else rescale to the size you want * { * GameEngine.Instance.ResizeWindow((int)(WIDTH * SCALE), (int)(HEIGHT * SCALE)); * }*/ GameEngine.Instance.UpdateShiftAmount(); ROW_SCALE = WIDTH / NUM_ROWS; COL_SCALE = HEIGHT / NUM_COLS; AABB aabb = new AABB(); aabb.LowerBound = new Vector2(-MARGIN, -MARGIN); aabb.UpperBound = new Vector2(WIDTH + MARGIN, HEIGHT + MARGIN); world = new World(gravity); succeeded = false; World.ContactManager.BeginContact += ContactManager.BeginContact; World.ContactManager.EndContact += ContactManager.EndContact; pauseMenu = new PauseMenu(this); gameOverMenu = new GameOverMenu(this); gamestate = GameState.Unzip; unzipTexture = new AnimationTexture(GameEngine.Instance.GetTexture("unzip"), 5, 3, 3); zipTexture = new AnimationTexture(GameEngine.Instance.GetTexture("zip"), 5, 3, 3); unzipTexture.ResetCurrentFrame(); zipTexture.ResetCurrentFrame(); zippedTexture = GameEngine.Instance.GetTexture("zippedbkg"); haze = new Texture2D(GameEngine.Instance.GraphicsDevice, 1, 1); rect = new Rectangle(0, 0, (int)(Level.WIDTH * Level.SCALE + GameEngine.shiftAmount.X), (int)(Level.HEIGHT * Level.SCALE + GameEngine.shiftAmount.Y)); haze.SetData(new Color[] { new Color(0, 0, 0, 255) }); // Flush all the non-reflectable objects from the previous levels ReflectableObject.FlushNonReflectableObjects(); ContactManager.ClearContactList(); Block.FlushGameBlocks(); reflection_color_time = 0; reflection_current_blue = MIN_REFLECTION_COLOR_BLUE; reflection_current_green = MIN_REFLECTION_COLOR_GREEN; reflection_current_red = MIN_REFLECTION_COLOR_RED; slope_red = 2 * (MAX_REFLECTION_COLOR_RED - MIN_REFLECTION_COLOR_RED) / (REFLECTION_COLOR_END_TIME); slope_green = 2 * (MAX_REFLECTION_COLOR_GREEN - MIN_REFLECTION_COLOR_GREEN) / (REFLECTION_COLOR_END_TIME); slope_blue = 2 * (MAX_REFLECTION_COLOR_BLUE - MIN_REFLECTION_COLOR_BLUE) / (REFLECTION_COLOR_END_TIME); }
public new void Initialize() { width = level.ROW_SCALE * 0.9f; height = level.COL_SCALE * 0.9f; IsGrounded = false; sensorWidth = width * 0.85f; sensorCenter = new Vector2(0, height / 2.0f); sensorName = Level.dudeSensorName; reflection_strip = new AnimationTexture(reflectionTexture, num_of_frames_reflection, 1, 0); walk_strip = new AnimationTexture(this.texture, num_of_frames_walk, 1, 5); if (idle_texture == null) { idle_texture = GameEngine.Instance.GetTexture("idleStrip"); } idle_strip = new AnimationTexture(this.idle_texture, num_of_frames_idle, 1, 10); jumpDown = GameEngine.Instance.GetTexture("jumpDown"); jumpUp = GameEngine.Instance.GetTexture("jumpUp"); }
public void SetAnimationTexture(Texture2D texture, int width, int height, int delay) { animTexture = new AnimationTexture(texture, width, height, delay); }
public void SetBackground(Texture2D texture, int width, int height, int delay) { animBkg = new AnimationTexture(texture, width, height, delay); }