Cov txheej txheem:
- Khoom siv
- Kauj ruam 1: Taw qhia rau Kos
- Kauj Ruam 2: Qee Cov Ntaub Ntawv Ntxiv
- Kauj Ruam 3: Tsim Kab Hauv Kab
- Kauj Ruam 4: Lub Hom Phiaj Tshaj Tawm
- Kauj ruam 5: Coding
- Kauj Ruam 6: Tsim Thawj Tus Neeg Ua Si
- Kauj Ruam 7: Txoj Cai, thiab Tus Neeg Ua Si 2
- Kauj Ruam 8: Khaws Cia
- Kauj Ruam 9: Yeej Txoj Cai
- Kauj Ruam 10: Pob Ntu 1: Pib
- Kauj Ruam 11: Pob Ntu 2: Kev txav chaw
- Kauj Ruam 12: Pob Ntu 3: Cov Neeg Sib Tham
- Kauj Ruam 13: Pob Ntu 4: Qhab Nia
- Kauj Ruam 14: Pob Ntu 5: Luam
- Kauj Ruam 15: Txoj Cai Kawg rau Pob
- Kauj Ruam 16: CONGRATULATIONS
Video: Pong hauv Kos: 16 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Txoj Haujlwm no yuav muab cov kauj ruam rau koj kom rov tsim Pong, yog ib qho ntawm thawj qhov vis dis aus ua si, hauv Txoj Haujlwm Kos.
Khoom siv
Cov Khoom Siv yog yooj yim heev, txhua yam koj xav tau yog siv internet, ib lub cuab yeej uas tuaj yeem siv internet, thiab tus as khauj rau Scratch, lub xaib siv hauv cov lus qhia no.
Kauj ruam 1: Taw qhia rau Kos
Thawj qhov koj yuav tsum tau ua yog nkag mus rau lub vev xaib pom ntawm scratch.mit.edu. ib zaug ntawm lub xaib, siv Kev Koom Tes Kos Kos los tsim tus as khauj. Thaum qhov no ua tiav, siv qhov kev xaiv tsim nyob rau sab saum toj sab laug ntawm lub qhov rais los tsim ib qhov haujlwm. Nov yog qhov pib lom zem. Raws li cov lus ceeb toom, Kos tuaj yeem yog qhov kev pab cuam zoo heev, thiab tej zaum yuav tsis teb, yog li txuag ntau.
Kauj Ruam 2: Qee Cov Ntaub Ntawv Ntxiv
Thaum tsim cov sprites tshiab, ib txwm pom qhov chaw nruab nrab rau ntawm thaj chaw tsim, cim los ntawm ib qho chaw nruab nrab. qhov no yuav yog lub hauv paus ntawm kev tsim cov txheej txheem, thiab txhua qhov X thiab Y qhov txiaj ntsig yuav xav tias tus sprite yuav tsum tsim ntawm qhov no. yog tias lub hauv paus ntsiab lus no tsis siv, lawv qhov txiaj ntsig muab yuav tsis ua haujlwm, thiab koj yuav tsum xam tawm qhov chaw raug.
Tam sim no, mus rau lub creation.
Kauj Ruam 3: Tsim Kab Hauv Kab
Txhawm rau tsim koj thawj sprite yuj hla tus cim miv nyob hauv qab txoj cai kaum ntawm lub vijtsam, qhov no yuav muab rau koj plaub txoj kev xaiv. Nyem "xim".
Siv cov duab plaub kos ib lub duab plaub me me dub ntsug. Qhov no yuav yog lub tsev thaiv rau kab nruab nrab.
Teem tus sprite1 tus x tus nqi rau 0 thiab y tus nqi rau 0. Tus duab plaub yuav tsum nyob rau sab saum toj nruab nrab ntawm thaj chaw ua si.
Txoj cai nyem rau ntawm "Sprite1" lub cim thiab nyem "theej tawm" Teeb tus tshiab sprite tus nqi x rau 0 thiab y rau 30 tsawg dua (-30).
Rov ua cov kauj ruam 5 thiab 6 kom txog rau thaum koj muaj kab ntawv nyob nruab nrab sib cais thaj chaw ua si rau 2 thaj chaw.
Kauj Ruam 4: Lub Hom Phiaj Tshaj Tawm
Hauv cov kauj ruam yooj yim no, koj yuav tsim ob lub hom phiaj kev tshaj tawm.
Tsim tus tshiab sprite ntawm lub duab plaub siab uas nthuav dav tag nrho qhov siab ntawm thaj chaw ua si. Hloov lub npe no mus rau "P1-Lub Hom Phiaj". Teeb tus nqi x rau -240 thiab y tus nqi rau 0.
Luam tawm "P1-Lub Hom Phiaj", hloov nws "P2-Lub Hom Phiaj", teeb nws tus nqi x rau 240 thiab y tus nqi rau 0.
Kauj ruam 5: Coding
Txij ntawm no mus, koj yuav tsum tau siv lub cim coding nyob rau sab saud sab laug ntawm nplooj ntawv, tsuas yog hauv qab Scratch icon. muaj tag nrho ntawm 9 hom kev cai, tab sis tsuas yog siv 7 ntawm lawv hauv txoj haujlwm no.
Kauj Ruam 6: Tsim Thawj Tus Neeg Ua Si
Pib cov kauj ruam no los ntawm kev luam ib qho ntawm kab hauv nruab nrab thiab teeb tsa tus nqi X rau 210, thiab Y rau 0. Hloov npe tus sprite rau Player1
Thaum qhov no ua tiav, coding pib. Ua kom ntseeg tau tias koj nyob hauv kab ntawv teev npe ntawm tus sprite nyob rau sab saum toj sab laug.
Nyem rau "Player1" sprite lub cim, nyob rau sab saud sab laug nyem rau "Code" tab
Hauv qab "Cov Txheej Txheem" rub "thaum (tus chij ntsuab) nyem" thaiv rau hauv ib puag ncig kev txhim kho ib puag ncig (IDE).
Tsis tas li nyob hauv "Cov Txheej Txheem" luag "thaum nias lub pob" thaiv rau hauv IDE. Hauv qab "Tsab ntawv tsa suab" lob tus "mus rau x: txoj haujlwm y: txoj haujlwm" thaiv thiab tua nws hauv qab "thaum (tus chij ntsuab) tau nyem" thaiv teeb tsa mus rau x txoj haujlwm rau -215 thiab y txoj haujlwm rau 0
Hauv qab "Tsab ntawv tsa suab" txuas "hloov y los" rau qhov thaum tus yuam sij nias thiab muab tus nqi 4
Hauv qab "Tsab ntawv tsa suab" "yog tias nyob ntawm ntug, thaws" txuas rau thaum nias lub pob
Hauv qab "Tsab ntawv tsa suab" "taw tes rau hauv kev taw qhia" thaiv rau "thaum nias lub pob" khawm.
Luam theej tawm "thaum nias tus yuam sij" thiab hloov "hloov y" rau -4
Teem cov keystrokes xav tau rau kev txav mus rau "thaum qhov tseem ceeb nias thaiv"
Kauj Ruam 7: Txoj Cai, thiab Tus Neeg Ua Si 2
Saum toj no yog qhov chaws yuav tsum zoo li cas.
Hauv qab txoj cai, qhov twg txhua tus sprites nyob, nyem rau tus neeg uas ua ntawv thiab luam nws.
Hloov nws mus rau Player2. Thaum qhov no ua tiav, nkag mus rau Player2 tus lej thiab hloov cov nyees khawm txav mus, thiab "Greenflag" txav mus rau X: -210 Y: 0
Kauj Ruam 8: Khaws Cia
Tsim tus tshiab sprite hauv qab sab laug, thiab lub npe nws "P1-Score"
Hauv cov ris tsho tab, siv lub thawv ntawv tshwj xeeb los tsim 0 hauv qhov chaw nruab nrab. Luam qhov hnav no 5 zaug.
Hloov lwm cov khaub ncaws kom lawv suav 0-5 hauv kev txiav txim.
Nyem rau ntawm "P1-Score" sprite.
Xaiv "Code" nyob rau sab saum toj sab laug
Lob tus "thaum (chij ntsuab) nyem" thaiv thiab "thaum kuv tau txais (lus)" thaiv, teeb cov lus rau "P1-Score".
Hauv qab "thaum (tus chij ntsuab) nyem" muab "hloov khaub ncaws rau (tus nqi)" thaiv, teeb tus nqi rau 0.
Hauv qab "thaum kuv tau txais (" P1-Score ")" txuas "block tom ntej" thaiv.
Luam "P1-Score" sprite thiab hloov nws mus rau "P2-score"
Hloov cov lus tau txais rau "P2-qhab nia"
Teeb tus X tus nqi ntawm "P1-Score" rau -130 thiab "P2-Score" rau 130, thiab Y rau 150 rau ob qho tib si.
Hauv kev hloov pauv, tsim 2 qhov sib txawv "P1-score" thiab "P2-score"
Hauv qab "thaum (tus chij ntsuab) nyem" thaiv rau txhua tus neeg ua si, ntxiv "teeb tsa (sib txawv) rau ()" thiab teeb tsa tus nqi rau 0.
Hauv qab "thaum Kuv Tau Txais ()" rau txhua tus, ntxiv "Hloov (hloov pauv) los ntawm ()" thiab teeb tsa tus nqi rau 1 thiab qhov sib txawv rau tus neeg sib tw ua si.
Kauj Ruam 9: Yeej Txoj Cai
Tsim tus sprite tshiab hu ua "WinCondition"
Siv cov cuab yeej ntawv sau "Player 1 Wins", sau lub npe "P1-Win"
Ntxiv qhov hnav thib ob
Siv cov cuab yeej ntawv sau "Player 2 Wins", sau lub npe "P2-Win"
Hauv txoj cai
Pib nrog "thaum (chij ntsuab) nyem" thaiv, thiab txuas "thaiv" thaiv (hauv qhov zoo li)
Tom ntej no lob "thaum kuv tau txais (lus)" thaiv, teeb cov lus rau "P1-Yeej", rau qhov no txuas "thaiv" thaiv
Txuas "hloov khaub ncaws rau (xaiv)" thaiv, teeb tsa qhov kev xaiv rau "P1-Win" Tam sim no txuas "nres (xaiv)" thaiv, teeb tsa kev xaiv rau txhua tus.
Txoj cai nyem rau ntawm "thaum kuv tau txais (" P1-Win ")" thaiv thiab theej tawm nws. Hloov pauv txhua yam ntsig txog tus neeg ua si 1 rau tus neeg ua si 2.
Kauj Ruam 10: Pob Ntu 1: Pib
Tsim lub voj voog ncig, thiab lub npe nws "pob".
Pib nrog "thaum (chij ntsuab) nyem" thaiv
Txog qhov ntawd txuas cov lus tsa suab "mus rau x: (txoj haujlwm) y: (txoj haujlwm)", teeb tsa ob qho txiaj ntsig rau 0
Tom ntej txuas "yog (ua haujlwm) tom qab ntawd …. lwm "block.
Hauv qhov qhib "yog" tus nqi txuas "xaiv random (tus nqi) rau (tus nqi) = (tus nqi)" thaiv thiab teeb tsa tus nqi rau 1, 0, thiab 0 feem.
Hauv qab "yog" ntu ntawm qhov thaiv txuas "tshaj tawm (xov xwm)" thaiv
Nyem rau ntawm cov ntawv qhia zaub mov nco tseg, nyem "cov lus tshiab", lub npe no "P2-Hit"
Hauv qab lwm qhov ntawm "yog (kev ua haujlwm) ces …. lwm tus "thaiv txuas" tshaj tawm (xov) "thaiv.
Tsim cov lus tshiab “P1-Hit”
Kauj Ruam 11: Pob Ntu 2: Kev txav chaw
Pib qhov thaiv tshiab ntawm cov cai nrog "thaum kuv tau txais (lus)" thaiv, teeb cov lus rau "P2-Hit"
Tom ntej txuas qhov "ib txhis" thaiv tshwj tsis yog tau hais txhua yam los ntawm no yuav nyob hauv "ib txhis" thaiv.
Txuas nrog "tos (tus nqi) vib nas this" thaiv, teeb tus nqi rau 0.01 Txuas
"Txav (tus nqi) cov kauj ruam" thaiv teeb tsa tus nqi rau 8
Txuas "yog nyob ntawm ntug, thawb" thaiv
Kauj Ruam 12: Pob Ntu 3: Cov Neeg Sib Tham
Tom ntej no lob "yog (ua haujlwm) ces" thaiv, tso "kov (sib txawv)?" thaiv hauv ntu haujlwm ntawm cov lus yog, teeb tsa qhov sib txawv rau "Player 1".
Tsis pub dhau qhov yog hais tias daim ntawv txuas "tshaj tawm (xov)", "taw tes rau hauv kev coj (tus nqi)", thiab "nres (xaiv)" thaiv.
Teem cov lus rau "P1-Hit" Muab qhov "xaiv random (tus nqi) mus rau (tus nqi)" thaiv hauv qab tus tswv thiab tso rau hauv "kev taw qhia (tus nqi)" thiab teeb tsa tus nqi sib txawv los ntawm 45 txog 135.
Teeb qhov kev xaiv hauv "nres (xaiv)" thaiv rau "tsab ntawv no".
Kauj Ruam 13: Pob Ntu 4: Qhab Nia
Pib tshiab "yog (ua haujlwm) tom qab ntawd" thaiv, ua haujlwm nrog "kov (sib txawv)?" thaiv, teeb tsa qhov sib txawv rau "P1-Lub Hom Phiaj"
Txuas "tshaj tawm (xov xwm)", teeb cov lus rau "P2-Score"
Tom ntej txuas tus "mus rau x: (txoj haujlwm) y: (txoj haujlwm)", teeb tsa ob txoj haujlwm rau 0. Txuas "taw qhia rau hauv kev taw qhia (tus nqi)", teeb tus nqi rau -90.
Txuas nrog "tos (tus nqi) vib nas this" thaiv, teeb tus nqi rau 1.
Tom ntej txuas ib qho "tshaj tawm (xov)" thaiv, teeb cov lus rau "P2-Hit".
Ncaj nraim hauv qab "tshaj tawm (xov)" txuas "yog (ua haujlwm) tom qab ntawd"
Teeb lub lag luam rau "(sib txawv) = (tus nqi)" thaiv, teeb tsa qhov sib txawv rau "P2-qhab nia" thiab tus nqi rau 5.
Hauv qhov no yog cov lus tshaj tawm txuas "tshaj tawm (lus)" thiab "nres (xaiv)" thaiv
Teem cov lus rau "P2- Yeej", thiab qhov kev xaiv nres rau "tag nrho"
Hauv qab no yog cov lus hais txuas "nres (xaiv)" thaiv, teeb qhov kev xaiv rau "tsab ntawv no"
Kauj Ruam 14: Pob Ntu 5: Luam
Txoj cai nyem rau ntawm "thaum kuv tau txais (" P2- Ntaus ")" thaiv thiab xaiv qhov theej tawm, nyem qhov twg nyob hauv IDE kom tso qhov thaiv tshiab no ntawm cov cai.
Hauv qhov thaiv tshiab ntawm cov cai hloov pauv txhua yam cuam tshuam nrog tus neeg ua si 1 rau tus neeg ua si 2 thiab hloov pauv, tseem hloov pauv ib qho "taw tes rau qhov kev coj ua" los ntawm qhov zoo mus rau qhov tsis zoo, txhua yam ntxiv tuaj yeem nyob zoo li qub.
Kauj Ruam 15: Txoj Cai Kawg rau Pob
Kauj Ruam 16: CONGRATULATIONS
yog tias txhua yam mus raws li tsim, koj yuav tsum muaj Pong game ua haujlwm, ua tag nrho hauv qhov khawb.
Pom zoo:
Kev Tswj Dej Hauv Dej Hauv Dej Hauv Dej: 10 Kauj Ruam (nrog Duab)
Underwater Remote Control Drone: Kuv txiav txim siab los tsim ROV no rau lub hom phiaj ntawm kev tshawb fawb thiab kev qhuas ntawm lub ntiaj teb hauv qab dej vim tias tsis muaj ntau tus nqi tsim txiaj hauv cov drones hauv qab. Txawm hais tias nws siv sijhawm ntau, tshawb fawb, thiab autodidacticism, nws yog qhov kev lom zem
Customize Koj Tawv, Nrog Koj Kos Npe Kos Npe: 9 Cov Kauj Ruam
Customize Your Leather, With Your Engraved Signature: Nyob Zoo Txhua Tus, hauv cov lus qhia no peb yuav ua kev cai laser engraving ntawm tawv hnab thiab koj tuaj yeem ua qhov no ntawm cov khoom tawv sib txawv
Thawj Zaug Kos Kos Npe: 3 Kauj Ruam
Thawj Lub Sij Hawm Kos Npe Lub Rooj Muag Khoom: Xaiv ib yam uas nyuam qhuav ua tiav, nws yog qhov tsim nyog los ua lub rooj teeb pom kev, uas yuav tsum tau ci, khoov tau, muaj xim zoo nkauj, thiab nyob deb (txhua yam khoom yuav los ntawm jotrin.com). Thawj qhov kev daws teeb meem yog xav txog 3W RGB teeb. Lub zog muaj zog no
Backlit Kos Npe rau Kev Kos Duab: 7 Kauj Ruam (nrog Duab)
Backlit Kos Npe rau Kev Kos Duab: Ib tus phooj ywg tus kws kos duab mus los ntawm tus neeg hu ua 'The Folly Store', nrog lub logo ncig uas nws tawg thoob nws cov social media accounts thiab lub vev xaib. https://www.thefollystore.com/Kuv xav tias nws yuav yog khoom plig zoo tshaj rau nws los ua lub cim "khw" tiag rau
Ntse Suab Nkauj hauv Chav Dej thiab Da Dej Nrog Raspberry Pi - Sib Koom Ua Ke Hauv Chav, Tswb, Khawm Tswj thiab Kev Siv Tsev Hauv Tsev: 7 Kauj Ruam
Ntse Suab Nkauj hauv chav pw thiab Da Dej Nrog Raspberry Pi - Sib Koom Ua Ke Hauv Chav, Tswb, Khawm Tswj thiab Kev Siv Tsev Hauv Tsev: Niaj hnub no peb xav muab ob qho piv txwv txog yuav ua li cas koj tuaj yeem siv Raspberry Pi nrog peb Max2Play software rau hauv tsev automation: hauv chav dej thiab chav pw . Ob txoj haujlwm zoo ib yam nyob hauv cov suab paj nruag siab ncaj los ntawm ntau qhov chaw tuaj yeem rub tawm los