Translate to Scala: if (parseInt(document.getElementById('Ball').style.top) + 50 > 800) { autostrike = false; DirectionSwitcher = 1; if (X1 < X2) { Direction = 1; } if (X1 > X2) { Direction = 2; } Random = parseInt(Math.random() * 10) / 2; saveXY(); }
def getElementById(id: String): Element = { } def parseInt(string: String): Double = { } def style(): Style = { } def top(): Double = { } def +(x: Double): Double = { } var autostrike: Boolean = false var DirectionSwitcher: Int = 1 if(getElementById("Ball").style().top() + 50 > 800) { autostrike = false DirectionSwitcher = 1 if(X1 < X2) { Direction = 1 } if(X1 > X2) { Direction = 2 } Random = parseInt(Math.random() * 10) / 2 saveXY() }