public void Bounce(Universe u) { if (pos.x < 0 || pos.x + image.Width > u.x) vel.x = -vel.x; if (pos.y < 0 || pos.y + image.Height > u.y) vel.y = -vel.y; }
public GameManager(Form f) { form = f; g = f.CreateGraphics(); u = new Universe(form.Width, form.Height); asteroids = new List<Sprite>(); form.Paint += new PaintEventHandler(form_Paint); }
public void Setup() { asteroids.Add(new Asteroid()); asteroids.Add(new Asteroid()); asteroids.Add(new Asteroid()); asteroids.Add(new Asteroid()); u = new Universe(Width, Height); ship = new Ship(); controller = new Keyboard(form, ship); }