public void update(){
/*
* Purpose: Called each frame update (i.e. 30 times a second)
* Preconditions: None
* Postconditions: return nothing
*/
int count = 0 ;
int x = 0;
if (checkPaddle() == true){
count++;
}
if (count % 2 == 0) {
x = -7;
}
else {
x = 7;}
paddleLocation.y= paddleLocation.y + x;
}//end update
我希望底部的计数成为方法顶部的初始值。我无法理解如何做到这一点。