Example #1
0
    ////////////////////////////////////////////////////////////////////////////////

    protected override void Initialize()
      {
      base.Initialize();
      this.IsMouseVisible = true;

      graphics.PreferredBackBufferWidth = screen_width;
      graphics.PreferredBackBufferHeight = screen_height;
      graphics.IsFullScreen = false;//true;
      graphics.ApplyChanges();

      light_buffer = new RenderTarget2D (GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

      // initialize class arrays
      for (int i = 0; i < max_effects;    i += 1) particle_effect[i] = new ParticleEffect ();
      for (int b = 0; b < max_brushes;    b += 1) brush[b] = new Brush ();
      for (int f = 0; f < max_fixtures;   f += 1) fixture[f] = new Fixture ();
      for (int o = 0; o < max_objects;    o += 1) obj[o] = new Object ();
      for (int c = 0; c < max_characters; c += 1) character[c] = new Character ();

      player_level = 2;  // starting level, default 0

      load_map();

      if (player_added_to_map == false)
        {
        add_character ("Richard", (int) C.RICHARD, 64, 64, 256);
        }

      // scroll border is inside box of screen (non-scrolling part)
      scroll_border.X = Convert.ToInt32 (screen_width * 2 / 5);
      scroll_border.Y = Convert.ToInt32 (screen_height * 2 / 5);
      scroll_border.Width = Convert.ToInt32 (screen_width * 1/5);
      scroll_border.Height = Convert.ToInt32 (screen_height * 1/5);

      // menu
      menu_width = Convert.ToInt32 (screen_width * .75);
      menu_height = Convert.ToInt32 (screen_height * .75);
      menu_x = (screen_width - menu_width) / 2;
      menu_y = (screen_height - menu_height) / 2;
      menu_exit_v.X = menu_x + 20;
      menu_exit_v.Y = menu_y + 20;
      }
Example #2
0
        ////////////////////////////////////////////////////////////////////////////////
        int fixture_in_brush(Fixture f)
        {
            int b = 0;
              int clip = -1;

              while (clip == -1 && b < total_brushes)
            {
            if (f.x + f.width >= brush[b].x && f.x <= brush[b].x + brush[b].width
            && f.y + f.length >= brush[b].y && f.y <= brush[b].y + brush[b].length
            && f.z + f.height >= brush[b].z && f.z <= brush[b].z + brush[b].height - 1)
              clip = b;
            b += 1;
            }

              return clip;
        }