Lab 02: Game Loop and Simple Coordinates

Complete the following worksheet in pairs.

Names:  
 

Drawing 101

 

 

 

Game Loop

Consider the base code for assignment 2. Code is here. Suppose Game.cs looks like

using System;
using System.Drawing;
using System.Windows.Forms;

public class Game
{
   class Point {
      public float x;
      public float y;

      public Point(float a, float b)
      {
         x = a;
         y = b;
      }
      public void Update(float dt)
      {
         x += 100 * dt;
      }
   }
   Point _point = null;

   public void Setup()
   {
      _point = new Point(25, (float) (Window.height * 0.5));
   }

   public void Update(float dt)
   {
      _point.Update(dt);
   }

   public void Draw(Graphics g)
   {
      Brush brush = new SolidBrush(Color.Red);
      g.FillEllipse(brush, _point.x, _point.y, 100, 100);
   }

   public void MouseClick(MouseEventArgs mouse) { }
   public void KeyDown(KeyEventArgs key) { }
}

 

coordinates

 
 
 

Lab Week02 CreditBox