Cov txheej txheem:

Tsim 2D Game: 15 Kauj Ruam
Tsim 2D Game: 15 Kauj Ruam

Video: Tsim 2D Game: 15 Kauj Ruam

Video: Tsim 2D Game: 15 Kauj Ruam
Video: Rau Siab Kawm Ntawd Maiv Twm & Me Nyuam Kub (Tub Hmoov) New Song 2023-2024 2024, Kaum ib hlis
Anonim
Tsim 2D Game
Tsim 2D Game
Tsim 2D Game
Tsim 2D Game
Tsim 2D Game
Tsim 2D Game

Nkees ntawm kev ua si? Vim li cas koj tsis ua game?

Cov lus qhia no taug koj txoj hauv kev yuav ua li cas kom yooj yim 2D Game …

Peb yuav Siv Unity Game Engine los tsim thiab tsim peb 2D Game… thiab tseem siv Microsoft Visual Studio rau Program thiab Tsim Ib co ntawv sau.

Khoom siv

1- Kev Sib Koom Game Cav

2- Microsoft Visual Studio

Kauj ruam 1: Rub tawm Unity Game Engine & Microsoft Visual Studio

Rub tawm Unity Game Engine & Microsoft Visual Studio
Rub tawm Unity Game Engine & Microsoft Visual Studio
Rub tawm Unity Game Engine & Microsoft Visual Studio
Rub tawm Unity Game Engine & Microsoft Visual Studio

Txhawm rau Tsim & Program peb cov Game peb xav tau Game Engine ("Unity") & Visual studio… Yog li cia peb rub lawv ua ntej:

1-Siv Qhov Txuas … lossis Tshawb nrhiav "rub Unity Hub" … Txhawm rau rub "Unity Hub" ua ntej

3- Tom qab ntawv siv Qhov Txuas No … Txhawm rau rub "Unity"

4- Xaiv Unity version, Tom qab ntawv nyem rau "Download (Win)" -> "Unity installer"

Nco ntsoov Txheeb Xyuas Kev Sib Koom & Microsoft Visual Studio Community 2019 raws li qhia hauv daim duab thib ob

Kauj Ruam 2: Tsim Txoj Haujlwm Tshiab & Ntshuam Cov Khoom Tshiab

Image
Image
Tsim Txoj Haujlwm Tshiab & Ntshuam Cov Khoom Tshiab
Tsim Txoj Haujlwm Tshiab & Ntshuam Cov Khoom Tshiab

Tom qab rub tawm "Unity Hub", "Unity" & "Microsoft Visual Studio Community 2019" … cia pib

1- Qhib "Kev Sib Koom" … Tom qab ntawd, nws yuav cia li khiav "Unity Hub"

2- Tam sim no peb yuav tsum tsim Txoj Haujlwm Tshiab … Nyem rau "TSHIAB"

3- Xaiv 2D Tus Qauv, Sau koj Lub Npe Lub Npe & Xaiv Qhov Chaw Haum rau koj Txoj Haujlwm

4- Nyem rau ntawm "Tsim"

Tom qab Nyem rau ntawm "Tsim" Kev sib haum xeeb yuav khiav …

Tam sim no peb yuav tsum Ntxiv Peb Tus Cwj Pwm, Tom Qab & Cov Hom Phiaj …

Yog tias koj tsis muaj Ib qho ntxiv rau… koj tuaj yeem mus ntsib Qhov Txuas, Txhawm rau rub cov khoom uas koj xav tau.

Thiab tam sim no peb xav ntxiv Cov Khoom Muaj rau Kev Sib Koom… Ua kom qhov no:

Ib qho yooj yim koj tuaj yeem rub daim nplaub tshev thiab tso rau ntawm Qhov Project Window hauv Kev Sib Koom.

LOS YOG

1- Mus rau Kev Ncaj Ncees & Txoj Cai Nyem rau ntawm qhov chaw ntshiab hauv "Project" qhov rai raws li qhia hauv daim duab thib ob

2- Xaiv keeb kwm yav dhau, Tus yam ntxwv & Yam khoom uas koj xav ntxiv los ntawm daim nplaub tshev.

Kauj Ruam 3: Ntxiv Koj Cov Khoom Muaj Cai rau Scene

Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene
Ntxiv Koj Cov Khoom Muaj Nqis rau Scene

Yog tias koj ntxiv ib yam dab tsi rau Lub Qhov Muag Scene … nws yuav tshwm nyob rau hauv Game window

Txhawm rau paub ntau ntxiv txog Unity's Windows koj tuaj yeem Mus Saib Qhov Txuas …

