A stealth-based 2D platformer where you don't have to kill anyone unless you want to. https://www.semicolin.games
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
668 B

  1. using Microsoft.Xna.Framework;
  2. using System;
  3. namespace Jumpy {
  4. class Camera {
  5. private Rectangle bbox = new Rectangle(0, 0, 1920 / 6, 1080 / 6);
  6. public int Width { get => bbox.Width; }
  7. public int Height { get => bbox.Height; }
  8. public int Left { get => bbox.Left; }
  9. public void Update(GameTime time, Point player) {
  10. int diff = player.X - bbox.Center.X;
  11. // TODO: use the actual center of the player's bbox.
  12. if (Math.Abs(diff) > 16) {
  13. bbox.Offset((int) (diff * 0.1), 0);
  14. }
  15. if (bbox.Left < 0) {
  16. bbox.Offset(-bbox.Left, 0);
  17. }
  18. Debug.Toast($"p: {player.X} c: {bbox.Center.X}");
  19. }
  20. }
  21. }