|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢?
, S- a, y( z' W m$ J public void spreadmoney(int m){2 ^* e' Y7 E0 l. x4 k1 E
for(int i=0;i<m;i++){$ }6 [* E0 b% p7 [
int x = (int)(Math.random()*(moneyspace.getSizeX()));
& n: ~: M. {6 d: U, W c2 w O int y = (int)(Math.random()*(moneyspace.getSizeY()));
M9 J/ U4 E. p P7 L& I% C) N/ c9 N+ N* M; x( W4 x9 X/ ~
int I;+ ]- u: z' T; S7 U4 n9 H% W; `
if(moneyspace.getObjectAt(x,y)!=null
! F% d1 x; H; x$ U# N' M { I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();1 B8 R7 l1 b8 Z& O. W& f& A
}" _' o' X% S: Y. k) |/ i
else{1 I6 h5 w4 F9 ^
I = 0;
1 I" Z1 S0 F* |) I }
" U5 z/ [+ `. s+ u& U8 W moneyspace.putObjectAt(x, y, new Integer(I+1)); }/ V* g, M7 L# x% Z* [& ]" @& n
} |
|