【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析_第1頁
【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析_第2頁
【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析_第3頁
【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析_第4頁
【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析_第5頁
已閱讀5頁,還剩4頁未讀, 繼續(xù)免費閱讀

付費下載

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

【移動應用開發(fā)技術】HTML5開發(fā)Android本地化App的示例分析

/upload/information/20210522/379/539224.jpg制作開始一,準備二,游戲開發(fā)var

loadData

=

[

{path:"../jquery.js",type:"js"},

{path:"./js/share.js",type:"js"},

{path:"./js/Social.js",type:"js"},

{path:"./js/GameRanking.js",type:"js"},

{path:"./js/GameLogo.js",type:"js"},

{path:"./js/GameClear.js",type:"js"},

{path:"./js/Gem.js",type:"js"},

{path:"./js/Stage.js",type:"js"},

{path:"./js/Clock.js",type:"js"},

{path:"./js/Point.js",type:"js"},

{path:"./js/GetPoint.js",type:"js"},

{path:"./js/Bullet.js",type:"js"},

{path:"./js/Event.js",type:"js"},

{path:"./js/function.js",type:"js"},

{path:"./js/GameBody.js",type:"js"},

{name:"num.+",path:"./images/plus.png"},

{name:"num.0",path:"./images/0.png"},

{name:"num.1",path:"./images/1.png"},

{name:"num.2",path:"./images/2.png"},

{name:"num.3",path:"./images/3.png"},

{name:"num.4",path:"./images/4.png"},

{name:"num.5",path:"./images/5.png"},

{name:"num.6",path:"./images/6.png"},

{name:"num.7",path:"./images/7.png"},

{name:"num.8",path:"./images/8.png"},

{name:"num.9",path:"./images/9.png"},

{name:"back",path:"./images/back.png"},

{name:"line",path:"./images/line.png"},

{name:"clear",path:"./images/clear.png"},

{name:"gem01",path:"./images/gem01.png"},

{name:"gem02",path:"./images/gem02.png"},

{name:"gem03",path:"./images/gem03.png"},

{name:"gem04",path:"./images/gem04.png"},

{name:"gem05",path:"./images/gem05.png"},

{name:"gem06",path:"./images/gem06.png"},

{name:"gem07",path:"./images/gem07.png"},

{name:"gem08",path:"./images/gem08.png"},

{name:"gem09",path:"./images/gem09.png"},

{name:"ico_sina",path:"./images/ico_sina.gif"},

{name:"ico_qq",path:"./images/ico_qq.gif"},

{name:"ico_facebook",path:"./images/ico_facebook.png"},

{name:"ico_twitter",path:"./images/ico_twitter.png"}

];function

main(){

loadingLayer

=

new

LoadingSample3();

addChild(loadingLayer);

LLoadManage.load(

loadData,

function(progress){

loadingLayer.setProgress(progress);

},

function(result){

LGlobal.setDebug(true);

datalist

=

result;

removeChild(loadingLayer);

loadingLayer

=

null;

gameInit();

}

);

}function

addGem(){

stage.setStage(stage.num

+

1);

gemLayer.removeAllChild();

list

=

[];

//添加寶石

for(i=0;i<8;i++){

list.push([]);

for(var

j=0;j<8;j++){

num

=

(Math.random()*9

>>>

0)+1;

g

=

new

Gem(num);

g.x

=

j*60;

g.y

=

i*60+120;

gemLayer.addChild(g);

list[i].push(g);

}

}

//檢驗可消除寶石

do{

clearList

=

checkClear();

if(clearList.length

>

0){

for(i=0;i<clearList.length;i++){

g

=

clearList[i];

num

=

(Math.random()*9

>>>

0)+1;

g.change(num);

}

}

}while(clearList.length

>

0);

}function

Gem(num){

var

self

=

this;

base(self,LSprite,[]);

self.num

=

num;

self.bitmap

=

new

LBitmap(new

LBitmapData(datalist["gem0"+num]));

self.bitmap.x=self.bitmap.y=10;

self.addChild(self.bitmap);

}

Gtotype.change

=

function

(num){

var

self

=

this;

self.num

=

num;

self.bitmap.bitmapData

=

new

LBitmapData(datalist["gem0"+num]);

}clearList

=

[];

//橫向檢索

for(i=0;i<8;i++){

checkList

=

[list[i][0]];

for(j=1;j<8;j++){

if(checkList[checkList.length

-

1].num

==

list[i][j].num){

checkList.push(list[i][j]);

}else{

clearList

=

addClearList(clearList,checkList);

checkList

=

[list[i][j]];

}

}

clearList

=

addClearList(clearList,checkList);

}

//縱向檢索

for(i=0;i<8;i++){

checkList

=

[list[0][i]];

for(j=1;j<8;j++){

if(checkList[checkList.length

-

1].num

==

list[j][i].num){

checkList.push(list[j][i]);

}else{

clearList

=

addClearList(clearList,checkList);

checkList

=

[list[j][i]];

}

}

clearList

=

addClearList(clearList,checkList);

}function

addClearList(clearList,checkList){

if(checkList.length

>=

3){

clearList

=

clearList.concat(checkList)

}

return

clearList;

}backLayer.addEventListener(LMouseEvent.MOUSE_DOWN,onDown);