raws li koj pom hauv thawj daim duab muaj lub Thawv Dawb nyob hauv lub qhov rais thiab qhov no yog lub thawv ntawm Lub Koob Yees Duab … Yog li txhua yam hauv lub thawv no, lub koob yees duab yuav tso tawm.

Tam sim no cia peb xub ntxiv keeb kwm yav dhau los rau lub qhov rais Scene …

1- Cias Luag Cov Duab Tom Qab los ntawm Project Window thiab tso nws rau hauv Qhov Chaw Scene

thiab xyuas kom cov duab haum lub thawv ntawm Lub Koob Yees Duab

koj tuaj yeem hloov kho cov duab Loj los ntawm kev xaiv Rect Tool los ntawm Toolbar raws li qhia hauv daim duab thib peb.

kuj ntxiv cov khoom thiab koj tus yam ntxwv uas koj xav tau rau Scene… raws li Qhia hauv Cov Duab Kawg.

Kauj Ruam 4: Ntxiv Qee Qhov Physics rau Tus Cwj Pwm

Ntxiv Qee Qhov Physics rau Tus Cwj Pwm
Ntxiv Qee Qhov Physics rau Tus Cwj Pwm
Ntxiv Qee Qhov Physics rau Tus Cwj Pwm
Ntxiv Qee Qhov Physics rau Tus Cwj Pwm

Ua ntej tshaj, los sim lossis Ua Si Koj Cov Game nyem rau ntawm Play button hauv Toolbar …

Yog tias Koj Ua Si Koj Cov Game Tam sim no… Tus cwj pwm tsis txav mus, tsis muaj lub ntiajteb txawj nqus… txhua yam zoo li qub…

txhawm rau ntxiv txhua yam khoom siv Physics rau peb Tus Cwj Pwm … peb siv cov cuab yeej Rigidbody2D Cov cuab yeej no tso cai rau koj hloov kho Lub zog nqus, hnyav, hnyav & lwm yam …

Yog li cia nws ntxiv rau peb Tus Cwj Pwm …

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Tshawb nrhiav Rigidbody2D

4- Xaiv nws.

Yog tias koj ua si tam sim no…. Peb Tus Cwj Pwm poob qis vim yog lub ntiajteb: D

Kauj Ruam 5: Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm

Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm
Ntxiv Kev Sib Tsoo rau Peb Tus Cwj Pwm

Tam sim no peb xav tau ntxiv Collider2D cov cuab yeej los tso tus yam ntxwv sib tsoo nrog hauv av thiab lwm yam khoom siv…

Txhawm rau ua qhov ntawd … Peb thawj zaug yuav tsum tau ntxiv cov khoom no rau peb tus yam ntxwv thiab lwm yam khoom uas xav tau los sib tsoo nrog nws.

Ua ntej, cia peb ntxiv nws hauv Tus Cwj Pwm …

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nias rau ntawm "Ntxiv Cheeb Tsam"

3- Tshawb nrhiav BoxCollider2D

4- Xaiv nws.

5- Nyem rau ntawm lub npov "Kho Collider" los ntawm BoxCollider2D uas tshwm nyob rau hauv Tus Kws Tshuaj Ntsuam Xyuas, Kom tuaj yeem hloov kho lub thawv ntsuab uas tshwm hauv qhov xwm txheej

6- Luag ib qho ntawm Cov Ntsiab Lus Ntsuab uas tshwm hauv lub thawv ntsuab kom haum rau Tus Cwj Pwm

Qhov thib ob, cia ntxiv rau hauv av (Ua Tib Cov Kauj Ruam) …

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nias rau "Add Component"

3- Tshawb nrhiav BoxCollider2D

4- Xaiv nws.

5- Nyem rau ntawm lub npov "Kho Collider" los ntawm BoxCollider2D uas tshwm nyob rau hauv Tus Kws Tshuaj Ntsuam Xyuas, Kom tuaj yeem hloov kho lub thawv ntsuab uas tshwm hauv qhov xwm txheej

6- Luag ib qho ntawm Cov Ntsiab Lus Ntsuab uas tshwm hauv lub thawv ntsuab kom haum rau Tus Cwj Pwm

Tam sim no yog tias koj ua si qhov kev ua si koj yuav pom tias Tus Cwj Pwm sawv ntawm qhov av:>

Kauj Ruam 6: Tsiv Peb Tus Kheej

Image
Image
Ua Peb Tus Cwj Pwm Dhia
Ua Peb Tus Cwj Pwm Dhia

Txhawm rau Ua Peb Tus Cwj Pwm ua ib txoj haujlwm twg, peb xav tau thawj zaug ntxiv rau nws Tsab Ntawv los qhia nws yuav ua li cas …

