|
|

楼主 |
发表于 2012-3-6 09:15:08
|
显示全部楼层
代码帖的有点乱,怎么都没人能帮忙看看呢? 5 p" t8 F. u9 f% P9 d8 X
public void spreadmoney(int m){
% S: o* ?: w$ V' Q) x, g. @) a for(int i=0;i<m;i++){
7 K' a3 G+ Y! Y- v6 I$ Q- A int x = (int)(Math.random()*(moneyspace.getSizeX()));
' J& ~! A/ R( ~8 [ int y = (int)(Math.random()*(moneyspace.getSizeY()));, p5 U4 m& G8 _& I; y2 w! Q' t
( O8 f7 u- \/ X
int I;
# ~7 i m0 X$ z6 K* A4 `' P7 u5 K if(moneyspace.getObjectAt(x,y)!=null
- U- o B+ T- N I = ((Integer)moneyspace.getObjectAt(x,y)).intValue();4 n7 l+ o" t$ t! ~, h
}
0 J* n5 J$ Q5 y; O else{: s q2 Z2 L& e" Q: I
I = 0;, V; F+ M; f) e2 o7 {- p
}5 l! s+ z5 @5 l& j, \+ t# n C& m
moneyspace.putObjectAt(x, y, new Integer(I+1)); }
# I- m6 h. o# ^4 W' e5 x } |
|