|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 0 p2 ~3 e2 Q) c- ^6 }, i# h6 ^
public void spreadmoney(int m){
& _3 ~- b7 ?, F; n1 c1 A for(int i=0;i<m;i++){3 D- D q8 |9 R$ p
int x = (int)(Math.random()*(moneyspace.getSizeX()));8 T% q# T7 }0 k5 R, w& T
int y = (int)(Math.random()*(moneyspace.getSizeY()));
2 [& i. }# V3 g S4 _3 z" Z/ z2 o+ T% ]7 N9 c
int I;. W8 T6 @. m( ?# K( x
if(moneyspace.getObjectAt(x,y)!=null 7 J! ^% r& V5 L
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
2 w* z; { ]0 v) V; B8 G/ k9 i+ G* H; e }* L" u, Z8 S6 T1 i2 a
else{ p1 S7 I; `8 o% U
I = 0;- @2 @1 A- J$ L' x) n% V& r0 s* f8 Z
}$ v. Q0 ~1 n; J4 P Z
moneyspace.putObjectAt(x, y, new Integer(I+1)); }" ]! H: S9 }2 X" Q2 i
} |
|