public void EnqueueForRendering(GameObject obj) { char[] objImage = obj.GetImage(); int imageCols = objImage.Length; Coordinates objTopLeft = obj.GetTopLeft(); int lastCol = Math.Min(objTopLeft.Col + imageCols, this.renderContextMatrixCols); for (int col = obj.GetTopLeft().Col; col < lastCol; col++) { if (col >= 0 && col < renderContextMatrixCols) { renderContextMatrix[objTopLeft.Row, col] = objImage[col - obj.GetTopLeft().Col]; } } }
public void AddObject(GameObject obj) { if (obj is Vehicle) { Vehicle tempVehicle = obj as Vehicle; for (int i = 0; i < tempVehicle.Length; i++) { this.allObjects.Add(new Vehicle(new Coordinates(tempVehicle.TopLeft.Row, tempVehicle.TopLeft.Col + i), tempVehicle.Speed)); } } else if (obj is Frog) { playerFrog = obj as Frog; this.frogStartingPosition = playerFrog.TopLeft; } this.allObjects.Add(obj); }