亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? footballgamecanvas.java

?? netbean下開發的
?? JAVA
字號:
/*
 * FootballGameCanvas.java
 *
 * Created on 2007年6月3日, 下午10:16
 */

package hello;

import java.util.Timer;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import java.io.IOException;
import javax.microedition.lcdui.game.*;
import javax.microedition.media.*;
import javax.microedition.media.control.ToneControl;
import java.io.InputStream;
import javax.microedition.lcdui.game.Sprite;
import java.lang.Thread;
/**
 *
 * @author  FXB
 * @version
 */
public class FootballGameCanvas extends Canvas implements CommandListener,Runnable{

    /**
     * constructor
     */
    //如果人沒有跳起來,人對球的作用力,可以為負
    private float peopleforce = 0 ;
     //幀的刷新時間間隔
    private int timeDelay;    
//private Image FootballImage;
    private Image footballImage;
    private Image paopleImage;
    private HelloMidlet Midlet;

    private float peaklength =3f;    //人的跳躍時的初時兩幀的間隔
    
    private  float maxHeigh = 120;  //人對球加正力(就是給球加上一定的速度)的最高距離
    private float BL = 20;  //人高度與人對球的力的比例

    private Sprite Football ;   //足球精靈
    private Sprite WallRight;
    private Sprite WallLeft;
    private Sprite People;      //人的精靈
    private Sprite Sky;
    private Sprite Grass;
    private Image backGround;
        //屏幕的高和寬,為了盡量適應各種屏幕寬度
    private int height;
    private int width;
        //繪制圖形的類型,主要用來避免有些圖象的重復繪制
    //private int PaintType = 0;      //0為初始化時,繪制所有畫布對象到初時位置
                                     //1為對足球進行重新繪制
                                     //2為對足球和人都進行重新繪制(因為人有可能不動,但足球卻是每時每刻都在動)    
    
    private int PeopleDirection = 0;    //標記人的走向,以便刷新人精靈,1為左,2為右
    private double GSpeed =0.3;        //重力加速度的大小
    private double Resistance_air = 0.1; //空氣阻力的大?。▽嶋H上就是考慮空氣對兩幀的距離的影響)
    private int PeopleSpd = 3;
    
    private Command ExitCmd = new Command("Exit", Command.EXIT, 1);
    private Command PauseCmd = new Command("Pause",Command.STOP,1);
    
    private FootballClass FootballManage; //定義一個足球的實例,主要用來通過控制精靈的對齊點來操縱足球精靈的動作
                                    //(注意:足球被頂高的力度也包含在這個類中)
    private PeopleClass PeopleManage; //定義一個人的實例,用來通過鍵盤的輸入來判斷和控制人的運動
    
    
    public FootballGameCanvas(HelloMidlet Midlet) {
        //初始化程序對象//
        
        //每一幀之間的時延
        this.timeDelay = 10;
        this.Midlet = Midlet;
        //System.out.println((float)this.Resistance_air);
        //得到屏幕的高度和寬度
        this.height = this.getHeight();
        this.width = this.getWidth();

        try {
            footballImage = Image.createImage("/hello/fb.png");
        } catch (IOException ex) {
            ex.printStackTrace();
        }
        try {
            //載入各種精靈,并對其進行相應的設置
            this.Football = new Sprite(footballImage,footballImage.getWidth()/6,footballImage.getHeight());
            this.Football.setPosition(width/2-10,height/2-10);
           // System.out.println(width/2-10);
           // System.out.println(height/2-10);
            this.Football.defineReferencePixel(this.Football.getWidth()/2, this.Football.getHeight()/2);
            
            this.WallRight = new Sprite(Image.createImage("/hello/wall.png"));
            this.WallRight.setPosition((10-this.WallRight.getWidth()),-10);
            this.WallLeft = new Sprite(Image.createImage("/hello/wall.png"));
            this.WallLeft.setPosition(this.width-10,-10);
            
            this.paopleImage = Image.createImage("/hello/pp.png");
            
            this.People = new Sprite(this.paopleImage,this.paopleImage.getWidth()/2,this.paopleImage.getHeight()); 
            this.People.setPosition(width/2,(height-this.People.getHeight()-10));
            this.People.defineReferencePixel(this.People.getWidth()/2, this.People.getWidth()/2);
            
            this.Grass = new Sprite(Image.createImage("/hello/grass.png"));
            this.Grass.setPosition(0,height-5);
            this.Sky = new Sprite(Image.createImage("/hello/sky.png"));
            this.Sky.setPosition(0,0);
            this.backGround = Image.createImage("/hello/bg.png");
            
            // Set up this canvas to listen to command events
            setCommandListener(this);   //監聽按鍵
            
            //添加各種畫布按鍵
            this.addCommand(ExitCmd);   
            this.addCommand(PauseCmd);

        } catch(Exception e) {
            e.printStackTrace();
            //System.out.println("Can't Load fb.png");
        }
        
        //建立足球精靈處理實例,方便以后對足球運動的管理
        FootballManage = new FootballClass(this.Football, this.Football.getRefPixelX(), this.Football.getRefPixelY(),
                this.GSpeed,(float)this.Resistance_air,this.timeDelay,this);
        
        //建立人精靈的處理實例,方便以后對人的運動的控制管理
        this.PeopleManage = new PeopleClass(this.People,this.PeopleSpd);
        
        Thread t = new Thread(this);    //  建立畫布的新線程
        t.start();                      //啟動線程
    }
    