Kev sib koom siab siv C# Lus… Yog koj xav kawm paub ntau ntxiv txog nws koj tuaj yeem mus saib qhov Txuas no

Yog li cia Tsim Tsab ntawv

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv tsab ntawv tsa suab)…

4- Nyem rau ntawm "Tsab ntawv tshiab"

5- Nyem rau ntawm "Tsim thiab Ntxiv"

Tam sim no Ob npaug coj mus rhaub rau nws txhawm rau Kho Cov Ntawv

6- Rho tawm txhua tus lej uas tau sau cia

7- Rub tawm Cov Ntawv, Luam nws thiab Muab nws tso rau hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName)

8- yog tias koj xav paub yuav ua li cas Tus lej no… Mus ntsib Qhov Txuas

9- Txuag Tsab Ntawv thiab Mus rau Tus Kws Tshuaj Xyuas Tus Kheej, Saib ntawm koj tsab ntawv

10- Xaiv txoj cai thiab sab laug khawm thiab teeb tsa koj kom nrawm.

Tam sim no yog tias koj Ua Si Game Tus Cwj Pwm Yuav Tsiv …: D

Kauj Ruam 7: Ua Peb Tus Cwj Pwm dhia

Ua Peb Tus Cwj Pwm Dhia
Ua Peb Tus Cwj Pwm Dhia
Ua Peb Tus Cwj Pwm Dhia
Ua Peb Tus Cwj Pwm Dhia

Tom qab ntxiv qhov txav ntawm peb Tus Cwj Pwm … tam sim no peb tau npaj los ua peb Tus Cwj Pwm Jumps …

Yog li peb tseem xav tau los Tsim Tsab Ntawv tshiab uas ua rau peb Tus Cwj Pwm dhia …

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv li dhia) …

4- Nyem rau ntawm "Tsab ntawv tshiab"

5- Nyem rau ntawm "Tsim thiab Ntxiv"

Ua ntej Hloov Kho Cov Ntawv Dhia … Cia peb ntxiv thawj txheej rau hauv av kom Ua Kev Sib Koom paub tias yam khoom no yog av …

1- Xaiv Cov Hauv Paus Los Ntawm Lub Hierarchy

2- Nyem rau ntawm "Default" los ntawm "Layer" uas yog nyob rau sab saum toj ntawm Tus Kws Tshuaj Ntsuam Xyuas

3- Xaiv "Ntxiv Txheej"

4- Npe lub npe txheej 8 mus rau "Av" (Raws Li Pom Hauv Daim Duab Ob)

5- Xaiv Cov Hauv Paus Los Ntawm Lub Hierarchy dua

6- Nyem rau "Default" los ntawm "Layer" uas yog nyob rau sab saum toj ntawm Tus Kws Tshuaj Ntsuam Xyuas

7- Xaiv "Hauv av"

Qhov ntawd yog nws … Peb thaum kawg Tsim Cov Txheej Txheem Tshiab uas yog "Hauv av" thiab ntxiv rau peb hauv av

Ua ntej kuj Ua Peb Tus Cwj Pwm Dhia, peb yuav tsum paub tseeb tias nws tau kov hauv av thaum ntawd, nws dhia.

Yog li cia peb tsim GroundCheck rau peb Tus Cwj Pwm …

1- Txoj cai nyem rau ntawm koj tus yam ntxwv los ntawm Hierarchy

2- Xaiv "Tsim Tsis Tau" thiab hloov nws "GroundCheck"

3- Xaiv "Move Tool" los ntawm toolbar thiab txav "GroundCheck" mus rau Tus Cwj Pwm lossis Lub Nkoj (Raws li qhia hauv daim duab thib tsib)

Tom qab ntawd peb tau npaj los kho peb Cov Ntawv Dhia

1- Qhib koj Daim Ntawv Dhia (Los ntawm Txoj Haujlwm lossis Tus Kws Saib Xyuas)

2- Rho tawm txhua tus lej uas tau sau cia

3- Rub tawm Cov Ntawv, Luam nws thiab Muab nws tso rau hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName)

yog tias koj xav paub yuav ua li cas peb Code no… Mus ntsib Qhov Txuas

4- Txuag Tsab Ntawv thiab Mus rau Tus Kws Tshuaj Xyuas Tus Kheej, Saib koj tsab ntawv (raws li tau qhia hauv Duab Duab Rau)

5- Teeb tsa koj lub zog dhia, ntxiv "GroundCheck" mus rau Hauv Qhov Chaw Tshawb Xyuas Hauv Paus (los ntawm kev rub nws thiab tso nws rau ntawm lub thawv duab plaub), Teeb koj Lub Hauv Paus Radius (Piv Txwv 0.1), Xaiv Cov Hauv Paus Txheej "Hauv av" & Thaum kawg xaiv khawm Dhia.

