{"id":10150,"date":"2018-09-24T13:25:24","date_gmt":"2018-09-24T11:25:24","guid":{"rendered":"http:\/\/agora.xtec.cat\/esc-cancoll\/?page_id=10150"},"modified":"2018-10-24T15:36:20","modified_gmt":"2018-10-24T13:36:20","slug":"session-2","status":"publish","type":"page","link":"https:\/\/agora.xtec.cat\/esc-cancoll\/curs-scratch-primaria\/module-2-a-game-or-two\/session-2\/","title":{"rendered":"Session 2: Racket breaks"},"content":{"rendered":"<h2><span id=\"Pla_de_treball\">Work plan<\/span><\/h2>\n<div>\n<ul>\n<li>Movement of the ball and racket.\u00a0Relationship between both<\/li>\n<li>Use of the sensors of the characters<\/li>\n<li>Bounce ball<\/li>\n<li>Bounce direction<\/li>\n<li>Choose the bounce direction randomly<\/li>\n<li>Sounds based on the action<\/li>\n<\/ul>\n<div><\/div>\n<hr \/>\n<h2><span id=\"El_moviment_de_la_raqueta_i_la_pilotatenen_relacio\">Does racket and ball movement have a relationship?<\/span><\/h2>\n<p>Now that we have characters (racket and ball) and we know how to move the racket, we need to bounce the ball when the racquet touches it.\u00a0That is, we have to detect when the two characters are played.<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_tasques.png\" alt=\"Icon tasks\" width=\"32\" \/><strong>Let&#8217;s do it step by step<\/strong><\/p>\n<div>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>We entered our Scratch account and created a new project with the name\u00a0<strong>m2\u00a0<\/strong><strong>challenge21<\/strong>\u00a0.<\/li>\n<li>We analyze the different sensors (already introduced in module 1):<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong07.png\" alt=\"Block sensors\" \/><br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong08.png\" alt=\"Block sensors\" \/><\/li>\n<li>If we need help, we recall that we have the help block on the right side:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong09.png\" alt=\"Help sensors\" \/><\/p>\n<ul>\n<li>We can say that the sensors are the senses of the characters, which allow us the interaction between them.\u00a0From the first part of the sensor block, what options do we think may help us interact between the racket and the pong ball?<\/li>\n<li>If for example the ball is green, the green color could be used as a sensor;\u00a0Or bounce off when you touch the paddle.\u00a0These are just two options.\u00a0Can we find others?<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong10.png\" alt=\"Bounce ball\" \/><\/li>\n<\/ul>\n<\/div>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_repte.png\" alt=\"Icon challenge\" width=\"32\" \/>\u00a0<strong>Challenge 1<\/strong><\/p>\n<p>We continue working on our project\u00a0<strong>m2\u00a0<\/strong><strong>challenge21<\/strong>\u00a0.\u00a0What we have to achieve now is that the ball bounces randomly so that the movement is not predictable.<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_pista.png\" alt=\"Icon track\" width=\"24\" \/>Track: We can use the &#8220;randomly&#8221; (green) block to make the ball bounce in different directions.\u00a0This option is already working in session 7 of module 1. We recommend using values close to 180 degrees.\u00a0What happens if we use other values?<\/p>\n<hr \/>\n<h2><span id=\"La_maquina_juga_sola\">The machine plays alone<\/span><\/h2>\n<p>Another possibility of the pong is to play against the machine, that is, to make the racket move all alone.\u00a0To try it, we will create a new new project called\u00a0<strong>m2repte22<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_tasques.png\" alt=\"Icon tasks\" width=\"32\" \/><strong>Let&#8217;s do it step by step<\/strong><\/p>\n<div>\n<ul>\n<li>We entered our Scratch account and created a new project with the name\u00a0<strong>m2\u00a0<\/strong><strong>challenge21<\/strong><\/li>\n<li>We must get the racket moving in the same horizontal direction as the ball so that it always bounces over it<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong06.png\" alt=\"Automatic game\" \/><\/li>\n<\/ul>\n<\/div>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_repte.png\" alt=\"Icon challenge\" width=\"32\" \/>\u00a0<strong>Challenge 2<\/strong><\/p>\n<p>Let&#8217;s do it more realistically.\u00a0We continue with the project\u00a0\u00a0<strong>m2\u00a0<\/strong><strong>challenge22<\/strong>\u00a0that you have open and to make the game more attractive we introduce sounds.\u00a0Can we make the sounds different when the ball bounces on the wall or when the racket touches it?<\/p>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_pista.png\" alt=\"Icon track\" width=\"24\" \/>\u00a0Track: In the module 1 to session 8 the sounds of different characters worked<\/p>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_projecte2.png\" alt=\"Icon project\" width=\"32\" \/>\u00a0<strong>Our project grows &#8230;<\/strong><\/p>\n<p>It is time to review the description we have made in our\u00a0<b>pinball<\/b>\u00a0project\u00a0\u00a0to define what movements our characters are doing and how they relate to each other.<\/p>\n<p>We add to our description a new element: what sounds will be when people interact (racket \/ ball; ball \/ obstacles; &#8230;)?\u00a0What sound will it be when the ball is lost?\u00a0We have to make a diagram or table that reflects the possibilities of interaction and related sounds.<\/p>\n<p>Let us not forget that we are defining it slowly and that, when introducing improvements, it is very possible that what we had initially thought changed.\u00a0This is how programmers work, thinking first the idea to the last detail and then executing it.<\/p>\n<hr \/>\n<p><img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-icona_glosari.png\" alt=\"Glossary icon\" width=\"32\" \/>\u00a0<strong>Because we are programmers and programmers we talk about &#8230;<\/strong><\/p>\n<div>\n<ul>\n<li><b>Random:<\/b>\u00a0random selection of an object (a number generally) according to automatically.<\/li>\n<li><strong>Sensors:<\/strong>\u00a0\u00a0blocks that detect when there is some type of interaction between the characters or when the user interacts with the program.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Work plan<\/p>\n<ul>\n<li>Movement of the ball and racket.\u00a0Relationship between both<\/li>\n<li>Use of the sensors of the characters<\/li>\n<li>Bounce ball<\/li>\n<li>Bounce direction<\/li>\n<li>Choose the bounce direction randomly<\/li>\n<li>Sounds based on the action<\/li>\n<\/ul>\n<p>Does racket and ball movement have a relationship?<br \/>\nNow that we have characters (racket and ball) and we know how to move&hellip;  <a href=\"https:\/\/agora.xtec.cat\/esc-cancoll\/curs-scratch-primaria\/module-2-a-game-or-two\/session-2\/\" title=\"Read Session 2: Racket breaks\">Llegeix m\u00e9s\u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10141,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"class_list":["post-10150","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/comments?post=10150"}],"version-history":[{"count":3,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10150\/revisions"}],"predecessor-version":[{"id":10180,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10150\/revisions\/10180"}],"up":[{"embeddable":true,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10141"}],"wp:attachment":[{"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/media?parent=10150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}