    /**
     * paint
     */
    public void paint(Graphics g) {
//        g.drawString("Sample Text",0,0,Graphics.TOP|Graphics.LEFT);
        g.drawImage(backGround, 0, 0, Graphics.TOP|Graphics.LEFT);
        Football.paint(g);
        WallRight.paint(g);
        WallLeft.paint(g);
        this.People.paint(g);
        Grass.paint(g);
        Sky.paint(g);
    }
//    private int a=0;
//    private int b=0;
    private int roll = 0;
    private int TimeM = 0;
    
    public void run(){

            //this.PaintType = 0;
       while(true){
//        this.Football.setRefPixelPosition(a,b);
//        a++;
//        b++;
//           if(this.PeopleDirection != 0){
//               this.repaint();
//               this.PeopleDirection =0;
//           }
           
           
           /*此處實現人的軌跡為連續的而不是跳躍的*/
       if(this.People.getX()>10 &&this.PeopleDirection == 1){
           this.PeopleManage.moveleft();
            
            if(this.TimeM * this.timeDelay >40){
            this.People.nextFrame();
            this.TimeM = 0;
            }
            this.TimeM++;
//           roll+=2;
       }
       else
           if( this.People.getX()<(this.width-this.People.getWidth()-10) && this.PeopleDirection == 2){
                this.PeopleManage.moveright();
                
            if(this.TimeM * this.timeDelay >40){
            this.People.prevFrame();
            this.TimeM = 0;
            }
            this.TimeM++;
            }
       if(this.peak==1){
           this.PeopleManage.moveup();
           if(this.People.collidesWith(this.Grass,true)){
               
               this.PeopleManage.setPeopleYY((height-this.People.getHeight()/2-10),(height-this.People.getHeight()/2-10));
               this.peak = 0;
               this.People.setRefPixelPosition(this.People.getRefPixelX(),(height-this.People.getHeight()/2-10));
           }
       }

//        if(roll > this.PeopleSpd){
//           this.PeopleDirection=0;
//           roll = 0;
//        }
        /*此處為功能的結束處*/  

        this.FootballManage.strikeNo();     //計算下一步的足球精靈的位置
        this.Updata();
       //this.FootballManage.test();
        
        //檢測是否有碰撞,因為碰撞只可能是一種類型,所以,利用條件語句,首先對碰撞幾率比較大的情況進行檢測
        //注意:?。。】梢钥紤]增加一個條件判斷,只有足球到達一定的范圍內才進行碰撞檢測
            if(this.FootballManage.isStrike(this.People,4)){
                if(this.Football.getRefPixelY() == height-this.People.getHeight()/2-10){
                    this.FootballManage.setForce(this.peopleforce);
                }else
                {this.FootballManage.setForce((this.maxHeigh -(this.height-this.People.getRefPixelY()))/this.BL );}
                    
                this.Updata();
            }   //與人頭的碰撞檢測
            else
            if(this.FootballManage.isStrike(this.Grass,3)){this.Updata();}    //與地面進行碰撞檢測
                    else
                    if(this.FootballManage.isStrike(this.WallRight,2)){this.Updata();}    //與右側墻進行碰撞檢測
                        else                
                        if(this.FootballManage.isStrike(this.WallLeft,1)){this.Updata();} //與左側墻的碰撞檢測
//                            else 
//                                if(this.FootballManage.isStrike(this.Sky,0)){
//                                    this.Updata();   //與天花板進行碰撞檢測
//                                }
        //此時,所有的碰撞可能都檢測完畢,
        if(!this.FootballManage.state){
            this.Midlet.exitMIDlet();
        }
        
       }

    }

    public void Updata(){
        this.FootballManage.displayFootball();
        

        
        this.repaint();
        try {
            Thread.sleep(timeDelay);
        } catch (InterruptedException ex) {
            ex.printStackTrace();
        }
    }
    
    /**
     * Called when a key is pressed.
     */
    private boolean circle = true;
    private int peak=0;
    protected  void keyPressed(int keyCode) {
        int action = getGameAction(keyCode);

	    switch (action) { 
	    case Canvas.LEFT:
                this.PeopleDirection = 1;
                
		break;
	    case Canvas.RIGHT:

                this.PeopleDirection = 2;

                break;
	    case Canvas.DOWN:
		break;
	    case Canvas.UP:
                if(this.peak ==0){
                this.peak =1;
                this.PeopleManage.setPeopleYY((float)this.People.getRefPixelY(),
                        (float)this.People.getRefPixelY()+this.peaklength);
                }
		break;
		// case 0: // Ignore keycode that don't map to actions.
	    default:
		return;
            }
    }
    /**
     * Called when a key is released.
     */

    protected  void keyReleased(int keyCode) {
        this.PeopleDirection = 0;
    }
    
    /**
     * Called when a key is repeated (held down).
     */

    protected  void keyRepeated(int keyCode) {
        System.out.println("按下鍵changshijian了?。。?quot;);


    }
    
    /**
     * Called when the pointer is dragged.
     */
    protected  void pointerDragged(int x, int y) {
    }
    
    /**
     * Called when the pointer is pressed.
     */
    protected  void pointerPressed(int x, int y) {
    }
    
    /**
     * Called when the pointer is released.
     */
    protected  void pointerReleased(int x, int y) {
    }
    
    /**
     * Called when action should be handled
     */
    public void commandAction(Command command, Displayable displayable) {
        if(command == this.ExitCmd) {
            
            this.Midlet.exitMIDlet();
        }else if(command == this.PauseCmd) {
            
        }
    }
    public int  getmyHeight(){
        return this.height;
    }
    public int getmyWidth(){
        return this.width;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一本大道在线| 2023国产精品视频| 亚洲福利视频三区| 欧美日韩国产成人在线91| 日本免费在线视频不卡一不卡二| 欧美日韩卡一卡二| 久久66热偷产精品| 国产蜜臀av在线一区二区三区| 不卡的av在线| 天天av天天翘天天综合网色鬼国产 | 亚洲一区自拍偷拍| 欧美丰满嫩嫩电影| 国产一区二区三区精品欧美日韩一区二区三区 | 蜜桃视频一区二区三区在线观看| 日韩欧美国产三级| 成人激情黄色小说| 亚洲sss视频在线视频| 日韩欧美国产不卡| 99精品欧美一区二区三区小说| 亚洲aaa精品| 精品剧情v国产在线观看在线| 国产成人免费9x9x人网站视频| 亚洲美女一区二区三区| 欧美一级免费观看| 成人激情免费网站| 天天操天天干天天综合网| 国产日韩欧美综合在线| 欧美天堂亚洲电影院在线播放 | 久久草av在线| 自拍偷在线精品自拍偷无码专区 | 久久精品国产99久久6| 国产精品拍天天在线| 91精品国产综合久久香蕉麻豆| 国产精品一二三| 亚洲图片一区二区| 亚洲国产精华液网站w| 在线不卡a资源高清| a级高清视频欧美日韩| 麻豆精品国产传媒mv男同| 综合激情成人伊人| 久久久久成人黄色影片| 欧美日韩国产首页| 波多野结衣欧美| 奇米精品一区二区三区在线观看一| 亚洲国产高清在线| 欧美精品一区二区三区很污很色的| 欧美伊人久久久久久久久影院 | 丝袜亚洲另类欧美综合| 国产欧美一区二区精品仙草咪 | 国产亚洲精品免费| 88在线观看91蜜桃国自产| aaa亚洲精品一二三区| 国产一区二区福利| 美女性感视频久久| 亚洲图片欧美视频| 亚洲啪啪综合av一区二区三区| 久久丝袜美腿综合| 日韩欧美亚洲国产精品字幕久久久| 色网站国产精品| 成人av在线资源| 国产一区二区三区香蕉| 久久精品久久精品| 日本大胆欧美人术艺术动态| 亚洲大片精品永久免费| 一区二区三区欧美日韩| 亚洲三级在线免费观看| 中文字幕一区二区三区在线观看| 久久综合九色综合97婷婷女人| 日韩视频免费直播| 欧美一区二区三区日韩视频| 欧美日韩国产bt| 欧美写真视频网站| 欧美亚洲一区三区| 精品视频999| 在线成人av网站| 在线不卡中文字幕播放| 日韩一区二区三免费高清| 在线播放欧美女士性生活| 欧美日精品一区视频| 欧美色精品在线视频| 欧美性受极品xxxx喷水| 欧美午夜不卡在线观看免费| 欧美男女性生活在线直播观看 | www欧美成人18+| 日韩精品专区在线影院重磅| 日韩免费性生活视频播放| 日韩一区二区麻豆国产| 精品少妇一区二区三区日产乱码 | 五月天久久比比资源色| 日本三级韩国三级欧美三级| 男女性色大片免费观看一区二区 | 国产成人综合亚洲网站| 成a人片国产精品| 色婷婷久久久亚洲一区二区三区| 欧美亚洲一区三区| 精品裸体舞一区二区三区| 久久综合久久99| 国产精品动漫网站| 亚洲电影你懂得| 理论片日本一区| 粉嫩欧美一区二区三区高清影视 | 日韩片之四级片| 国产亚洲婷婷免费| 亚洲欧美国产77777| 婷婷夜色潮精品综合在线| 国产毛片精品国产一区二区三区| 成人精品视频.| 欧美性猛片xxxx免费看久爱 | 日本一区二区三区四区在线视频| 亚洲欧美在线高清| 青草国产精品久久久久久| 国产一区二区三区日韩| 一本大道久久精品懂色aⅴ| 51久久夜色精品国产麻豆| 欧美激情综合网| 亚洲成a人v欧美综合天堂下载 | 成年人网站91| 在线成人小视频| 国产精品婷婷午夜在线观看| 香蕉av福利精品导航| 国产精品正在播放| 91成人在线免费观看| 精品久久久久一区二区国产| 亚洲少妇30p| 激情五月婷婷综合网| 91黄色免费观看| 国产喂奶挤奶一区二区三区| 五月婷婷激情综合| 91免费视频网址| 久久网这里都是精品| 亚洲国产va精品久久久不卡综合| 国产一区二区成人久久免费影院| 欧美午夜精品免费| 国产精品电影一区二区三区| 久久99精品久久久| 欧美色精品天天在线观看视频| 日本一区二区电影| 老司机精品视频导航| 欧美午夜精品久久久久久孕妇| 中文字幕欧美激情| 国产在线麻豆精品观看| 91精品一区二区三区久久久久久| 最新中文字幕一区二区三区| 国产成人亚洲综合色影视| 精品日韩一区二区三区 | 久久电影网站中文字幕| 欧美在线观看18| 亚洲视频在线一区观看| 成人网页在线观看| 久久久久97国产精华液好用吗| 奇米一区二区三区| 欧美精品第1页| 亚洲国产成人av| 色婷婷精品大在线视频| 国产精品不卡在线| 成人h动漫精品| 中文字幕欧美日本乱码一线二线| 国产主播一区二区三区| 777亚洲妇女| 男男gaygay亚洲| 欧美一区二区久久| 麻豆传媒一区二区三区| 3751色影院一区二区三区| 亚洲一卡二卡三卡四卡无卡久久 | 久久99久久99精品免视看婷婷| 欧美精选在线播放| 日本aⅴ精品一区二区三区| 538在线一区二区精品国产| 日韩电影在线一区| 欧美xxxxx牲另类人与| 国产一区二区中文字幕| 久久精品一区二区三区不卡| 国产成人免费9x9x人网站视频| 日本一区二区三级电影在线观看| 国产jizzjizz一区二区| 国产精品美女www爽爽爽| 91麻豆国产精品久久| 亚洲尤物视频在线| 这里是久久伊人| 久久成人麻豆午夜电影| 久久久久久久久久久久久女国产乱 | 在线精品亚洲一区二区不卡| 一区二区三区高清在线| 欧美丝袜第三区| 日韩黄色片在线观看| 日韩久久久精品| 国产成人在线视频播放| 亚洲区小说区图片区qvod| 欧美日韩国产高清一区二区| 老司机免费视频一区二区| 日本一区二区三区久久久久久久久不 | 欧美成人精精品一区二区频| 国产美女一区二区三区| 国产精品久久久久毛片软件| 色老综合老女人久久久| 日韩成人av影视| 欧美经典一区二区| 欧美午夜精品一区二区三区| 激情五月激情综合网| 中文字幕亚洲成人|