Yog tias koj ua Game tam sim no…. Nws taug kev & dhia … Hurraaaaay:)

Kauj Ruam 8: Ua kom pom tus yam ntxwv

Image
Image
Animate Tus Cwj Pwm
Animate Tus Cwj Pwm
Animate Tus Cwj Pwm
Animate Tus Cwj Pwm
Animate Tus Cwj Pwm
Animate Tus Cwj Pwm

Tom qab Ua Peb Tus Cwj Pwm txav & Dhia … cia Animate nws … Nws yuav ua rau nws zoo li txias heev …

koj xav tau thawj daim duab Sprite ntawm Kev Tsis Txaus Siab thiab Taug Kev thiab Dhia (raws li Qhia Los Ntawm Thawj Mus Rau Duab Plaub)

Txhawm rau ua kom tus yam ntxwv koj yuav tsum tau ua haujlwm ntawm Animation Window & Animator Window thiab nyob rau hauv qhov tsis sib xws ntawm kev sib koom ua ke koj tsis tso saib Cov Windows no … kom tau txais lawv:

1- Nyem rau Ctrl+6 kom tau Animation window

2- Xaiv Qhov rai los ntawm sab saud sab saum toj nco-down xaiv (Raws li qhia hauv daim duab thib tsib)

Tom qab ntawd, Xaiv "Animation" -> "Animator" ces ob lub Windows Yuav qhib (Animation Window & Animator Window)

Tam sim no cia peb pib Animate Tus Cwj Pwm thaum nws Idling …

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Nyem rau ntawm "Tsim" Khawm ntawm Animation Windows

3- Xaiv qhov chaw tsim nyog los cawm qhov ua yeeb yaj kiab hauv nws

4- Tom qab ntawd Xaiv tag nrho Cov Duab Tsis Txaus Siab los ntawm Txoj Haujlwm & rub thiab Muab tso rau hauv Qhov Chaw Ua Yeeb Yam (raws li Qhia hauv Daim Duab Thib Rau)

Yog tias koj tam sim no Ua Tus Cwj Pwm Tsis Ua Haujlwm Wow … Zoo heev …

Tam sim no cia Nws ua si Taug kev animation thaum nws taug kev …

1- Mus rau Animation Window nyem rau ntawm "New Animation"

2- Xaiv "Tsim Clip tshiab"

3- Xaiv qhov chaw tsim nyog los cawm qhov ua yeeb yaj kiab hauv nws

4- Tom qab ntawd Xaiv tag nrho Cov Duab Taug Kev los ntawm Txoj Haujlwm & rub thiab Muab tso rau hauv Qhov Tsiaj Animation

Tam sim no qhib qhov Animator Window

1- Txoj Cai Nyem rau ntawm Idle Box xaiv "ua Kev Hloov" thiab nyem rau ntawm Walk Box (raws li Qhia hauv Daim Duab Thib Xya)

Nco tseg: Yuav tsum tsis muaj Lub Npe Zoo ib yam ntawm lub npov ua yeeb yaj kiab nws nyob ntawm koj lub npe nws li cas …

2- Txoj Cai Nyem rau ntawm Taug Kev Box xaiv "Ua Kev Hloov" thiab nyem rau ntawm Idle Box

3- Hauv Cov Parameters Nyem rau Ntxiv Icon (+) Xaiv Bool (Npe nws piv txwv Taug Kev)

4- Xaiv cov xub uas txav los ntawm Idle rau Walk animation, Mus rau nwsInspector thiab teeb "Muaj Sijhawm Tawm" mus rau qhov tsis tseeb, "Lub Sijhawm Ntev" rau qhov tsis tseeb, Teeb "Lub Sijhawm Hloov" mus rau Xoom, thiab Nyem rau ntxiv (+) Qhov ntawd muaj nyob hauv Tus Txheej Txheem thiab Teeb "Taug Kev" mus rau "Muaj tseeb" (Raws li Qhia hauv Daim Duab 8) …

5- Xaiv cov xub uas txav los ntawm Taug Kev mus rau Qaum tsis ua haujlwm, Mus rau nws Tus Kws Saib Xyuas thiab teeb tsa "Muaj Sijhawm Tawm" mus rau qhov tsis tseeb, "Lub Sijhawm Ntev" rau qhov tsis tseeb, Teeb "Lub Sijhawm Hloov" mus rau Xoom, thiab Nyem rau ntxiv (+) Qhov ntawd muaj nyob rau hauv Tus Kheej thiab Teeb "Taug Kev" mus rau "Cuav"

6- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

7- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nias ntawm "Ntxiv Cov Khoom"

8- Sau lub npe ntawm Tsab Ntawv (piv txwv li AnimateWalk) …

9- Nyem rau "Tsab ntawv tshiab"

10- Nyem rau ntawm "Tsim thiab Ntxiv"

11- Rho tawm txhua tus lej uas tau sau cia

12- Rub tawm Cov Ntawv, Luam thiab hla nws hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Lub Npe hloov chaw #yourScriptName, koj tsab ntawv tsab ntawv tsa suab tsis hloov #YourMotionScriptName & tseem koj lub npe dhia tsab ntawv tsis txhob siv #YourJumpingScriptName, thiab Sau Koj lub npe Bool tsis yog "Taug Kev" Uas koj tau tsim sab hauv Parameters hauv Animator)

13- Txuag Tsab Ntawv thiab Mus rau Tus Kws Tshuaj Ntsuam Xyuas, Saib ntawm koj tsab ntawv

14- Drag koj Tus Cwj Pwm thiab Muab tso rau hauv "Insertyour Motion Script" & "Insertyour Jump Script"

Yog tias Koj Ua Si Game Tam Sim No, Tus Neeg Ua Si Idling thiab yeej nws txav qhov Kev Ua Si Animation Ua Si … Txias:>

Tam sim no cia Nws ua si dhia dhia thaum nws dhia …

1- Mus rau Animation Window nyem rau ntawm "New Animation"

2- Xaiv "Tsim Clip tshiab"

3- Xaiv qhov chaw tsim nyog los cawm qhov ua yeeb yaj kiab hauv nws

4- Tom qab ntawd Xaiv tag nrho Cov Duab Dhia los ntawm Txoj Haujlwm & rub thiab Muab tso rau hauv lub qhov rai Animation

Tam sim no qhib qhov Animator Window

1- Txoj Cai Nyem rau ntawm Idle Box xaiv "ua Kev Hloov" thiab nyem rau ntawm Jump Box (raws li Qhia hauv Daim Duab Cuaj)

2- Txoj Cai Nyem rau ntawm Jump Box xaiv "Ua Hloov" thiab nyem rau ntawm Run Box

3- Hauv Cov Parameters Nyem rau Ntxiv Icon (+) Xaiv Bool (Npe nws piv txwv li dhia)

4- Xaiv cov xub uas txav los ntawm Idle mus dhia cov duab, Mus rau nws Tus Kws Saib Xyuas thiab teeb tsa "Muaj Sijhawm Tawm" mus rau qhov tsis tseeb, "Lub Sijhawm Ntev" rau qhov tsis tseeb, Teeb "Lub Sijhawm Hloov" mus rau Xoom, thiab Nyem rau ntxiv (+) Qhov ntawd muaj nyob rau hauv Tus Kheej thiab Teeb "Dhia" mus rau "Tseeb" (Raws Li Qhia Hauv Daim Duab Duab Xwb) …

5- Xaiv cov xub uas txav los ntawm dhia mus rau cov duab ua yeeb yaj kiab, Mus rau nws Tus Kws Saib Xyuas thiab teeb tsa "Muaj Sijhawm Tawm" mus rau qhov tsis tseeb, "Lub Sijhawm Ntev" rau qhov tsis tseeb, Teeb "Lub Sijhawm Hloov" mus rau Xoom, thiab Nyem rau ntxiv (+) Qhov ntawd muaj nyob rau hauv Kev Kho Mob thiab Teeb "Dhia" rau "Cuav"

6- Ob npaug coj mus rhaub rau ntawm lub npov Jump animation Los ntawm Animator thiab teeb tsa "Loop Time" rau "False"

7- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

8- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nias rau ntawm "Ntxiv Cheeb Tsam"

9- Sau lub npe ntawm Tsab Ntawv (piv txwv li AnimateJump) …

10- Nyem rau ntawm "Tsab ntawv tshiab"

11- Nyem rau ntawm "Tsim thiab Ntxiv"

12- Rho tawm txhua tus lej uas tau sau cia

