松下加兵卫吧 关注:2贴子:90

.。。。。

只看楼主收藏回复

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
public class Car extends Frame
{
int x=80,y=80;
Image image; public void window() //生成窗口
{ try {
image = new ImageIcon(new URL("file:C:\\Documents and Settings\\Administrator\\桌面\\lesson5\\car.jpg")).getImage();
} catch (MalformedURLException ex) {
//Logger.getLogger(mCar.class.getName()).log(Level.SEVERE, null, ex);
}
setSize(600,500);
setVisible(true);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
dispose();
System.exit(0);
}}
);
addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent e){
//******************************此行以下输入您的代码
if(e.getKeyCode()==KeyEvent.VK_UP)
y=y-10;
if(e.getKeyCode()==KeyEvent.VK_DOWN)
y=y+10;
if(e.getKeyCode()==KeyEvent.VK_RIGHT)
x=x+10;
if(e.getKeyCode()==KeyEvent.VK_LEFT)
x=x-10;
if(e.getKeyCode()==KeyEvent.VK_S)
{y=y-10;
x=x+10;}
//**********************************
repaint();
}
} ); }
public void paint(Graphics g)//在窗口中画图
{
g.drawImage(image, x, y, this);
}
public static void main(String[] args)//主方法,java的应用程序必须有且只有一个主方法
{
Car a=new Car();
a.window();
}
}I


1楼2013-10-09 12:10回复
    package prj24_1;
    import java.util.Random; import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Font;
    import javax.microedition.lcdui.Graphics;
    import javax.microedition.lcdui.Image;
    import javax.microedition.lcdui.game.GameCanvas;
    import javax.microedition.lcdui.game.Sprite; public class CarRaceCanvas extends GameCanvas implements CommandListener,Runnable { private Graphics gra;
    /************************用户汽车和5种对手汽车*************************/
    private Sprite myCar;
    private Sprite[] enemy = new Sprite[5];
    /************************命令按钮***********************************/
    private Command cmdStart = new Command("开始游戏", Command.SCREEN, 1);
    private Command cmdStop = new Command("暂停游戏", Command.SCREEN, 1);
    /************************游戏线程***********************************/
    private Thread game;
    private boolean loop = true; private int road;
    private Random rnd = new Random();
    private int score = 100;
    private Font font = null; public CarRaceCanvas() {
    super(true);
    this.prepareResource();
    this.addCommand(cmdStart);
    this.setCommandListener(this);
    gra = this.getGraphics();
    font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);
    } public void prepareResource() {
    /************************载入图片***********************************/
    try {
    Image myImage = Image.createImage("/mycar.gif");
    myCar = new Sprite(myImage);
    for (int i = 0; i < enemy.length; i++) {
    Image enImg = Image.createImage("/enemy.gif");
    enemy[i] = new Sprite(enImg);
    } } catch (Exception ex) {
    ex.printStackTrace();
    }
    for (int i = 0; i < enemy.length; i++) {
    setEnemy(i);
    }
    //将用户汽车画在界面正中央
    myCar.setPosition((this.getWidth()-myCar.getWidth())/2,
    (this.getHeight()-myCar.getHeight())/2);
    }
    //设定第en个对手汽车的随机位置
    public void setEnemy(int en) {
    int x, y;
    while (true) {
    x = rnd.nextInt((int) this.getWidth() - enemy[en].getWidth());
    //取纵坐标为界面高度-10倍范围内的随机数
    y = -rnd.nextInt(this.getHeight()*10);
    for (int j = 0; j < enemy.length; j++) {
    //不能让汽车和别的对手汽车重叠
    if (j != en && enemy [j].collidesWith(enemy [en], true)){
    continue;
    }
    }
    enemy [en].setPosition(x, y);
    break;
    }
    } public void commandAction(Command cmd, Displayable dis) {
    if (cmd == cmdStart) {
    loop = true;
    game = new Thread(this);
    game.start();
    this.removeCommand(cmdStart);
    this.addCommand(cmdStop);
    } else if (cmd == cmdStop) {
    loop = false;
    game = null;
    this.removeCommand(cmdStop);
    this.addCommand(cmdStart);
    }
    } public void run() {
    while (loop) {
    drawScreen();
    int state = this.getKeyStates();
    switch(state){
    case GameCanvas.LEFT_PRESSED:
    myCar.move(-10, 0);
    break;
    case GameCanvas.RIGHT_PRESSED:
    myCar.move(10, 0);
    break;
    case GameCanvas.UP_PRESSED:
    myCar.move(0, -10);
    break;
    case GameCanvas.DOWN_PRESSED:
    myCar.move(0, 10);
    break;
    }
    try {
    Thread.sleep(50);
    } catch (Exception e) {
    }
    }
    } public void drawScreen() {
    //将界面背景用灰色清空
    gra.setColor(120, 120, 120);
    gra.fillRect(0, 0, this.getWidth(), this.getHeight());
    //画道路
    drawRoad();
    //画出当前分数
    gra.setColor(255,0,0);
    gra.setFont(font);
    gra.drawString("当前分数:"+score, this.getWidth()/2, 0, Graphics.TOP|Graphics.HCENTER);
    //对手车辆下移
    for (int i = 0; i < enemy.length; i++) {
    enemy[i].move(0, 15);
    enemy[i].paint(gra);
    if (enemy[i].getY() > this.getHeight()){
    setEnemy(i);
    }
    //判断是否碰撞
    check(enemy[i]);
    }
    myCar.paint(gra);
    this.flushGraphics();
    } public void drawRoad() {
    road += 80;
    //画道路中间的白线
    gra.setColor(255, 255, 255);
    gra.fillRect((int) this.getWidth()/2-10, road, 20, 150);
    if (road >= this.getHeight()) {
    road = -150;
    }
    } public void check(Sprite en) {
    if (myCar.collidesWith(en, true)) {
    score--;
    //如果用户汽车左侧撞到对手汽车
    if (myCar.getX() > en.getX()) {
    en.move(-20, 0);
    myCar.move(20, 0);
    }
    //如果用户汽车右侧撞到对手汽车
    else {
    en.move(20, 0);
    myCar.move(-20, 0);
    }
    }
    if(score==0){
    loop = false;
    game = null;
    //将界面背景用灰色清空
    gra.setColor(120, 120, 120);
    gra.fillRect(0, 0, this.getWidth(), this.getHeight());
    gra.setColor(255,0,0);
    gra.setFont(font);
    gra.drawString("您输了", this.getWidth()/2, 0, Graphics.TOP|Graphics.HCENTER);
    this.removeCommand(cmdStart);
    this.removeCommand(cmdStop);
    }
    }
    }
    I


    4楼2013-10-09 12:14
    回复
      import lejos.nxt.Motor;
      import lejos.robotics.navigation.TachoPilot;
      import lejos.util.Delay;
      public class LALALA {
      /**
      * @param args
      */
      public static void main(String[] args) {
      // TODO Auto-generated method stub
      TachoPilot s=new
      TachoPilot(5.6f,16.0f,Motor.A,Motor.C,true);
      s.setSpeed(500);//设置马达速度
      s.forward();//前进
      Delay.msDelay(1000);
      s.backward();//后退
      Delay.msDelay(1000);
      s.rotate(90);//转向90度
      s.travel(-60);//机器人后退60厘米
      s.steer(50,360);//转圈,速度50,转圈360度
      }
      }


      5楼2013-10-16 11:33
      回复
        import lejos.nxt.SensorPort;
        import lejos.nxt.SoundSensor;
        import lejos.util.Delay;
        public class Test {
        /**
        * @param args
        */
        public static void main(String[] args) {
        // TODO Auto-generated method stub
        SoundSensor a=new SoundSensor(SensorPort.S1);
        while(true)
        { System.out.println(a.readValue());
        Delay.msDelay(1000);}
        }
        }


        6楼2013-10-16 11:34
        回复
          a是声音传感器;s是机器人


          7楼2013-10-16 11:59
          回复
            闹钟机器人
            LightSensor a=new LightSensor(SensorPort.S1);
            while(a.readValue()<70)
            {
            System.out.println(a.readValue());
            Delay.msDelay(1000);
            }
            Sound.playSample(new File("music.wav"));
            Button.waitForPress();


            9楼2013-10-23 11:27
            收起回复
              //package Caishu;
              import java.util.Scanner;
              public class Guess {
              /**
              * @param args
              */
              public static void main(String[] args) {
              int b = (int) (Math.random()*10+1);
              Scanner input=new Scanner(System.in);
              System.out.println("请输入1个10以内的数字:");
              int a = input.nextInt();
              int i=1;
              while( a != b && i<10)
              {
              System.out.println(a>b?"大了":"小了");
              System.out.println("请输入1个10以内的数字:");
              a = input.nextInt();
              i++;
              }
              String s = "";
              if(i<2)
              {
              s="你猜对了,你是牛人";
              }else if(i<5)
              {
              s="你猜对了,你的成绩不错";
              }else s="10次都猜不中你是脑残";
              System.out.println("结果是:"+b+"你猜的次数为:"+i+","+s);
              }
              }


              10楼2013-10-23 12:06
              回复
                import java.lang.*;
                import java.awt.*;
                import java.io.*;
                import java.awt.datatransfer.*;
                import java.awt.event.*;
                import javax.swing.JColorChooser;
                import javax.swing.JOptionPane;
                public class NoteBook extends Frame implements ActionListener
                {
                private MenuItem filenew=new MenuItem("新建");
                private MenuItem fileopen=new MenuItem("打开");
                private MenuItem filesave=new MenuItem("保存");
                private MenuItem fileexit=new MenuItem("退出");
                private MenuItem editselectall=new MenuItem("全选");
                private MenuItem editcopy=new MenuItem("复制");
                private MenuItem editcut=new MenuItem("剪切");
                private MenuItem editpaste=new MenuItem("粘贴");
                private MenuItem color = new MenuItem("背景颜色");
                private MenuItem about = new MenuItem("关于");
                private TextArea area=new TextArea();
                String fileName = null;
                Toolkit toolKit=Toolkit.getDefaultToolkit();
                Clipboard clipBoard=toolKit.getSystemClipboard();
                private FileDialog openFileDialog= new FileDialog(this,"打开文件",FileDialog.LOAD);
                private FileDialog saveAsFileDialog=new FileDialog(this,"文件存为",FileDialog.SAVE);
                private class WindowCloser extends WindowAdapter
                {
                public void windowClosing(WindowEvent we)
                { System.exit(0);}
                }
                private void setup()
                {
                Menu file=new Menu("文件");
                file.add(filenew); filenew.addActionListener(this);
                file.add(fileopen); fileopen.addActionListener(this);
                file.add(filesave); filesave.addActionListener(this);
                file.addSeparator();
                file.add(fileexit); fileexit.addActionListener(this);
                Menu edit=new Menu("编辑");
                edit.add(editselectall); editselectall.addActionListener(this);
                edit.addSeparator();
                edit.add(editcopy); editcopy.addActionListener(this);
                edit.add(editcut); editcut.addActionListener(this);
                edit.add(editpaste); editpaste.addActionListener(this);
                Menu help=new Menu("帮助");
                help.add(color); color.addActionListener(this);
                help.addSeparator();
                help.add(about); about.addActionListener(this);


                12楼2013-10-23 12:11
                收起回复
                  MenuBar bar=new MenuBar();
                  bar.add(file);
                  bar.add(edit);
                  bar.add(help);
                  setMenuBar(bar);
                  setLayout(new BorderLayout());
                  add("Center",area);
                  }
                  public NoteBook()
                  {
                  super("哈哈哈记事本");
                  setup();
                  addWindowListener(new WindowCloser());
                  setSize(400,500);
                  show();
                  }
                  public void actionPerformed(ActionEvent e)
                  {
                  if(e.getSource()==filenew)
                  area.setText("");
                  if(e.getSource()==fileopen)
                  {
                  openFileDialog.show();
                  fileName=openFileDialog.getDirectory()+openFileDialog.getFile();
                  if(fileName != null)
                  readFile(fileName);
                  }
                  if(e.getSource()==filesave)
                  {
                  if(fileName != null)
                  writeFile(fileName);
                  }
                  if(e.getSource()==fileexit)
                  System.exit(0);
                  if(e.getSource()==editselectall)
                  area.selectAll();
                  if(e.getSource()==editcopy)
                  {
                  String text=area.getSelectedText();
                  StringSelection selection=new StringSelection(text);
                  clipBoard.setContents(selection,null);
                  }
                  if(e.getSource()==editcut)
                  {
                  String text=area.getSelectedText();
                  StringSelection selection=new StringSelection(text);
                  clipBoard.setContents(selection,null);
                  area.replaceRange("",area.getSelectionStart(),area.getSelectionEnd());
                  }
                  if(e.getSource()==editpaste)
                  {
                  Transferable contents=clipBoard.getContents(this);
                  if(contents==null) return;
                  String text;
                  text="";
                  try{
                  text=(String)contents.getTransferData(DataFlavor.stringFlavor);
                  }catch(Exception exception){
                  }
                  area.replaceRange(text,area.getSelectionStart(),area.getSelectionEnd());
                  }
                  if(e.getSource()==color)
                  {
                  Color ccc = JColorChooser.showDialog(this,"color",Color.BLACK);
                  area.setBackground(ccc);
                  }
                  if(e.getSource()==about)
                  {
                  JOptionPane.showMessageDialog(area,"本软件版权归郭培培所有");
                  }
                  }
                  public void readFile(String fileName)
                  {
                  area.setText("");
                  try{
                  BufferedReader in=new BufferedReader(new FileReader(fileName));
                  String line;
                  while((line=in.readLine())!=null)
                  area.append(line+"\n");
                  in.close();
                  area.setCaretPosition(0);
                  }catch(IOException e){
                  System.out.println("打开文件错误");
                  }
                  }
                  public void writeFile(String fileName)
                  {
                  try{
                  File file = new File (fileName);
                  FileWriter writeOut = new FileWriter(file);
                  writeOut.write(area.getText());
                  writeOut.close();
                  }catch(IOException e){
                  System.out.println("写文件错误");
                  }
                  }
                  public static void main(String srgs[])
                  {
                  NoteBook f=new NoteBook();
                  }
                  }


                  13楼2013-10-23 12:12
                  收起回复
                    我们已经脱离这吧的名称了吗?!话说咱俩辛苦盖楼为啥没人来支持一下!?


                    15楼2013-10-27 16:45
                    收起回复
                      乐高机器人测距离
                      import lejos.util.Delay;
                      public class liu {
                      /**
                      * @param args
                      */
                      public static void main(String[] args) {
                      // TODO Auto-generated method stub
                      UltrasonicSensor a=new
                      UltrasonicSensor(SensorPort.S1);
                      while(true)
                      {
                      System.out.println(a.getDistance());
                      Delay.msDelay(1000);
                      }I


                      16楼2013-10-30 10:57
                      收起回复
                        import lejos.nxt.Motor;
                        import lejos.nxt.SensorPort;
                        import lejos.nxt.UltrasonicSensor;
                        import lejos.robotics.navigation.TachoPilot;
                        import lejos.util.Delay;
                        public class CREDO {
                        /**
                        * @param args
                        */
                        public static void main(String[] args) {
                        // TODO Auto-generated method stub
                        UltrasonicSensor a=new UltrasonicSensor(SensorPort.S1);
                        TachoPilot r=new
                        TachoPilot(5.6f,16.0f,Motor.A,Motor.C,true);
                        r.setSpeed(300);
                        while(true)
                        {
                        if(a.getDistance()>30)
                        {
                        r.forward();
                        Delay.msDelay(100);
                        }
                        else
                        r.rotate(90);
                        }
                        }
                        }
                        机器人遇障碍转向I


                        17楼2013-10-30 11:17
                        回复
                          猜数字简单版
                          import java.util.Scanner;
                          public class liuyu {
                          /**
                          * @param args
                          */
                          public static void main(String[] args) {
                          // TODO Auto-generated method stub
                          int a,b,n=1;
                          a=(int)(Math.random()*10+1);
                          System.out.print("请输入1个10以内的数字:");
                          Scanner input=new Scanner(System.in);
                          b=input.nextInt();
                          while(a!=b)
                          {
                          if(b>a)
                          System.out.println("大了");
                          else
                          System.out.println("小了");
                          n=n+1;
                          b=input.nextInt();
                          }
                          System.out.println("猜对了");
                          System.out.println(n);
                          }}I


                          18楼2013-10-30 12:05
                          回复
                            /**********主角过关***************/
                            switch (GameMap.guan) {
                            case 0:
                            if(x_mali.getX()>=192) {
                            GameMap.guan = GameMap.tow;
                            x_guan++;
                            x_mali.setPosition(mali_X, mali_Y);
                            map.til_back02.setPosition(0, 0);
                            map.til_peng02.setPosition(0, 0);
                            map.til_zhebi02.setPosition(0, 0);
                            for(int i=0;i<map.map_peng01_h;i++) {
                            for(int j=0;j<map.map_peng01_w;j++) {
                            if(pengkuai[i][j]==0)continue;
                            else pengkuai[i][j] = 0;
                            }
                            }
                            for(int i=0;i<enemyN;i++) {
                            guaichuxian[i] = false;
                            enemy[i] = null;
                            }
                            DIR = R;
                            sfkillstate = false;
                            sfkill = false;
                            x_mali_arrout = false;
                            x_mali_state = zhanli;
                            mapmoveX = 0;
                            gametime01 = 0;
                            gametime02 = 100;
                            }
                            break;
                            case 1:
                            if(x_mali.getX()>=192) {
                            }
                            break;
                            }
                            /********当主角到地图移动量X的某个值开始刷怪***********/
                            switch (GameMap.guan) {
                            case 0:
                            if(!guaichuxian[0]&&!guaichuxian[1]&&!guaichuxian[2]&&mapmoveX==0) {
                            enemy[0] = new GameEnemy(0,200,180);
                            enemy[1] = new GameEnemy(0,200,140);
                            enemy[2] = new GameEnemy(0,200,220);
                            guaichuxian[0] = true;
                            guaichuxian[1] = true;
                            guaichuxian[2] = true;
                            }
                            if(!guaichuxian[3]&&!guaichuxian[4]&&!guaichuxian[5]&&mapmoveX==168) {
                            enemy[3] = new GameEnemy(1,300,180);
                            enemy[4] = new GameEnemy(2,300,220);
                            enemy[5] = new GameEnemy(2,360,180);
                            guaichuxian[3] = true;
                            guaichuxian[4] = true;
                            guaichuxian[5] = true;
                            }
                            if(!guaichuxian[0]&&!guaichuxian[1]&&mapmoveX==504) {
                            enemy[0] = new GameEnemy(1,300,180);
                            enemy[1] = new GameEnemy(1,300,220);
                            guaichuxian[0] = true;
                            guaichuxian[1] = true;
                            }
                            if(!guaichuxian[2]&&!guaichuxian[3]&&!guaichuxian[4]&&!guaichuxian[5]&&mapmoveX==1000) {
                            enemy[2] = new GameEnemy(0,300,180);
                            enemy[3] = new GameEnemy(0,300,220);
                            enemy[4] = new GameEnemy(2,360,140);
                            enemy[5] = new GameEnemy(2,400,160);
                            guaichuxian[2] = true;
                            guaichuxian[3] = true;
                            guaichuxian[4] = true;
                            guaichuxian[5] = true;
                            }
                            if(!guaichuxian[0]&&!guaichuxian[1]&&mapmoveX==1400) {
                            enemy[0] = new GameEnemy(0,140,100);
                            enemy[1] = new GameEnemy(0,180,80);
                            guaichuxian[0] = true;
                            guaichuxian[1] = true;
                            }
                            break;
                            case 1:
                            if(!guaichuxian[0]&&!guaichuxian[1]&&mapmoveX==652) {
                            enemy[0] = new GameEnemy(0,240,100);
                            enemy[1] = new GameEnemy(0,300,80);
                            guaichuxian[0] = true;
                            guaichuxian[1] = true;
                            }
                            if(!guaichuxian[2]&&!guaichuxian[3]&&!guaichuxian[4]&&mapmoveX==860) {
                            enemy[2] = new GameEnemy(1,140,100);
                            enemy[3] = new GameEnemy(0,160,90);
                            enemy[4] = new GameEnemy(1,180,80);
                            guaichuxian[2] = true;
                            guaichuxian[3] = true;
                            guaichuxian[4] = true;
                            }
                            if(!guaichuxian[5]&&!guaichuxian[0]&&!guaichuxian[1]&&mapmoveX==1180) {
                            enemy[5] = new GameEnemy(1,340,100);
                            enemy[0] = new GameEnemy(2,360,90);
                            enemy[1] = new GameEnemy(1,380,80);
                            guaichuxian[5] = true;
                            guaichuxian[0] = true;
                            guaichuxian[1] = true;
                            }
                            if(!guaichuxian[2]&&!guaichuxian[3]&&!guaichuxian[4]&&mapmoveX==1516) {
                            enemy[2] = new GameEnemy(1,140,100);
                            enemy[3] = new GameEnemy(2,160,90);
                            enemy[4] = new GameEnemy(1,180,80);
                            guaichuxian[2] = true;
                            guaichuxian[3] = true;
                            guaichuxian[4] = true;
                            }
                            break;
                            }
                            /******怪物逻辑******/
                            for(int i=0;i<enemyN;i++) {
                            if(enemy[i] == null)continue;
                            else {
                            enemy[i].logic(mapmoveX);
                            switch (enemy[i].type) {
                            case 0: if(enemy[i].sp_mogu01.getX()<-30)guaichuxian[i] = false; break;
                            case 1: if(enemy[i].sp_mogu02.getX()<-30)guaichuxian[i] = false; break;
                            case 2: if(enemy[i].sp_wugui.getX()<-30)guaichuxian[i] = false; break;
                            }
                            }
                            }
                            for(int i=0;i<flashN;i++) {
                            if(flash[i] == null)continue;
                            else {
                            flash[i].logic(mapmoveX);
                            switch (flash[i].type) {
                            case 0: if(flash[i].sfxiaoshi)jinbichuxian[i] = false; break;
                            case 1: if(flash[i].sfxiaoshi)shitouchuxian[i] = false; break;
                            }
                            }
                            }
                            if(z == 120)z = 0;I


                            20楼2013-10-30 12:14
                            回复
                              /******主角超出屏幕死亡判断******/
                              if(x_mali.getY()>309&&!sfkillstate) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              /******主角逻辑******/
                              switch (x_mali_state) {
                              case zhanli:
                              /******主角站立状态碰到怪物死亡判断******/
                              for(int i=0;i<enemyN;i++) {
                              if(enemy[i] == null||enemy[i].sfkill)continue;
                              else {
                              switch (enemy[i].type) {
                              case 0:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_mogu01, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              case 1:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_mogu02, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              case 2:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_wugui, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              }
                              }
                              }
                              z++;
                              x_mali.setFrame(2);
                              break;
                              case yidong:
                              /******主角移动状态碰到怪物死亡判断******/
                              for(int i=0;i<enemyN;i++) {
                              if(enemy[i] == null||enemy[i].sfkill)continue;
                              else {
                              switch (enemy[i].type) {
                              case 0:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_mogu01, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              case 1:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_mogu02, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              case 2:
                              if(!enemy[i].sfkill&&x_mali.collidesWith(enemy[i].sp_wugui, true)) {
                              index = 0;
                              x_mali_state = kill;
                              kill_state = U;
                              sfkillstate = true;
                              z = 0;
                              mid_kill = miclei.musiclong("kill");
                              miclei.musicstart(mid_kill);
                              }
                              break;
                              }
                              }
                              }
                              z++;
                              switch (DIR) {
                              /******主角右移动逻辑******/
                              case R:
                              /******主角换帧******/
                              x_mali.nextFrame();
                              if(x_mali.getFrame() >= 3)x_mali.setFrame(0);
                              /******主角右移动地图移动判断******/
                              switch (GameMap.guan) {
                              case 0:
                              if(map.til_back01.getX()>-1740&&x_mali.getX()>=120) {
                              map.til_back01.move(-malisudu, 0);
                              map.til_peng01.move(-malisudu, 0);
                              map.til_zhebi01.move(-malisudu, 0);
                              mapmoveX+=4;
                              x_mali.move(-malisudu, 0);
                              /******主角右移动怪物移动判断******/
                              for(int i=0;i<enemyN;i++) {
                              if(enemy[i] == null)continue;
                              else {
                              switch (enemy[i].type) {
                              case 0: enemy[i].sp_mogu01.move(-malisudu, 0); break;
                              case 1: enemy[i].sp_mogu02.move(-malisudu, 0); break;
                              case 2: enemy[i].sp_wugui.move(-malisudu, 0); break;
                              }
                              }
                              }
                              }
                              break;
                              case 1:
                              if(map.til_peng02.getX()>-1740&&x_mali.getX()>=120) {
                              map.til_back02.move(-malisudu, 0);
                              map.til_peng02.move(-malisudu, 0);
                              map.til_zhebi02.move(-malisudu, 0);
                              mapmoveX+=4;
                              x_mali.move(-malisudu, 0);
                              /******主角右移动怪物移动判断******/
                              for(int i=0;i<enemyN;i++) {
                              if(enemy[i] == null)continue;
                              else {
                              switch (enemy[i].type) {
                              case 0: enemy[i].sp_mogu01.move(-malisudu, 0); break;
                              case 1: enemy[i].sp_mogu02.move(-malisudu, 0); break;
                              case 2: enemy[i].sp_wugui.move(-malisudu, 0); break;
                              }
                              }
                              }
                              }
                              break;
                              }
                              break;I


                              21楼2013-10-30 12:14
                              回复