|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
5 H/ k) ~! T5 ]/ M7 @7 m public void spreadmoney(int m){7 l X" n T' S) Q+ T9 d# q+ q
for(int i=0;i<m;i++){6 J% _# l$ G& e3 m- n9 p d# H
int x = (int)(Math.random()*(moneyspace.getSizeX()));
) S" W' O, D9 A+ w int y = (int)(Math.random()*(moneyspace.getSizeY()));+ a4 V. G9 o& L1 \! k
7 W: Q4 M" `' v int I;8 z! H: G+ ?; ^8 ^2 j6 M! @1 R
if(moneyspace.getObjectAt(x,y)!=null : F9 R8 w/ I& u
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
2 @' z1 o3 U3 m# B+ f1 f+ c+ S }- B/ M3 V& K, Q! g: t t4 H1 F! h; s/ f
else{ a" T- T' s* o" _
I = 0;
/ L9 N/ @( P$ b0 G* n0 H0 N: a+ K }
$ b% D' b9 \# `& C0 a: w moneyspace.putObjectAt(x, y, new Integer(I+1)); }
0 Q/ y+ ^ H9 m } |
|