13- Rub tawm Cov Ntawv, Luam thiab hla nws hauv koj Tsab Ntawv (Tsis txhob hnov qab sau Koj tsab ntawv Npe es tsis txhob #yourScriptName & tseem yog koj Cov Ntawv Sau Lub Npe Hloov #YourJumpingScriptName, thiab Sau Koj Lub Npe lub npe tsis txhob "Taug Kev" Ntawd koj tsim sab hauv Parameters hauv Animator)

14- Txuag Tsab Ntawv thiab Mus rau Tus Kws Tshuaj Xyuas Tus Kheej, Saib koj tsab ntawv

15- Drag koj Tus Cwj Pwm thiab tso nws sab hauv "Insertyour Jump Script"

Yog tias koj Ua Si Koj Cov Game Tam Sim No Tus Neeg Ua Si Yuav Ua Li Cas … Taug Kev … thiab Dhia … hooohuuu!: D

tab sis nws yuav tsum tau ntxeev

Kauj Ruam 9: Txheeb Koj Tus Kheej

Tig Koj Tus Cwj Pwm
Tig Koj Tus Cwj Pwm
Tig Koj Tus Cwj Pwm
Tig Koj Tus Cwj Pwm
Tig Koj Tus Cwj Pwm
Tig Koj Tus Cwj Pwm

Ua ntej koj yuav tsum ntxiv Tsab Ntawv Tshiab rau Peb Tus Cwj Pwm:

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv li tig) …

4- Nyem rau ntawm "Tsab ntawv tshiab"

5- Nyem rau ntawm "Tsim thiab Ntxiv"

6- Rho tawm txhua tus lej uas tau sau cia

7- Rub tawm Cov Ntawv, Luam thiab hla nws hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName & koj li tsab ntawv Tsab Ntawv Motion tsis yog #YourMotionScriptName)

8- Txuag Tsab Ntawv thiab Mus rau Tus Kws Tshuaj Ntsuam Xyuas, Saib ntawm koj tsab ntawv

9- Drag koj Tus Cwj Pwm thiab tso nws sab hauv "Insertyour Motion Script"

10-Luam koj tus Cim Cim X los ntawm (Hloov pauv) nyob rau sab saum toj ntawm Tus Kws Saib Xyuas thiab dhau los ntawm Scale_X ntawm koj tsab ntawv (Raws li tau qhia hauv Daim Duab Ob & Peb)

11- Luam koj tus Cim Cim Y los ntawm (Hloov pauv) nyob rau sab saum toj ntawm Tus Kws Saib Xyuas thiab dhau los ntawm Scale_Y

Kauj Ruam 10: Lub Koob Yees Duab Ua Raws Peb Tus Cwj Pwm

Lub Sijhawm no koj xav tau ntxiv Tsab Ntawv Tshiab rau Peb Lub Koob Yees Duab:

1- Xaiv Koj Lub Koob Yees Duab los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv li CameraFollow)…

4- Nyem rau ntawm "Tsab ntawv tshiab"

5- Nyem rau ntawm "Tsim thiab Ntxiv"

6- Rho tawm txhua tus lej uas tau sau cia

7- Rub tawm Cov Ntawv, Luam nws thiab Muab nws tso rau hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName)

8- Txuag Tsab Ntawv thiab Mus rau Tus Kws Saib Xyuas Lub Koob Yees Duab, Saib koj cov ntawv 8- Luag koj tus Cwj Pwm thiab tso nws sab hauv "Hom Phiaj"

Koj tuaj yeem hloov kho lwm qhov chaw yog tias koj xav tau…

txhawm rau ua kom ntug rau Lub Koob Yees Duab siv qhov offset X & Y

Kauj Ruam 11: Ntxiv Tus Neeg Ua Si Thib Ob (2 Tus Neeg Ua Haujlwm) & Lub Koob Yees Duab Ua Raws 2 Tus Ua Si

Ntxiv Tus Neeg Ua Si Thib Ob (2 Tus Ua Si) & Lub Koob Yees Duab Ua raws 2 Tus Ua Si
Ntxiv Tus Neeg Ua Si Thib Ob (2 Tus Ua Si) & Lub Koob Yees Duab Ua raws 2 Tus Ua Si

Txhawm rau ua rau koj qhov Game nthuav dua…. Koj tuaj yeem ua nws 2, 3, 4, 10, 20…. Cov neeg ua si … txhua tus lej ntawm cov players koj xav tau … yog li ua qhov ntawd:

1- Xaiv Koj Tus Cwj Pwm los ntawm Hierarchy

2- Luam nws (Ua ntej ntawm Ctrl + D)

tam sim no koj ntxiv lwm tus Cim

3- Tsiv nws los ntawm Cov cuab yeej txav thiab rub nws, muab tso rau hauv qhov chaw haum

4- Tam sim no Peb yuav tsum hloov Kev Tswj chaw yog li ntawd, Mus rau nws Tus Kws Tshuaj Ntsuam Xyuas, Hloov Txoj Cai thiab Sab Nrauv Khawm ntawm nws Tsab Ntawv Motion

5- Tseem Hloov Dua khawm …

Tab sis tam sim no Lub Koob Yees Duab ua raws ib tus Player nkaus xwb, Ua Kom Nws Ua Raws Ntau Tshaj Ib Tus Neeg Ua Si peb xav tau ntxiv tsab ntawv tshiab rau nws:

1- Xaiv Koj Lub Koob Yees Duab los ntawm Hierarchy2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nias rau "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv li CameraFollowMultipleTarget) …

4- Nyem rau ntawm "Tsab ntawv tshiab"

5- Nyem rau ntawm "Tsim thiab Ntxiv"

6- Rho tawm txhua tus lej uas tau sau cia

7- Rub tawm Cov Ntawv, Luam nws thiab Muab nws tso rau hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName)

8- Txuag Tsab Ntawv thiab Mus rau Tus Kws Saib Xyuas Lub Koob Yees Duab, Saib koj cov ntawv

9- Teeb tsa "Lub Hom Phiaj" 2

10- Luag koj ob tus neeg ua si sab hauv Lub Hom Phiaj no.

Nco ntsoov Lub offset Z ntawm Lub Koob Yees Duab (-20)

Koj tuaj yeem Hloov lossis teeb tsa lwm qhov chaw … yog tias koj xav ua ntug rau Lub Koob Yees Duab Kho Kom Zoo Offset X & Y

Kauj Ruam 12: Ntxiv Cov Ntsiab Lus thiab Cov Ntsiab Lus Tuag

Ntxiv Cov Ntsiab Lus thiab Cov Ntsiab Lus Tuag
Ntxiv Cov Ntsiab Lus thiab Cov Ntsiab Lus Tuag

Muaj Ntau Lub Tswv Yim Zoo uas koj tuaj yeem ua hauv koj Cov Game, Tab sis Qhov Zoo Tshaj Plaws Lub Tswv Yim yog los tsim thaj chaw Cov qhab nia yooj yim yog tias ib tus Cawm Seej mus txog nws thawj zaug nws yeej, thiab Muaj Thaj Chaw Tuag yog tus Player kov nws nws rov tshwm sim rau Re-spawning Point tam sim no…

Cia Peb Ua Tus Qhab Nia ua ntej:

1- Tab sis Cov Av thiab Cov Phiaj Xwm Cov Khoom (Raws Li Qhia Hauv Daim Duab xub)

tsis txhob hnov qab ntxiv Box Collider2D rau nws

Tam sim no peb yuav tsum tau ntxiv rau qhov qhab nia hauv av Script

1- Xaiv Koj qhov qhab nia hauv av los ntawm Hierarchy

2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

3- Sau lub npe ntawm Tsab Ntawv (piv txwv li ScoreGround)…

3- Nyem rau ntawm "Tsab ntawv tshiab" 4- Nyem rau "Tsim thiab Ntxiv"

5- Rho tawm txhua tus lej uas tau sau cia

6- Rub tawm Cov Ntawv, Luam thiab hla nws hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Lub Npe hloov pauv #yourScriptName, & Hloov 2 Tus Neeg Siv Lub Npe hloov "YourPlayer1Name" & "YourPlayer2Name")

7- Txuag Tsab Ntawv thiab Mus rau Tus Kws Saib Xyuas Lub Koob Yees Duab, Saib koj cov ntawv

Peb xav tau tam sim no los tsim Cov Ntawv thiab Pib dua

Los tsim cov ntawv

1- Nyem rau Ntxiv (+) hauv Hierarchy

2- Xaiv "UI" -> "Text"

3- Hloov cov ntawv los ntawm tus kws tshuaj ntsuam, thiab Kho kom raug nws cov xim….

4- tsim 2 Cov ntawv uas yog rau Player ib (Piv txwv "Player 1 Yeej") thiab lwm yam rau Player 2

Tam sim no peb nee Los tsim khawm rov pib dua

Txhawm rau tsim Button1- Nyem rau Ntxiv (+) hauv Hierarchy

2- Xaiv "UI" -> "Khawm"

3- Hloov Npe Khawm los ntawm tus kws tshuaj xyuas, thiab Kho kom raug nws cov xim….

tsim ib qho khawm xwb

Tam sim no Tom qab tsim Cov Ntawv thiab cov nyees khawm peb yuav tsum tau ntxiv lawv rau Tus Kws Tshawb Xyuas Hauv Ntej Ua Ntej kom ua li ntawd:

1- Xaiv Koj cov qhab nia hauv av los ntawm Hierarchy2- Mus rau Tus Kws Tshuaj Ntsuam Xyuas Qhov rai

3- Saib cov ntawv uas koj tau ntxiv

4- Luag Cov Ntawv thiab tso rau "Win Text Of Player 1" & "Win Text Of Player 2"

5- Luag lub pob thiab xa nws mus rau "Restart Button"

