{"id":10152,"date":"2018-09-24T13:25:45","date_gmt":"2018-09-24T11:25:45","guid":{"rendered":"http:\/\/agora.xtec.cat\/esc-cancoll\/?page_id=10152"},"modified":"2018-11-14T15:23:08","modified_gmt":"2018-11-14T14:23:08","slug":"session-3","status":"publish","type":"page","link":"https:\/\/agora.xtec.cat\/esc-cancoll\/curs-scratch-primaria\/module-2-a-game-or-two\/session-3\/","title":{"rendered":"Session 3: Different rackets, different bounces"},"content":{"rendered":"<h2><span id=\"Pla_de_treball\">Work plan<\/span><\/h2>\n<div>\n<ul>\n<li>Types of rebounds<\/li>\n<li>Angles<\/li>\n<li>Character twists<\/li>\n<\/ul>\n<h2><span id=\"Rebot_natural\">Natural bounce<\/span><\/h2>\n<p>In the previous session we have seen how we can make the ball bounce with the racket, however, we have programmed it so that the ball goes in the opposite direction or bounces by taking a random direction.\u00a0With neither of the two options the ball does a natural rebound, as he would do to reality.<\/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=\"Step by step\" width=\"32\" \/>\u00a0<strong>Let&#8217;s do it step by step<\/strong><\/p>\n<div>\n<ul>\n<li>Entering our Scratch account, we open the\u00a0<strong>m2repte21<\/strong>\u00a0project\u00a0and set it as\u00a0<strong>m2repte31<\/strong><\/li>\n<li>To calculate the output direction of the ball, we must take into account that the input angle must be the same as its symmetrical angle, as we see in this image:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong11.png\" alt=\"Input angle = symmetrical angle\" width=\"300\" \/><\/li>\n<li>We can also see that the input angle (or the symmetric, which is the same) plus the output angle add 180\u00ba:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong16.png\" alt=\"Output angle = 180 - input angle\" width=\"300\" \/><\/li>\n<li>We can calculate, then, the angle of exit of the ball with the formula\u00a0<strong>angle of exit = 180 &#8211; angle of entrance<\/strong>\u00a0.\u00a0For example, by an angle of entrance of 60\u00ba would correspond an angle of exit of 120\u00ba<\/li>\n<li>Note, however, that\u00a0<strong>the value of the angle is not the same as the direction of the character<\/strong>\u00a0.\u00a0If we remember &#8220;the rose of the winds&#8221; of the directions of the characters of the Scratch, by an angle of entrance of -135\u00ba would correspond an angle of exit of -45\u00ba:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong12.png\" alt=\"Rose of the Winds\" width=\"200\" \/>\u00a0<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong17.png\" alt=\"Directions entrance and exit\" width=\"300\" \/><\/li>\n<li>If we apply the formula above to the values of the directions of the &#8220;rose of the winds&#8221; we will find that\u00a0<strong>exit angle = 180 &#8211; (-135) = 315<\/strong>\u00a0(let&#8217;s look at that when we have two remains, in fact what we do is add) .\u00a0However, these 315\u00ba are not the -45\u00ba that we anticipate in the &#8220;rose of the winds&#8221; of the directions<\/li>\n<li>What happens is that this &#8220;rose of the winds&#8221; of the directions is not fixed, it is cyclical, and can take different values:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong13.png\" alt=\"Rose of Cyclic Winds\" width=\"250\" \/><\/li>\n<li>So, the 315 degrees that we have obtained as a result of the formula correspond to the -45 degrees we had foreseen that we would obtain as a result<\/li>\n<li>Let us note that in any of the values of the &#8220;rose of the winds&#8221; of the directions we can add or subtract 360, which are the degrees that have a whole circle of circumference, and will continue to function correctly<\/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>Modify the\u00a0<strong>m2repte31<\/strong>\u00a0project\u00a0so that whatever the input direction there is, a natural rebound of the ball against the racket.<\/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: To find out in what direction a person is oriented we have to use this blog:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-moviment_direccio.png\" alt=\"Management\" \/><\/p>\n<hr \/>\n<h2><span id=\"I_si_la_raqueta_es_vertical\">What if the racket is vertical?<\/span><\/h2>\n<p>We have seen how we can do to control the rebound of the ball when the racket is horizontal.\u00a0Is the solution always the case?<\/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=\"Step by step\" width=\"32\" \/>\u00a0<strong>Let&#8217;s do it step by step<\/strong><\/p>\n<div>\n<ul>\n<li>We continue with the\u00a0<strong>m2repte project31<\/strong><\/li>\n<li>We duplicate the character of the racket and, from the dressing tab we select it and rotate it 90\u00ba:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong23.png\" alt=\"Selected racket\" \/><\/li>\n<li>Let&#8217;s now make the program of this vertical racket so that the ball has a natural rebound.\u00a0If we look at the &#8220;wind rose&#8221; of the directions we will see that the formula we have done before now does not serve us<\/li>\n<li>However, if we look closely we can see that when the input address is 135 the output must be -135 and vice versa.\u00a0We verify if this works for any direction of entry:<br \/>\n<img decoding=\"async\" class=\"alignnone\" src=\"http:\/\/projectes.xtec.cat\/programacioirobotica\/wp-content\/uploads\/usu604\/2017\/06\/scratch-pong25.png\" alt=\"Vertical racket\" width=\"50\" \/><\/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><strong>Let&#8217;s change<\/strong>\u00a0the\u00a0<strong>m2repte31<\/strong>\u00a0project\u00a0so that we have both visible rackets (horizontal and vertical) and, whatever direction of entry, there is a natural rebound of the ball against the racket.<\/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: The horizontal racket is already solved.\u00a0For the vertical racket, what operation can we use to convert a number into the same number but with the sign changed?<\/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>Now that we have seen how we can bounce the ball naturally by controlling the angle of entry and the exit angle, we must decide which obstacles we will add to our\u00a0<b>\u00a0pinball<\/b>\u00a0\u00a0where the ball will rebound while moving.\u00a0These obstacles will be, in fact, characters that we can draw, choose from the gallery or upload through a photograph.\u00a0We must add to the definition of our project the obstacles that we will add and where we will place them.<\/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>Angle of entry:<\/b>\u00a0angle that forms the ball with the racket when it arrives.<\/li>\n<li><strong>Output<\/strong>\u00a0angle\u00a0<strong>:<\/strong>\u00a0angle that forms the ball with the racket when it is bounced.\u00a0It is calculated by subtracting the input angle to 180\u00ba.<\/li>\n<li><strong>Compase rose\u00a0:<\/strong>\u00a0scheme that allows us to find the equivalence between the output angle that we have calculated and the direction of the characte<\/li>\n<\/ul>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Work plan<\/p>\n<ul>\n<li>Types of rebounds<\/li>\n<li>Angles<\/li>\n<li>Character twists<\/li>\n<\/ul>\n<p>Natural bounce<br \/>\nIn the previous session we have seen how we can make the ball bounce with the racket, however, we have programmed it so that the ball goes in the opposite direction or bounces by taking a random direction.\u00a0With neither of&hellip;  <a href=\"https:\/\/agora.xtec.cat\/esc-cancoll\/curs-scratch-primaria\/module-2-a-game-or-two\/session-3\/\" title=\"Read Session 3: Different rackets, different bounces\">Llegeix m\u00e9s\u00bb<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":10141,"menu_order":0,"comment_status":"closed","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-10152","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10152","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=10152"}],"version-history":[{"count":3,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10152\/revisions"}],"predecessor-version":[{"id":10182,"href":"https:\/\/agora.xtec.cat\/esc-cancoll\/wp-json\/wp\/v2\/pages\/10152\/revisions\/10182"}],"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=10152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}