public BlueBall(Vector2D position, double radius, PlayerPaddle paddle) { lock (lockCounter) { ballID = IDCounter++; } this.playerPaddle = paddle; this.Velocity = new Vector2D(0, 0); ObjectTextures = new List<GameBitmap>(); this.Position = position; this.Radius = radius; ObjectTextures.Add(new GameBitmap("\\Resources\\Images\\ballBlue.png", this.Position - new Vector2D(0, Radius) - new Vector2D(Radius, 0), this.Position - new Vector2D(0, Radius) + new Vector2D(Radius, 0), this.Position + new Vector2D(0, Radius) + new Vector2D(-Radius, 0))); ObjectTextures[0].IsBall = true; ObjectWidth = ObjectHeight = 2 * radius; ObjectTextures[0].IsSquare = true; ObjectTextures[0].ColorLowSpec = Color.Aqua; //квадратот ќе ги има истите темиња како и сликата textureRotator = new GameRectangle(ObjectTextures[0].PositionUL, ObjectTextures[0].PositionUR, ObjectTextures[0].PositionDL); Health = 1000; }
private QuadTree<IGameObject> quadtree; //со оваа структура може да се подели рамнината на делови #endregion Fields #region Constructors public ArkanoidGamePlayState(IGame game) { this.ballIncreaseSpeedPeriodCounter = 0; this.multiBallPeriodsCounter = 0; Score = 0; lockCollisionDetection = new object(); debugMode = false; quadtree = null; ButtonDWaitNFrames = 0; this.Game = game; this.Game.GameObjects.Clear(); //бриши ги сите објекти (ако има такви) RendererCache.RemoveAllBitmapsFromMainMemory(); //исчисти го баферот од претходната состојба Game.ReloadResources(); this.InitBrickTextures(); BitmapsToRender = new List<IList<GameBitmap>>(); bitmapsToRenderCopy = new List<IList<GameBitmap>>(); background = new List<GameBitmap>(); background.Add(new GameBitmap("\\Resources\\Images\\background.jpg", 0, 0, game.VirtualGameWidth, game.VirtualGameHeight)); ballsInPlay = new HashSet<IGameObject>(); //додади го играчот на позиција (1750, 2010). PlayerPaddle player = new PlayerPaddle(new Vector2D(1750, 2010), Game.VirtualGameWidth, Game.VirtualGameHeight); Game.GameObjects.Add(player); this.LocalPlayer = player; //додади ја топката BlueBall ball = new BlueBall(new Vector2D((player.Position.X * 2 + player.ObjectWidth) / 2, player.Position.Y - 45), 50, player); Game.GameObjects.Add(ball); ballsInPlay.Add(ball); CreateBricks(); /* //proba da dodadam golema crvena cigla BigRedBrick grb = new BigRedBrick(new Vector2D(20, 100), Game.VirtualGameWidth, Game.VirtualGameHeight); //proba da dodadam mala crvena cigla //proba da dodadam golema zolta cigla */ ElapsedTime = 0; }