日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

由淺入深學(xué)習(xí)Flash制作賽車游戲教程_Flash教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:Flash8實現(xiàn)動態(tài)星空的通用方法
你想做星空嗎?只需要把本教程的代碼復(fù)制就可以了!先看下效果:制作方法:首先修改文檔屬性:黑色背景、幀頻30fps新建立一個影片剪輯。在影片剪輯元件中繪制

賽車游戲我們總是碰到!今天給大家簡單講解一下。

先測試效果:

點擊這里下載源文件

首先新建立一個賽車影片剪輯,由6個圖層組成一個基本的賽車。放到舞臺上的時候命名實例名為car1。

由淺入深學(xué)習(xí)Flash制作賽車游戲教程

然后根據(jù)上面的車,制作一個賽車陰影影片剪輯。拖放到舞臺上的時候命名實例名為shadow1。

由淺入深學(xué)習(xí)Flash制作賽車游戲教程

然后建立一個新的空的影片剪輯。拖放到舞臺上的時候命名實例名stepper。

由淺入深學(xué)習(xí)Flash制作賽車游戲教程

然后選中該空影片剪輯輸入下面代碼:

onClipEvent(load){
speed1 = 0;
}
onClipEvent(enterFrame){
_root.step(1);
}

然后新建立一個層Action,輸入下面代碼:

function step(who) {
//check to see if the car in question is controlled by the player or by the computer
if (_root["car" who].code == "player") {
//we will constantly decrease speed by multiplying it with a number below 1
if (this["speed" who]>0.3) {
this["speed" who] *= _root.speedDecay;
} else {
this["speed" who] = 0;
}
//the car will react to certain keys
//accelerate
if (Key.isDown(Key.UP) && this["speed" who]<_root.maxSpeed) {
this["speed" who] = _root.acceleration;
}
//brake (reverse)
if (Key.isDown(Key.DOWN)) {
this["speed" who] -= _root.backSpeed;
}
//steer left
if (Key.isDown(Key.LEFT) && this["speed" who]>0.3) {
_root["car" who]._rotation -= _root.rotationStep*(this["speed" who]/_root.maxSpeed);
}
//steer right
if (Key.isDown(Key.RIGHT) && this["speed" who]>0.3) {
_root["car" who]._rotation = _root.rotationStep*(this["speed" who]/_root.maxSpeed);
}
this["rotation" who] = _root["car" who]._rotation;
//we calculate the two components of speed (X axis and Y axis)
this["speedx" who] = Math.sin(this["rotation" who]*(Math.PI/180))*this["speed" who];
this["speedy" who] = Math.cos(this["rotation" who]*(Math.PI/180))*this["speed" who]*-1;
//apply the components on the actual position of the car
_root["car" who]._x = this["speedx" who];
_root["car" who]._y = this["speedy" who];
//position the shadow of the car
_root["shadow" who]._x = _root["car" who]._x-4;
_root["shadow" who]._y = _root["car" who]._y 2;
_root["shadow" who]._rotation = _root["car" who]._rotation;
}
if (_root["car" who].code == "computer") {
}
}

  然后再建立一個層,輸入下面代碼(用于初始化變量)

car1.code = "player";
acceleration = 0.4;
speedDecay = 0.96;
rotationStep = 10;
maxSpeed = 10;
backSpeed = 1;

  測試了!今天快下班了��!明天接著給大家把這個游戲弄的更加完整!后面還有兩個步驟,大家通過測試上面的動畫會發(fā)現(xiàn)車沒有場地限制!之后我們將給它限定一定的路線。期望!

分享:Flash8制作圖片由模糊到清楚效果
以前記得是在哪個網(wǎng)站看到這個效果,但是怎么找也找不到了!所以給大家講解一下如何制作。主要是講解Flash8的blur濾鏡,利用Actonscript調(diào)用blur濾鏡實現(xiàn)由模糊

來源:網(wǎng)頁教學(xué)網(wǎng)//所屬分類:Flash教程/更新時間:2008-03-05
相關(guān)Flash教程