|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? / q) a0 M- h0 a
public void spreadmoney(int m){ O% g+ s: I) e9 S5 ~
for(int i=0;i<m;i++){; m L4 |' y3 }: Z# _# d
int x = (int)(Math.random()*(moneyspace.getSizeX()));
6 S$ S D, s7 V+ Z+ p% t6 w) V int y = (int)(Math.random()*(moneyspace.getSizeY()));
/ y& a, t6 @2 |) G0 g' c8 m: w( l1 k u5 I/ I& L
int I;7 `7 E! `% w# w! Y3 E9 v
if(moneyspace.getObjectAt(x,y)!=null 1 [. C' Z1 [* B
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
+ F9 r7 A8 E) G3 f& A( l8 e L& ^: V }
1 i5 r% r$ L4 B+ Q( t8 c else{) n _9 U+ j3 f/ X7 ?7 k4 ?" I+ D3 q
I = 0;3 J; e" d _$ j0 `! ]4 M& d5 r
}
: m! X+ s# v) w, {0 e moneyspace.putObjectAt(x, y, new Integer(I+1)); }
2 ]- m4 H# ?: _; \' P$ m } |
|