<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://peda.net/:static/535/atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>3 Ajo- tai lentopelin tekeminen</title>
<id>https://peda.net/id/3565e7c02</id>
<updated>2015-07-08T12:10:56+03:00</updated>
<link href="https://peda.net/id/3565e7c02:atom" rel="self" />
<link href="https://peda.net/p/henril/ohjelmointi/scratch/3at#top" rel="alternate" />
<logo>https://peda.net/:static/535/peda.net.logo.bg.svg</logo>
<rights type="html">&lt;div class=&quot;license&quot;&gt;Tämän sivun lisenssi &lt;a rel=&quot;license&quot; href=&quot;https://peda.net/info&quot;&gt;Peda.net-yleislisenssi&lt;/a&gt;&lt;/div&gt;&#10;</rights>

<entry>
<title>Pelin tekeminen</title>
<id>https://peda.net/id/4706ca082</id>
<updated>2015-07-21T12:30:36+03:00</updated>
<link href="https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen#top" />
<content type="html">&lt;b&gt;Tavoite: &lt;/b&gt;Tehdä ajopeli, jossa on kaksi pelaajaa.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;Ohje:&lt;br/&gt;&#10;&lt;br/&gt;&#10;1:&lt;/b&gt; Tee ensin pelihahmo. Esimerkissäni se on avaruusanimoinnista tuttu Jetpak-man.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png:file/photo/25848eca4a8ec2a52b7a15c88fd7c1e0fa623879/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;b&gt;2: &lt;/b&gt;Tee ajorata. Voit itse piirtää esiintymislavalle mitä sinne haluat.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-pngb#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-pngb:file/photo/7c233330644f1a3635ef49e2f955d21dc262bf16/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;3: &lt;/b&gt;Laitetaan Jetpak-man liikkeelle. Skriptissä aloitetaan taas aloituspalikalla ja ikuisella silmukalla. Tämän jälkeen laitetaan neljä &amp;quot;jos&amp;quot;-lausetta. Näihin voi liittää tuntoaisti-kategoriasta löytyvän &amp;quot;onko näppäin painettu?&amp;quot;- palikan. Ohjelmoidaan ensimmäinen pelaaja liikkumaan nuolinäppäimistä. Jos-lauseen sisään t'ytyy määritellä ensin, mihin suuntaan hahmo liikkuu. Tämä tapahtuu &amp;quot;osoita suuntaan&amp;quot;- palikalla. Ylöspäin liikuttaessa suunta on 0 ja alaspäin liikuttaessa 180.&lt;br/&gt;&#10;&lt;br/&gt;&#10;Laitetaan hahmo lisäksi haluttuun lähtöpaikkaan, kun peli aloitetaan. tämä tehdään &amp;quot;mene kohtaan...&amp;quot;- palikalla. Lisätään se alkuun.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png8#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png8:file/photo/95524f185caf06f9ca3a6f8bbb5e89fca2a049ff/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;4: &lt;/b&gt;Tässä vaiheessa hahmo liikkuu kaikkialla pelialueella. Haluamme, että hahmo ei voi mennä ajoradan ulkopuolle. Tämä saadaan tekemällä skripti, joka palauttaa hahmon alkupisteeseen, mikäli se koskettaa radan rajoja. &lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png0#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png0:file/photo/c70c4e82124992d4f74c092eca834b5c9cdfa99e/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;Skripti siis piilottaa hahmon, kun se koskettaa tiettyä väriä. Se siirtää hahmon alkuun, odottaa 0,4 sekuntia ja näyttää sen taas.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;5: &lt;/b&gt;Tehdään peliin myös kierroslaskuri. Tähän tarvitaan uusi muuttuja. Sen voi tehdä kohdasta &amp;quot;Tieto&amp;quot; ja valitsemalla &amp;quot;Tee muuttuja&amp;quot;. Aseta muuttuja koskettamaan ainoastaan käytössäsi olevaa pelihahmoa. Kierrosluku kasvaa aina yhdellä, kun hahmo koskettaa maaliviivaa.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png81#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png81:file/photo/181ef65588e0d53bb5b43dff83349eb8633184ac/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png9#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png9:file/photo/f90ddfb34a175df7e78996cb2f1f850b5fc76ff3/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;6: &lt;/b&gt;Tehdään pelistä sellainen, että pelaajalla on 30 sekuntia aikaa kiertää mahdollisimman monta kierrosta. Tehdään uusi muuttuja &amp;quot;Aika&amp;quot; ja sen jälkeen skripti, joka laittaa ajan laskemaan 30 sekunnista alaspäin ja pysäyttää pelin ajan loputtua.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png31#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-png31:file/photo/34f9e1e94aa86ac844853b350eabbdd3af153357/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;b&gt;7: &lt;/b&gt;Peliin kannattaa luoda toinen hahmo, jotta voit kilpailla kaverin kanssa. Tämän voit tehdä esimerkiksi kopioimalla ensimmäisen hahmon ja muuttamalla sen väritystä. Myös Skriptit voit kopioida suoraan ensimmäiseltä hahmolta. Ajastinta ei tarvi kopioida toiselle hahmolle. Vaihda myös näppäimet, joista hahmoa ohjataan.&lt;br/&gt;&#10;&lt;br/&gt;&#10;&lt;span class=&quot;center&quot;&gt;&lt;a href=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-pngc4#top&quot; title=&quot;Capture.PNG&quot;&gt;&lt;img src=&quot;https://peda.net/p/henril/ohjelmointi/scratch/3at/pelin-tekeminen/capture-pngc4:file/photo/9a72d0f538c756595218d4be4d8939d28b709920/Capture.PNG&quot; alt=&quot;&quot; title=&quot;Capture.PNG&quot; class=&quot;inline&quot; loading=&quot;lazy&quot;/&gt;&lt;/a&gt;&lt;/span&gt;&lt;br/&gt;&#10;Esimerkkiä pääset tarkastelemaan &lt;a href=&quot;https://scratch.mit.edu/projects/71026916/&quot; rel=&quot;nofollow ugc noopener&quot;&gt;täältä&lt;/a&gt;&lt;br/&gt;&#10;&lt;br/&gt;&#10;</content>
<published>2015-07-08T12:11:11+03:00</published>
</entry>


</feed>