Cov txheej txheem:

Yuav Ua Li Cas Caum Cov Neeg Txom Nyem Ntawm Micro Bit.: 4 Kauj Ruam
Yuav Ua Li Cas Caum Cov Neeg Txom Nyem Ntawm Micro Bit.: 4 Kauj Ruam

Video: Yuav Ua Li Cas Caum Cov Neeg Txom Nyem Ntawm Micro Bit.: 4 Kauj Ruam

Video: Yuav Ua Li Cas Caum Cov Neeg Txom Nyem Ntawm Micro Bit.: 4 Kauj Ruam
Video: Я ОДЕРЖИМЫЙ ДЕМОНАМИ 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ua Tus Neeg Tuaj Txav Chaw ntawm Micro Bit
Yuav Ua Li Cas Ua Tus Neeg Tuaj Txav Chaw ntawm Micro Bit

Yog li thawj kauj ruam yog tsim peb lub nkoj. Koj mus rau "Basic" thiab ntxiv qhov "On start" block. Tom qab ntawd koj mus rau "Variables" thiab koj tsim qhov sib txawv hu ua "SHIP" thiab xaiv qhov thaiv los ntawm "Variables" tab uas hais tias "Set sprite to 0". Tom qab ntawd koj muab "SHIP" hloov chaw "sprite". Tom qab ntawd koj mus rau "Game" tab thiab xaiv "tsim sprite ntawm x 2 y 2" thiab koj tso qhov ntawd tsis yog "0" hauv "teeb SHIP rau 0". Tom qab ntawd koj yuav muaj feem "y" rau 4 hloov ntawm 4. Tsis tas li ntawd, cov qhab nia ntsuas yog xaiv tau. Tab sis koj mus, peb tau txais peb lub nkoj, thiab cov kauj ruam tom ntej yuav yog kev txav ntawm peb lub nkoj.

Kauj Ruam 1: Kev txav ntawm Lub Nkoj

Kev txav ntawm Lub Nkoj
Kev txav ntawm Lub Nkoj

Koj mus rau lub tab nkag thiab coj cov thaiv "ntawm khawm B nias" thiab "ntawm khawm A nias". Tom qab ntawd koj mus rau Game thiab xaiv "sprite txav los ntawm 1" thiab hloov mus rau sprite rau SHIP. Muab nws tso rau ntawm "On B button pressed" block. Thiab koj ua tib yam rau A tab sis tsis txhob txav los ntawm 1 koj muab -1.

Kauj Ruam 2: Tua Tus Kheej

Tua qhov txawv txav
Tua qhov txawv txav

Yog li ua ntej koj yuav mus rau "Cov tswv yim" tom qab ntawd xaiv "On khawm A+B nias" thiab ntxiv nws rau txoj cai. Tom qab ntawd koj ua qhov hloov pauv hu ua "SHOOT", tom qab ntawd mus rau qhov sib txawv ntxiv qhov ntxiv "teeb SHOOT rau 0" thiab hloov "0" rau "tsim sprite ntawm x: _ y: _" ces xaiv "nkoj x:" hauv game game ces muab tso rau "tsim sprite ntawm x: nkoj x:". Nws tsis meej pem tab sis koj tuaj yeem nkag siab nws zoo dua los ntawm daim duab. Tom qab ntawd koj ua tib kauj ruam rau "y". Tom qab ntawd koj mus rau qhov game game tab thiab ntxiv "SHOOT hloov qhov ci ci los ntawm 88". Tom qab ntawd koj mus rau lub voj tab thiab xaiv "rov ua dua 4 zaug thiab tshaj tawm rau cov cai. Tom qab ntawd sab hauv lub tab koj tso" SHOOT hloov y los -1, tom qab ntawd tseem nyob hauv "rov ua dua" code, ntxiv "ncua 150 ms" rau qhov nrawm ntawm "SHOOT" sib txawv, tom qab ntawd tseem nyob hauv qhov khoom siv, koj mus rau qhov laj thawj thiab xaiv "if_ ces" thiab ntxiv nws mus rau qhov laj thawj. Hauv qhov chaw seem ntawm qhov laj thawj thaiv koj tso "is_touching_". Tom qab ntawd koj ntxiv qhov hloov pauv "SHOOT" thiab "ENEMY" (tsim qhov sib txawv hu ua "ENEMY", thiab peb yuav piav qhia nws tom qab). Tom qab ntawd sab hauv lub logic block ntxiv "rho tawm ENEMY" thiab "rho tawm SHOOT", tom qab ntawd yog tias koj xav tau koj tuaj yeem ntxiv qee cov nkauj lossis suab nrov thaum koj rhuav tshem tus yeeb ncuab, tom qab ntawd koj ntxiv qhov thaiv "hloov cov qhab nia los ntawm 1". Tom qab ntawd sab nraum lub voj thiab qhov laj thawj thaiv, koj ntxiv lwm "if_ ces". Tom qab ntawd koj mus rau qhov laj thawj thiab ntxiv qhov thaiv uas muaj "0 ≤ 0" ntawm qhov chaw seem. Tom qab ntawd ntawm thawj 0, koj tso "SHOOT y". Tom qab ntawd sab hauv lub logic block koj tso "rho tawm SHOOT"

Kauj Ruam 3: Ua Tus Yeeb Yam Hloov Pauv

Ua Tus Ywj Pheej Hloov Pauv
Ua Tus Ywj Pheej Hloov Pauv

FIrst ntxiv "ib txhis" thaiv thiab tsim qhov sib txawv hu ua "ENEMY", mus rau qhov sib txawv tab thiab ntxiv "teeb ENEMY rau _", thiab hauv qhov chaw seem tso "tsim sprite ntawm x: _ y: _". Tom qab ntawd hauv qhov chaw seem ntawm "tsim sprite" thaiv, ntxiv "xaiv random los ntawm 0 txog 4" hauv "lej" tab. Tom qab ntawd, koj ntxiv "ENEMY teeb ci rau 150" los ntawm "game" tab thiab tom qab ntawd ntxiv "ncua 100 ms" hauv qab nws. Tom qab qhov "ncua" thaiv, koj ntxiv "ENEMY tig sab xis los ntawm 90 degrees", uas nyob hauv "game" tab. Tom qab ntawd koj mus rau "voj" tab thiab ntxiv "rov ua dua 4 zaug" thiab sab hauv ntawm "voj" thaiv, koj ntxiv "ENEMY txav ny 1" thiab "ncua 500 ms". Tam sim no peb hla mus rau lub logic tab thiab ntxiv 2 block ntawm "if_ ces". Thiab sab hauv thawj qhov chaw khoob, koj ntxiv "yog _ kov _" thiab ntxiv "YEEB YAM" hauv thawj qhov chaw khoob thiab "SHIP" hauv qhov chaw thib ob uas tsis muaj dab tsi, thiab sab hauv qhov laj thawj thaiv, koj ntxiv "game over". Tam sim no hauv lwm qhov laj thawj logic, peb ntxiv "yog _ kov ntug" thiab hauv qhov chaw seem peb ntxiv "ENEMY", thiab sab hauv logiv thaiv peb ntxiv "rho ENEMY"

Kauj Ruam 4: Qhov No Yuav Ua Li Cas Zoo Li Cas

Nov Yog Li Cas Nws Yuav Tsum Zoo Li
Nov Yog Li Cas Nws Yuav Tsum Zoo Li

Vam tias kuv tsis phem ntawm kev piav qhia yuav ua li cas thiab vam tias koj nyiam qhov kev ua si:)

Pom zoo: