|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
) a% A7 ? j/ d$ P2 @% ~ public void spreadmoney(int m){
/ C' {. V5 X7 P7 @8 _$ |, q' q for(int i=0;i<m;i++){( t' |7 m, ~9 f( A" y
int x = (int)(Math.random()*(moneyspace.getSizeX()));& T6 Z3 D6 D( U2 A' x0 k% q
int y = (int)(Math.random()*(moneyspace.getSizeY()));6 o4 e/ v& J4 ^% M# @
( _$ [# T- h8 S. e2 s$ {0 |/ w3 f
int I;
) _6 y8 N9 X' r0 [4 U7 { if(moneyspace.getObjectAt(x,y)!=null 6 K7 j0 z. n+ R; g/ l4 k
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();( Q9 w+ z5 Z8 O# p5 t% d
}
. ^; Y, L U& O; q' ~+ j: h [ else{0 Q7 [: I, K2 n- t" G! ~; t
I = 0;
" \) @1 H4 D' @" T }
6 T5 m5 [, m4 R: M$ K moneyspace.putObjectAt(x, y, new Integer(I+1)); }
9 I+ M6 T+ P& F5 S } |
|