import java.awt.*;
import java.awt.event.*;
class game0130 extends Frame implements Runnable{
int t;
int cx,cy;
int m,n;
int map[][]=
new int
[501][501];
public static void main(String [] args) {
Frame f=new game0130();
f.setTitle("[[game0130]]");
f.setSize(700,700);
f.setBackground(Color.yellow);
f.setVisible(true);
}
game0130(){
for (m=0;m<501;m++){
for(n=0;n<501;n++){
map[m][n]=1;
}
}
for (m=50;m<451;m++){
for(n=50;n<451;n++){
map[m][n]=2;
}
}
for (m=150;m<351;m++){
for(n=150;n<351;n++){
map[m][n]=3;
}
}
cx=75;
cy=200;
Thread th=new Thread(this);
th.start();
addWindowListener(new stopwin());
}
class stopwin extends WindowAdapter{
public void windowClosing(WindowEvent we){System.exit(0);}
}
public void run(){
t=1;
while(t<
100){
cy=cy+2;
repaint();
try{
Thread.sleep(100);
}catch(InterruptedException e){}
t=t+1;
}
repaint();
}
public void paint(Graphics g){
int px,py;
px=cx-50;
py=cy-50;
g.setColor(Color.yellow);
g.fillRect(100,100,500,500);
for(m=1;m<
101;m++){
for(n=1;n<101;n++){
g.setColor(Color.green);
if(map[px+m][py+n]==1)g.fillRect(100+5*m,100+5*n,5,5);
g.setColor(Color.black);
if(map[px+m][py+n]==2)g.fillRect(100+5*m,100+5*n,5,5);
g.setColor(Color.green);
if(map[px+m][py+n]==3)g.fillRect(100+5*m,100+5*n,5,5);
}
}
g.setColor(Color.red);
g.fillOval(350,350,50,50);
}
}
最終更新:2011年02月10日 15:34