backLayer.addEventListener(LMouseEvent.MOUSE_UP,onUp);function

onDown(e){

if(mouse_down_obj.isMouseDown)return;

continuous

=

0;

mouse_down_obj.x

=

e.offsetX;

mouse_down_obj.y

=

e.offsetY;

mouse_down_obj.time

=

new

Date().getTime();

mouse_down_obj.cx

=

e.offsetX/60

>>>

0;

mouse_down_obj.cy

=

(e.offsetY

-

120)/60

>>>

0;

mouse_down_obj.isMouseDown

=

true;

list[mouse_down_obj.cy][mouse_down_obj.cx].graphics.drawRect(1,"black",[0,

0,

60,

60],true,"#000000");

}function

onUp(e){

list[mouse_down_obj.cy][mouse_down_obj.cx].graphics.clear();

if(new

Date().getTime()

-

mouse_down_obj.time

>

500){

mouse_down_obj.isMouseDown

=

false;

return;

}

var

mx

=

e.offsetX

-

mouse_down_obj.x;

var

my

=

e.offsetY

-

mouse_down_obj.y;

if(Math.abs(mx)

>

Math.abs(my)){

if(mx

>

50){

move("right");

return;

}else

if(mx

<

-50){

move("left");

return;

}

}else{

if(my

>

50){

move("down");

return;

}else

if(my

<

-50){

move("up");

return;

}

}

mouse_down_obj.isMouseDown

=

false;

}function

move(dir){

direction

=

dir;

var

m

=

moveGem(dir,8);

var

mx

=

m[0],my

=

m[1];

var

obj,fun;

for(var

i=0;i<8;i++){

if(mx

==

0){

obj

=

list[i][mouse_down_obj.cx];

}else{

obj

=

list[mouse_down_obj.cy][i];

}

if(i

<

7){

fun

=

null;

}else{

fun

=

function(){

hiddenObj.visible

=

true;

checkClear();

};

}

LTweenLite.to(obj,0.3,

{

x:obj.x+mx,

y:obj.y+my,

onComplete:fun,

ease:Strong.easeOut

});

}

}/upload/information/20210522/379/539228.jpg/upload/information/20210522/379/539233.jpgfunction

moveList(){

var

gem,time,maxTime,mx,my,fun;

maxTime

=

0;

switch(direction){

case

"left":

for(i=0;i<8;i++){

for(j=0;j<8;j++){

gem

=

list[i][j];

mx

=

60*j;

if(gem.x

>

mx){

time

=

0.3*((gem.x-mx)

/

60

>>>

0);

if(maxTime

<

time)maxTime

=

time;

fun

=

null;

if(gem.x

>

420){

fun

=

function(gem){

if(gem.x

<=

420)gem.visible

=

true;

}

}

LTweenLite.to(gem,time,

{

x:mx,

onUpdate:fun,

onComplete:fun,

ease:Strong.easeOut

});

}

}

}

break;

case

"right":

for(i=0;i<8;i++){

for(j=0;j<8;j++){

gem

=

list[i][j];

mx

=

60*j;

if(gem.x

<

mx){

time

=

0.3*((mx-gem.x)

/

60

>>>

0);

if(maxTime

<

time)maxTime

=

time;

fun

=

null;

if(gem.x

<

0){

fun

=

function(gem){

if(gem.x

>=

0)gem.visible

=

true;

}

}

LTweenLite.to(gem,time,

{

x:mx,

onUpdate:fun,

onComplete:fun,

ease:Strong.easeOut

});

}

}

}

break;

case

"up":

for(i=0;i<8;i++){

for(j=0;j<8;j++){

gem

=

list[j][i];

my

=

120+60*j;

if(gem.y

>

my){

time

=

0.3*((gem.y-my)

/

60

>>>

0);

if(maxTime

<

time)maxTime

=

time;

fun

=

null;

if(gem.y

>

560){

fun

=

function(gem){

if(gem.y

<=

560)gem.visible

=

true;

}

}

LTweenLite.to(gem,time,

{

y:my,

onUpdate:fun,

onComplete:fun,

ease:Strong.easeOut

});

}

}

}

break;

case

"down":

for(i=0;i<8;i++){

for(j=0;j<8;j++){

gem

=

list[j][i];

my

=

120+60*j;

if(gem.y

<

my){

time

=

0.3*((my-gem.y)

/

60

>>>

0);

if(maxTime

<

time)maxTime

=

time;

fun

=

null;

if(gem.y

<

120){

fun

=

function(gem){

if(gem.y

>=

120)gem.visible

=

true;

}

}

LTweenLite.to(gem,time,

{

y:my,

onUpdate:fun,

onComplete:fun,

ease:Strong.easeOut

});

}

}

}

break;

}

LTweenLite.to({},maxTime*1.5,

{

onComplete:checkStageClear,

ease:Strong.easeOut

});

}function

Clock(){

var

self

=

this;

base(self,LSprite,[]);

self.timer

=

0;

self.addTimer

=

0.05;

self.graphics.drawArc(5,"#333333",[0,0,70,0,2*Math.PI]);

}

Ctotype.onframe

=

function

(){

var

self

=

this

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論