|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? : T: v$ c& u( b+ G
public void spreadmoney(int m){
& y9 N+ s: F4 a! @* [7 z for(int i=0;i<m;i++){: N! E q' K- a8 q& `
int x = (int)(Math.random()*(moneyspace.getSizeX()));$ ?# W$ Y2 s) C" e( p. \
int y = (int)(Math.random()*(moneyspace.getSizeY()));
1 c) |2 L. s( \* g0 f6 m. F5 t5 P4 ^( k) j( c2 g8 d! M+ d0 q) T [$ |
int I;
3 v* S" M7 O1 B4 R" \2 n if(moneyspace.getObjectAt(x,y)!=null , t- a7 |* u* s2 v. b+ C
I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();
* Q8 U' l/ Q4 s; B; j% N) D }) q; f7 ~: i. G1 s1 j$ v
else{4 A/ T7 r# ^4 R; J8 u$ L
I = 0;
& r8 M8 \) @6 u g- R' ~0 @ }
" k3 ~! ]$ _( Q/ N, y/ c5 v$ d moneyspace.putObjectAt(x, y, new Integer(I+1)); }" ]9 N. k- O" Q& ~
} |
|