|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 7 [0 o+ S1 Y$ s4 W$ l; b
public void spreadmoney(int m){ ]# Y, _" I' w U, P
for(int i=0;i<m;i++){& t" f+ k g4 L j3 }; I% G; [
int x = (int)(Math.random()*(moneyspace.getSizeX()));
( h! p, D1 I) u# b0 b int y = (int)(Math.random()*(moneyspace.getSizeY()));
5 L3 e0 U& Q' V+ o: I
x8 K6 c5 V" ?* l; r' F* u int I;" G$ b/ ?" O5 \( t
if(moneyspace.getObjectAt(x,y)!=null % D- B8 P$ C& Q
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();+ A V2 v1 c6 C9 h
}: Y& t8 D Y3 P; ~5 l* N5 Z' Z* M
else{
6 J7 G4 B$ S f% t% { I = 0;
* y, r$ b2 I7 z& O4 w, ?% R7 u }
& _" {) S! n: l/ l. b" z0 h- ~ moneyspace.putObjectAt(x, y, new Integer(I+1)); }
/ W5 R" r R) U* J2 T } |
|