yog tias koj Ua Si Tam Sim No Txhua Yam Ua Haujlwm tshwj tsis yog khawm rov pib dua

Ua kom Nws Ua Haujlwm

1- Xaiv Cov Ntaub Ntawv los ntawm Cov cuab yeej poob qis nyob rau sab saud ntawm Unity…

2- Xaiv "Tsim Chaw"

3- Luag koj Scene Los ntawm Scene nplaub tshev uas pom hauv Qhov Project Window thiab Tso rau hauv "Scene in Builds"

tam sim no Cia ntxiv Tsab Ntawv Tshiab rau Khawm

4- Xaiv Koj Cov Khawm los ntawm Hierarchy

5- Mus rau Tus Kws Tshuaj Ntsuam Xyuas qhov rai nyem rau ntawm "Ntxiv Cheeb Tsam"

6- Sau lub npe ntawm Tsab Ntawv (piv txwv SceneLoader) …

7- Nyem rau ntawm "Tsab ntawv tshiab"

8- Nyem rau ntawm "Tsim thiab Ntxiv"

9- Rho tawm txhua tus lej uas tau sau cia

10- Rub tawm Cov Ntawv, Luam nws thiab Muab nws tso rau hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName)

11- Txuag Tsab Ntawv rov qab rau Kev Sib Koom

12- Xaiv Koj Cov Khawm los ntawm Hierarchy

13- Mus rau nws tus kws tshuaj ntsuam nyem rau Ntxiv (+) Los ntawm "nyem"

14- luag thiab tso lub hauv qab rau hauv lub thawv plaub fab

15- Nyem rau ntawm "Tsis muaj nuj nqi" Xaiv "SceneLoader" -> "Load Scene"

16- sau xoom… 0

Tam sim no Yog tias Koj Ua Si Nws Ua Haujlwm….. Hurray: D

Cia Ntxiv Lub Zos Tuag Los Ua Qhov no:

1- Nyem rau Ntxiv (+) ntawm Hierarchy

2-Xaiv "Tsim Tsis Tau", thiab mus rau nws Tus Kws Tshuaj Ntsuam Xyuas

3- Ntxiv BoxCollider 2d….

4- Tsiv nws nqis, yog li thaum Tus Neeg Ua Si poob Nws Collids rau nws

Tam sim no Ntxiv Tsab Ntawv Tshiab rau Lub Hom Phiaj Game no thiab Lub Npe Rau Piv Txwv DeadZone

5- Rub cov ntawv, Luam nws thiab sau nws yav dhau los hauv koj Tsab Ntawv (Tsis txhob hnov qab sau koj tsab ntawv Npe es tsis txhob #yourScriptName & thiab Sau koj Cov Cim Cim Npe tsis txhob "yourPlayer1 Name", "YourPlayer2 Name")

Tam sim no Txuag thiab xa rov qab mus rau kev sib koom siab

Peb yuav tsum ntxiv Ib Qhov Gameobject Tsis Txaus uas qhia qhov twg peb Cov Neeg Ua Si Yuav Rov Ua Dua

1- Nyem rau Ntxiv (+) ntawm Hierarchy

2- Xaiv "Tsim Tsis Tau"

3- Hloov Txoj Haujlwm mus rau Txoj Haujlwm Zoo ib yam uas koj xav tau cov neeg ua si kom rov tshwm sim

4- saib The DeadZone Script los ntawm tus kws tshuaj xyuas thiab ntxiv Spawn Point (Game game Yam uas koj tau tsim) rau nws.

Yog tias Koj Ua Si Tam Sim No Koj Yuav Tsum Nyiam: -O

Kauj Ruam 13: Khaws Kev Sib Hloov

thaum koj Ua Si Game Muaj Kab Mob uas yog Tus Cwj Pwm Rotates …

Yog tias koj cuam tshuam los ntawm kab no … koj tuaj yeem kho nws yooj yim:

1- Tsuas yog Xaiv Tus Cwj Pwm los ntawm Hierarchy

2- Saib Rigidbody2D los ntawm Tus Kws Saib Xyuas

3- Qhib "Kev Txwv" thiab Teeb "Khov Khov" rau Qhov Tseeb

Qhov ntawd yog;)

Kauj Ruam 14: Tsim Cov Ntawv Qhia Tseem Ceeb rau Koj Cov Game

Nov yog yuav Ua Li Cas Tsim Koj Cov Ntawv Qhia Tseem Ceeb

Kauj Ruam 15: Tshaj Tawm thiab Qhia Tawm

Thaum kawg tso koj li Game Saib Cov Video no

Vam tias koj txaus siab… Kawm… Muaj Fum:)

Cov Lus Nug Nug Kuv ntawm:

Pom zoo: