Link:INB Home|INB English| INB русский язык|INB العربية|INB Türkiye|INB فارسی|INB Español|INB Français|INB Português|INB Deutsch|INB 國語|INB 中文|INB 日本语|INB 한국어|INB ภาษาไทย|INB tiếng Việt||FL 教程Flash 設計賽車游戲教程
INB 國語論壇
歡迎光臨(工業與草根研究員)對工業時代充滿了戰鬥精神,你和我都通過網絡空間與當地草根精神研究員來到瘋狂實驗室。家inbforum.com,永久名稱:tw-inbforum.forums2u.com
INB 國語論壇
歡迎光臨(工業與草根研究員)對工業時代充滿了戰鬥精神,你和我都通過網絡空間與當地草根精神研究員來到瘋狂實驗室。家inbforum.com,永久名稱:tw-inbforum.forums2u.com
INB 國語論壇

歡迎光臨(工業與草根研究員)對工業時代充滿了戰鬥精神,你和我都通過網絡空間與當地草根精神研究員來到瘋狂實驗室。家inbforum.com,永久名稱:tw-inbforum.forums2u.com


您沒有登錄。 請登錄註冊

《《《《《《《上一页INBforum   向下

上一页INBforum》》》》》》》上一篇主題 下一篇主題 向下  內容 [第1頁(共1頁)]

1FL 教程Flash 設計賽車游戲教程 Empty FL 教程Flash 設計賽車游戲教程 周四 3月 03, 2011 7:15 pm

Admin

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

先測試效果:









點擊這里下載源文件

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


FL 教程Flash 設計賽車游戲教程 20070517113158_01

然后根據上面的車,設計一個賽車陰影影片剪輯。拖放到舞臺上的時候命名實例名為shadow1。


FL 教程Flash 設計賽車游戲教程 1254301

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


FL 教程Flash 設計賽車游戲教程 1254302

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


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;  測試了!今天快下班了!!明天接著給大家把這個游戲弄的更加完整!后面還有兩個步驟,大家通過測試上面的動畫會發現車沒有場地限制!之后我們將給它限定一定的路線。期望!]

http://tw.inbforum.com

2FL 教程Flash 設計賽車游戲教程 Empty 回復: FL 教程Flash 設計賽車游戲教程 周四 12月 04, 2014 11:16 pm

tutuqwe


溪頭大富華森林會館
[您必需注冊登錄才能查看本鏈接。]
1.溪頭民宿,溪頭住宿推薦
[您必需注冊登錄才能查看本鏈接。]
2.妖怪村民宿,妖怪村住宿
[您必需注冊登錄才能查看本鏈接。]
3.妖怪村客房介紹
[您必需注冊登錄才能查看本鏈接。]
4.妖怪村民宿環境設施
[您必需注冊登錄才能查看本鏈接。]
5.妖怪村住宿地圖導覽
[您必需注冊登錄才能查看本鏈接。]
6.溪頭熱門旅游景點介紹
[您必需注冊登錄才能查看本鏈接。]
氬焊機
堆高機
電動車
推高機
拖板車
物料架
料架
led招牌
字幕機
電視牆
跑馬燈
廣告招牌
花蓮民宿
花蓮民宿
金門租車
金門旅遊
超音波熔接機
超音波熔接機
台北搬家
台北搬家]

http://www.songf.com.tw

上一页INBforum   向下

上一页INBforum上一篇主題 下一篇主題 回頂端  內容 [第1頁(共1頁)]

這個論壇的權限:
無法 在這個版面回復文章

Copyright ©2009-2010 LTD Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

IT:SINGLESERVGoogle谷歌翻译TranslateFORUMSOFTLAYERGoogle谷歌广告联盟AdSenseAsia

 

Free forum | ©phpBB | 免費論壇互助中心 | 違法舉報 | Latest discussions