private Pallo LuoPallo() { Pallo pallo = new Pallo(palloRadius); pallo.Position = palloPosition; Add(pallo); AddCollisionHandler(pallo, KasittelePallonTormays); return(pallo); }
private void LuoKentta() { Level.CreateBorders(1.0, false); Level.Background.Color = Color.Black; pallo = LuoPallo(); pelaaja = new Maila(mailaSize.X, mailaSize.Y, new Vector(Level.Left + 20, 0)); Add(pelaaja); ai = new AI(mailaSize.X, mailaSize.Y, new Vector(Level.Right - 20, 0), pallo); Add(ai); Camera.ZoomToLevel(); }
private void KasittelePallonTormays(PhysicsObject pPallo, PhysicsObject kohde) { Pallo pallo = pPallo as Pallo; if (pallo.Left <= Level.Left) { aiLaskuri.Kasvata(ResetGame); } else if (pallo.Right >= Level.Right) { pelaajaLaskuri.Kasvata(ResetGame); } else if (kohde is Maila) { pallo.OsuMailalla(kohde is AI, kohde.Y - pallo.Y); } }
public AI(double width, double height, Vector position, Pallo pallo) : base(width, height, position) { this.pallo = pallo; this.IsUpdated = true; }