1 00:00:00,480 --> 00:00:03,480 foreign 2 00:00:09,030 --> 00:00:13,380 [Applause] 3 00:00:11,099 --> 00:00:17,039 okay my own yep 4 00:00:13,380 --> 00:00:19,680 all right ah okay so we've had our very 5 00:00:17,039 --> 00:00:22,380 teeny tiny morning tea break I hope you 6 00:00:19,680 --> 00:00:25,199 all are adequately caffeinated and now 7 00:00:22,380 --> 00:00:27,660 we're approximately back on time so 8 00:00:25,199 --> 00:00:32,220 that's good uh today I'm going to be 9 00:00:27,660 --> 00:00:34,140 talking about uh Pi game zero so I'm a 10 00:00:32,220 --> 00:00:37,079 teacher I've been a teacher for a while 11 00:00:34,140 --> 00:00:38,760 now and uh there's a thing called pie 12 00:00:37,079 --> 00:00:41,520 game that most people that are python 13 00:00:38,760 --> 00:00:44,700 developers know of and never ever ever 14 00:00:41,520 --> 00:00:46,680 touch because who would but there's also 15 00:00:44,700 --> 00:00:47,820 another thing called pie game zero and 16 00:00:46,680 --> 00:00:50,340 I'm going to be doing a bit of an 17 00:00:47,820 --> 00:00:52,800 analysis of the two today and telling 18 00:00:50,340 --> 00:00:55,559 you about my story in the classroom so 19 00:00:52,800 --> 00:00:57,840 that any Educators that are watching can 20 00:00:55,559 --> 00:01:00,420 understand some of the pitfalls that 21 00:00:57,840 --> 00:01:02,520 I've come across and how to avoid them 22 00:01:00,420 --> 00:01:03,899 in their own classroom and some of the 23 00:01:02,520 --> 00:01:07,320 benefits also 24 00:01:03,899 --> 00:01:10,380 so the summary is xero or hero pie game 25 00:01:07,320 --> 00:01:13,260 zero in the classroom so who am I uh 26 00:01:10,380 --> 00:01:14,520 this is my fabulous game Avatar that my 27 00:01:13,260 --> 00:01:16,020 son made me 28 00:01:14,520 --> 00:01:18,060 um 29 00:01:16,020 --> 00:01:20,280 so I'm a Computing teacher and have been 30 00:01:18,060 --> 00:01:22,200 for about 15 years I used to work in 31 00:01:20,280 --> 00:01:25,320 industry but it was it's getting to be 32 00:01:22,200 --> 00:01:27,240 an embarrassingly long time ago now and 33 00:01:25,320 --> 00:01:28,920 I am concerned about the implementation 34 00:01:27,240 --> 00:01:30,960 of new syllabuses in New South Wales 35 00:01:28,920 --> 00:01:33,780 we're getting a lot of them over the 36 00:01:30,960 --> 00:01:36,360 next two years and I am a terrible 37 00:01:33,780 --> 00:01:38,460 kickboxer despite this image 38 00:01:36,360 --> 00:01:43,380 Okay so 39 00:01:38,460 --> 00:01:45,119 this is a quote by Pablo Picasso is that 40 00:01:43,380 --> 00:01:47,939 and I'm not a big fan I've got to say 41 00:01:45,119 --> 00:01:51,659 but I'm a big fan of this quote and I do 42 00:01:47,939 --> 00:01:54,720 I do take it on I synthesize this in my 43 00:01:51,659 --> 00:01:57,299 classroom so we learn the rules like a 44 00:01:54,720 --> 00:02:00,840 pro so we can break them like an artist 45 00:01:57,299 --> 00:02:03,119 and so this means that I have a slightly 46 00:02:00,840 --> 00:02:06,600 different take on teaching Computing 47 00:02:03,119 --> 00:02:08,640 from a lot of teachers and this dovetail 48 00:02:06,600 --> 00:02:11,940 is quite interestingly with Jack's talk 49 00:02:08,640 --> 00:02:13,620 because I steer clear of libraries for 50 00:02:11,940 --> 00:02:17,340 the most part at least for the first 51 00:02:13,620 --> 00:02:20,099 phase of programming some teachers go in 52 00:02:17,340 --> 00:02:23,160 with lots of libraries very early get 53 00:02:20,099 --> 00:02:24,500 the kids to feel that efficacy of making 54 00:02:23,160 --> 00:02:27,660 stuff happen 55 00:02:24,500 --> 00:02:30,000 and I am a bit more like the first 56 00:02:27,660 --> 00:02:33,540 principles we have to have that 57 00:02:30,000 --> 00:02:36,360 foundation and so 58 00:02:33,540 --> 00:02:39,000 the transition that we make in the 59 00:02:36,360 --> 00:02:42,239 classroom in my programs um 60 00:02:39,000 --> 00:02:44,400 programs are the teacher word for uh 61 00:02:42,239 --> 00:02:45,840 like the the things we do in the 62 00:02:44,400 --> 00:02:48,180 classroom they're all written into a 63 00:02:45,840 --> 00:02:51,120 program and so 64 00:02:48,180 --> 00:02:53,879 our programs start with output we have 65 00:02:51,120 --> 00:02:56,340 print on the screen real early that 66 00:02:53,879 --> 00:02:58,440 hello world thing that's true we print 67 00:02:56,340 --> 00:03:01,680 on the screen real early and then we add 68 00:02:58,440 --> 00:03:04,080 some variables to that and then we add 69 00:03:01,680 --> 00:03:06,120 some input so we can we can see what 70 00:03:04,080 --> 00:03:08,099 what the user is typing and then we 71 00:03:06,120 --> 00:03:10,080 might do some string processing in there 72 00:03:08,099 --> 00:03:11,940 so that the students get a lot of 73 00:03:10,080 --> 00:03:13,860 practice at that and then we add 74 00:03:11,940 --> 00:03:16,860 selection which is your if statements 75 00:03:13,860 --> 00:03:20,280 and then we make complex selections so 76 00:03:16,860 --> 00:03:22,860 nesting of if statements and LF gets 77 00:03:20,280 --> 00:03:26,220 added in there and then we have loops 78 00:03:22,860 --> 00:03:28,739 added start with while transition to 79 00:03:26,220 --> 00:03:31,500 four and then we have loops with 80 00:03:28,739 --> 00:03:34,800 selections loops with other Loops like 81 00:03:31,500 --> 00:03:37,980 this is the this is the growing ripples 82 00:03:34,800 --> 00:03:40,319 of computer coding in the classroom and 83 00:03:37,980 --> 00:03:43,140 then finally we're getting two functions 84 00:03:40,319 --> 00:03:45,000 that is our that is our end goal there 85 00:03:43,140 --> 00:03:47,940 you'll notice There's No Object oriented 86 00:03:45,000 --> 00:03:50,760 in here there is now object oriented 87 00:03:47,940 --> 00:03:53,819 program being mandated for year 11 and 88 00:03:50,760 --> 00:03:56,159 12 coming from next year in the New 89 00:03:53,819 --> 00:03:58,379 South Wales syllabuses but this I'm 90 00:03:56,159 --> 00:04:01,140 mostly talking about stage five which is 91 00:03:58,379 --> 00:04:04,560 years nine and ten when they when 92 00:04:01,140 --> 00:04:06,120 they've passed the very basic like I 93 00:04:04,560 --> 00:04:08,819 made something appear on a screen thing 94 00:04:06,120 --> 00:04:12,840 and they're now transitioning into doing 95 00:04:08,819 --> 00:04:16,019 more complex stuff with functions okay 96 00:04:12,840 --> 00:04:18,299 this is the fundamental problem we're 97 00:04:16,019 --> 00:04:19,859 trying to solve so that's the 98 00:04:18,299 --> 00:04:21,780 fundamentals that's all the stuff that I 99 00:04:19,859 --> 00:04:23,520 just spoke about we've got output we've 100 00:04:21,780 --> 00:04:25,620 got variables we've got input we've got 101 00:04:23,520 --> 00:04:28,080 selection we've got Loops all of the 102 00:04:25,620 --> 00:04:30,060 complexity complexities of of 103 00:04:28,080 --> 00:04:32,940 interlacing those and we've got 104 00:04:30,060 --> 00:04:36,600 functions and you're still a million 105 00:04:32,940 --> 00:04:41,160 billion miles from gooeys right 106 00:04:36,600 --> 00:04:42,960 it's it's very very far and it's hard 107 00:04:41,160 --> 00:04:45,780 you have a budget and also there's 108 00:04:42,960 --> 00:04:48,360 physics involved to get you from one to 109 00:04:45,780 --> 00:04:51,300 the other and so that this is the 110 00:04:48,360 --> 00:04:54,740 problem that we all have to try and 111 00:04:51,300 --> 00:04:54,740 solve in our classroom somehow 112 00:04:54,780 --> 00:04:58,919 today 113 00:04:55,979 --> 00:05:01,380 we have have made the game Flappy brick 114 00:04:58,919 --> 00:05:03,660 uh and I've made this game twice I've 115 00:05:01,380 --> 00:05:05,759 made it in pie game and I've made it in 116 00:05:03,660 --> 00:05:08,400 pie game zero and we are going to 117 00:05:05,759 --> 00:05:10,500 compare the two and see what's going on 118 00:05:08,400 --> 00:05:12,180 and why they're different and what's 119 00:05:10,500 --> 00:05:14,040 good about them 120 00:05:12,180 --> 00:05:16,800 um so it's the easiest game I could 121 00:05:14,040 --> 00:05:18,720 think of that I could make with the 122 00:05:16,800 --> 00:05:22,020 least amount of physics 123 00:05:18,720 --> 00:05:26,039 um so what we have here is 124 00:05:22,020 --> 00:05:29,039 a game character a Sprite and you click 125 00:05:26,039 --> 00:05:31,380 a mouse button and it goes up it does 126 00:05:29,039 --> 00:05:34,440 not go up in any smooth way please don't 127 00:05:31,380 --> 00:05:36,240 critique my code it's really aimed at 14 128 00:05:34,440 --> 00:05:38,720 year olds all right so it doesn't go up 129 00:05:36,240 --> 00:05:45,720 in any kind of smooth animation it just 130 00:05:38,720 --> 00:05:47,880 jumps 30 pixels and the the pipes or you 131 00:05:45,720 --> 00:05:50,400 know the obstacles move from left to 132 00:05:47,880 --> 00:05:52,320 right so the Sprite goes up and down the 133 00:05:50,400 --> 00:05:54,740 obstacles move left to right that's the 134 00:05:52,320 --> 00:05:57,900 whole game it's real basic 135 00:05:54,740 --> 00:06:01,199 there's only one input and the score is 136 00:05:57,900 --> 00:06:03,780 based on some basic mathematics 137 00:06:01,199 --> 00:06:06,300 uh yeah okay 138 00:06:03,780 --> 00:06:08,160 so why games this is an important 139 00:06:06,300 --> 00:06:09,660 question I've had some very interesting 140 00:06:08,160 --> 00:06:13,259 debates with some people I really 141 00:06:09,660 --> 00:06:14,759 respect uh who say Do not teach games in 142 00:06:13,259 --> 00:06:15,900 the classroom you're killing your 143 00:06:14,759 --> 00:06:17,759 children 144 00:06:15,900 --> 00:06:19,500 um that Gap that I showed you earlier 145 00:06:17,759 --> 00:06:22,380 that we have to bridge between the 146 00:06:19,500 --> 00:06:24,960 fundamentals and the guis is just too 147 00:06:22,380 --> 00:06:27,780 great and too disappointing and so we 148 00:06:24,960 --> 00:06:29,880 should just steer clear of games but 149 00:06:27,780 --> 00:06:31,800 I think there's a really good reason for 150 00:06:29,880 --> 00:06:34,560 games in the classroom 151 00:06:31,800 --> 00:06:36,360 um and that is that kids don't know 152 00:06:34,560 --> 00:06:38,580 anything about the world 153 00:06:36,360 --> 00:06:40,860 so when they have to try and come up 154 00:06:38,580 --> 00:06:43,560 with the rules involved in some kind of 155 00:06:40,860 --> 00:06:45,800 business case they are at Sea they have 156 00:06:43,560 --> 00:06:49,319 no idea you have to give them to them 157 00:06:45,800 --> 00:06:51,780 whereas with a game they have a lot of 158 00:06:49,319 --> 00:06:54,419 experience playing games different kinds 159 00:06:51,780 --> 00:06:56,460 of games maybe that particularly there 160 00:06:54,419 --> 00:06:58,940 is a bit of a gender split in the kinds 161 00:06:56,460 --> 00:07:01,080 of games that the students play but 162 00:06:58,940 --> 00:07:04,620 they've still all had some experience 163 00:07:01,080 --> 00:07:07,860 with games and they find games engaging 164 00:07:04,620 --> 00:07:10,919 amazing surprising things I know but 165 00:07:07,860 --> 00:07:13,319 they're very strictly rule based a 166 00:07:10,919 --> 00:07:15,300 student if you sit down and say how do 167 00:07:13,319 --> 00:07:18,300 you play naughts and Crosses they can 168 00:07:15,300 --> 00:07:20,099 tell you the rules they know the rules 169 00:07:18,300 --> 00:07:22,259 they've synthesized that games have 170 00:07:20,099 --> 00:07:26,039 rules and these rules are very easily 171 00:07:22,259 --> 00:07:28,979 articulated and they want to test their 172 00:07:26,039 --> 00:07:31,500 programs geez as a Computing program as 173 00:07:28,979 --> 00:07:33,479 a Computing teacher we want kids to want 174 00:07:31,500 --> 00:07:35,819 to test their programs and they want to 175 00:07:33,479 --> 00:07:38,639 test them if they're games and it's 176 00:07:35,819 --> 00:07:41,460 easily since the sized why not games 177 00:07:38,639 --> 00:07:44,460 because guis are really really really 178 00:07:41,460 --> 00:07:47,699 really really hard okay 179 00:07:44,460 --> 00:07:49,199 why python lots of people say you should 180 00:07:47,699 --> 00:07:50,819 start with something else maybe you 181 00:07:49,199 --> 00:07:54,660 should start with JavaScript maybe you 182 00:07:50,819 --> 00:07:56,220 should use web stuff it's mostly for the 183 00:07:54,660 --> 00:07:59,160 reason that Jack showed in his previous 184 00:07:56,220 --> 00:08:00,900 talk which is that you get rid of all of 185 00:07:59,160 --> 00:08:02,940 the stuff that you say please ignore 186 00:08:00,900 --> 00:08:05,220 this until later and you're left with 187 00:08:02,940 --> 00:08:09,120 python so we're just going to start with 188 00:08:05,220 --> 00:08:12,300 python also python is now mandated at 189 00:08:09,120 --> 00:08:14,160 the HSC from 2025 so the students that 190 00:08:12,300 --> 00:08:18,120 come into software engineering in year 191 00:08:14,160 --> 00:08:21,720 11 next year will be required to write 192 00:08:18,120 --> 00:08:24,720 python in a browser window in their in 193 00:08:21,720 --> 00:08:27,660 their HSC exam and so if we're aiming 194 00:08:24,720 --> 00:08:30,240 there we need to smooth that path and so 195 00:08:27,660 --> 00:08:32,880 at our school we've decided to go 7 to 196 00:08:30,240 --> 00:08:37,500 12 python 197 00:08:32,880 --> 00:08:40,560 um so consistency I also love that 198 00:08:37,500 --> 00:08:42,539 python has that low floor and very high 199 00:08:40,560 --> 00:08:44,399 ceiling there are lots of things that 200 00:08:42,539 --> 00:08:46,200 students can do to extend themselves 201 00:08:44,399 --> 00:08:48,959 with all of the different open source 202 00:08:46,200 --> 00:08:51,660 libraries that allow that that are 203 00:08:48,959 --> 00:08:54,120 available to them with python 204 00:08:51,660 --> 00:08:56,640 um there are some students that do 205 00:08:54,120 --> 00:08:58,440 extend I have students who come to me 206 00:08:56,640 --> 00:09:01,500 and say I want to do my major project in 207 00:08:58,440 --> 00:09:04,620 Rust and after I stop weeping 208 00:09:01,500 --> 00:09:06,600 um then I say sure you're going to get a 209 00:09:04,620 --> 00:09:08,040 lot less hand-holding from me and 210 00:09:06,600 --> 00:09:10,080 they're like it's all right Miss I'm 211 00:09:08,040 --> 00:09:12,300 fine and for the kid that's it's all 212 00:09:10,080 --> 00:09:15,480 right Miss I'm fine then sure go do Rust 213 00:09:12,300 --> 00:09:16,860 but for the most of them a vast majority 214 00:09:15,480 --> 00:09:19,560 of the students that I take through the 215 00:09:16,860 --> 00:09:22,680 HSC still need a bunch of hand holding 216 00:09:19,560 --> 00:09:25,440 and so it's better if those resources I 217 00:09:22,680 --> 00:09:28,200 can make once with one one language 218 00:09:25,440 --> 00:09:30,480 the other thing is that in the HSC in 219 00:09:28,200 --> 00:09:32,279 2025 not only do the students have to 220 00:09:30,480 --> 00:09:36,480 write python in the browser 221 00:09:32,279 --> 00:09:40,160 they also have to know HTML CSS and some 222 00:09:36,480 --> 00:09:42,720 SQL and that's a lot that's enough now 223 00:09:40,160 --> 00:09:45,000 keeping those syntaxes straight I know 224 00:09:42,720 --> 00:09:47,160 that the whole HTML is not a programming 225 00:09:45,000 --> 00:09:50,519 language thing is is great have that 226 00:09:47,160 --> 00:09:52,740 debate outside but also it's still it's 227 00:09:50,519 --> 00:09:55,140 still a literacy that they need to have 228 00:09:52,740 --> 00:09:56,940 it's still tagging it's still things 229 00:09:55,140 --> 00:09:59,760 that they need to remember and there's a 230 00:09:56,940 --> 00:10:01,920 lot of cognitive load there there are a 231 00:09:59,760 --> 00:10:03,540 couple of talks a couple of years uh 232 00:10:01,920 --> 00:10:04,860 that was sorry there was a great talk a 233 00:10:03,540 --> 00:10:06,959 couple of years back about all the 234 00:10:04,860 --> 00:10:09,600 different options if you've decided to 235 00:10:06,959 --> 00:10:12,000 do games in Python what should what's 236 00:10:09,600 --> 00:10:13,920 available to you and so I'll direct you 237 00:10:12,000 --> 00:10:17,220 to that because I'm not going to do that 238 00:10:13,920 --> 00:10:19,620 cover that today we're assuming that our 239 00:10:17,220 --> 00:10:21,420 solution was Pi game 240 00:10:19,620 --> 00:10:23,459 and there are lots of reasons the number 241 00:10:21,420 --> 00:10:26,220 one reason was I didn't want to start 242 00:10:23,459 --> 00:10:28,140 with objects and there's a lot that you 243 00:10:26,220 --> 00:10:30,540 can do in pi game 244 00:10:28,140 --> 00:10:32,339 with using objects without having to 245 00:10:30,540 --> 00:10:34,500 write your own without having to write 246 00:10:32,339 --> 00:10:37,620 classes and that's where I needed to be 247 00:10:34,500 --> 00:10:40,140 okay so the first thing I want to do is 248 00:10:37,620 --> 00:10:43,440 show you a snippet of a tutorial that 249 00:10:40,140 --> 00:10:45,480 I've made for a pie game 250 00:10:43,440 --> 00:10:48,600 um from before I started using pi game 251 00:10:45,480 --> 00:10:52,800 zero and it looked like this 252 00:10:48,600 --> 00:10:55,980 okay so I've got little Snippets of code 253 00:10:52,800 --> 00:10:58,680 I've got explanations of how things work 254 00:10:55,980 --> 00:11:00,959 and you can see the main Loop here while 255 00:10:58,680 --> 00:11:02,399 not done for event Empire game we're 256 00:11:00,959 --> 00:11:04,920 going to have to go and get those events 257 00:11:02,399 --> 00:11:08,100 this is just the code to make the screen 258 00:11:04,920 --> 00:11:09,360 close so once you run this code the 259 00:11:08,100 --> 00:11:12,060 screen will close when you hit the 260 00:11:09,360 --> 00:11:14,459 little x button that's it and there's 261 00:11:12,060 --> 00:11:16,920 quite a lot of lines there 262 00:11:14,459 --> 00:11:19,200 all right 263 00:11:16,920 --> 00:11:23,339 so in general we're talking about games 264 00:11:19,200 --> 00:11:26,220 that are single screen and they follow a 265 00:11:23,339 --> 00:11:28,079 very basic same general shape okay I'm 266 00:11:26,220 --> 00:11:29,220 going to show you the shape of a basic 267 00:11:28,079 --> 00:11:31,019 game 268 00:11:29,220 --> 00:11:33,660 we begin 269 00:11:31,019 --> 00:11:35,399 we set up the game stuff there's a whole 270 00:11:33,660 --> 00:11:38,519 lot of stuff that needs to be set up in 271 00:11:35,399 --> 00:11:40,800 advance and then we enter a loop and 272 00:11:38,519 --> 00:11:43,019 then we handle the player input we 273 00:11:40,800 --> 00:11:44,820 update all the objects we draw 274 00:11:43,019 --> 00:11:46,980 everything to the screen and then we 275 00:11:44,820 --> 00:11:48,779 check have we ended the loop or not and 276 00:11:46,980 --> 00:11:51,660 then we do it again and we do it a lot 277 00:11:48,779 --> 00:11:53,640 and then at the end we do some Andy 278 00:11:51,660 --> 00:11:56,339 stuff maybe there's a high score or 279 00:11:53,640 --> 00:11:58,140 something like that and then we end the 280 00:11:56,339 --> 00:12:00,120 game that's the shape this is the shape 281 00:11:58,140 --> 00:12:01,500 we'll be referring to for the remainder 282 00:12:00,120 --> 00:12:03,839 of the talk 283 00:12:01,500 --> 00:12:07,320 okay 284 00:12:03,839 --> 00:12:09,720 so initial setup I'm going to do the 285 00:12:07,320 --> 00:12:12,200 comparison side by side Pi game Pi game 286 00:12:09,720 --> 00:12:12,200 zero 287 00:12:12,240 --> 00:12:18,120 all right so on the left we have Pi game 288 00:12:14,940 --> 00:12:20,640 and on the right we have Pi game zero 289 00:12:18,120 --> 00:12:23,220 um so I want to I don't know if I can do 290 00:12:20,640 --> 00:12:27,779 this can I do this oh 291 00:12:23,220 --> 00:12:30,720 I have little red dots I love it okay so 292 00:12:27,779 --> 00:12:33,000 um all right so Pi game zero has been 293 00:12:30,720 --> 00:12:37,620 made to try and smooth the transition 294 00:12:33,000 --> 00:12:41,700 from scratch to Pi game to using python 295 00:12:37,620 --> 00:12:43,620 in in guis and I'm not sure I don't have 296 00:12:41,700 --> 00:12:47,339 students that are trying to make that 297 00:12:43,620 --> 00:12:49,380 jump from scratch directly to Pi game so 298 00:12:47,339 --> 00:12:51,180 I'm not sure if it's successful there 299 00:12:49,380 --> 00:12:53,100 but there are some great things about it 300 00:12:51,180 --> 00:12:54,899 so it's done a lot of what Jack was 301 00:12:53,100 --> 00:12:57,899 talking about in the last talk of 302 00:12:54,899 --> 00:13:00,540 wrapping up the craft I guess so here we 303 00:12:57,899 --> 00:13:03,240 have we have to 304 00:13:00,540 --> 00:13:06,779 um in pi game we have to Define our 305 00:13:03,240 --> 00:13:08,279 colors and we have to make the tuples of 306 00:13:06,779 --> 00:13:10,860 the RGB 307 00:13:08,279 --> 00:13:14,399 um we have to do this thing here where 308 00:13:10,860 --> 00:13:17,760 we set up a screen and we give it a size 309 00:13:14,399 --> 00:13:20,279 but the size has to be a tuple or in 310 00:13:17,760 --> 00:13:22,800 this case it's a list but but has to 311 00:13:20,279 --> 00:13:24,899 have the brackets and so students the 312 00:13:22,800 --> 00:13:28,200 first thing a student will do wrong in 313 00:13:24,899 --> 00:13:30,540 pi game is to not put double brackets 314 00:13:28,200 --> 00:13:32,760 there which is why I've pulled out size 315 00:13:30,540 --> 00:13:35,940 as a separate variable 316 00:13:32,760 --> 00:13:39,560 okay and then we have this thing called 317 00:13:35,940 --> 00:13:42,420 a Sprite so the brick is a Sprite 318 00:13:39,560 --> 00:13:44,760 and that Sprite then has to have an 319 00:13:42,420 --> 00:13:46,980 image loaded against it then it has to 320 00:13:44,760 --> 00:13:48,720 have a rectangle defined and the 321 00:13:46,980 --> 00:13:52,560 rectangle definition is what you then 322 00:13:48,720 --> 00:13:56,700 set X Y values against it gets a lot of 323 00:13:52,560 --> 00:14:01,740 lines for one Sprite being set up okay 324 00:13:56,700 --> 00:14:03,660 um over here we have Pi game zero this 325 00:14:01,740 --> 00:14:08,279 is how you set up a screen 326 00:14:03,660 --> 00:14:12,240 you have one capitalized variable so 327 00:14:08,279 --> 00:14:13,980 constant I guess called width and it has 328 00:14:12,240 --> 00:14:15,600 a number against it and one called 329 00:14:13,980 --> 00:14:17,760 height and it has a number against it 330 00:14:15,600 --> 00:14:19,980 and Pi game zero goes and does all of 331 00:14:17,760 --> 00:14:21,779 the screen creation stuff for you based 332 00:14:19,980 --> 00:14:24,779 on those two numbers which is really 333 00:14:21,779 --> 00:14:28,380 useful and then down here we have a 334 00:14:24,779 --> 00:14:31,860 thing called an actor which is like a 335 00:14:28,380 --> 00:14:36,300 Sprite but with a lot less letters and 336 00:14:31,860 --> 00:14:37,279 an actor takes in it of the name of the 337 00:14:36,300 --> 00:14:41,040 image 338 00:14:37,279 --> 00:14:44,459 so this is the name of the image it's in 339 00:14:41,040 --> 00:14:46,440 Images slash brick.png so it's in 340 00:14:44,459 --> 00:14:48,420 exactly the same place 341 00:14:46,440 --> 00:14:50,459 I actually have a GitHub at the end 342 00:14:48,420 --> 00:14:52,139 where both of these pieces of code are 343 00:14:50,459 --> 00:14:54,240 so you can see that the images are in 344 00:14:52,139 --> 00:14:55,980 the same place and so if you've put the 345 00:14:54,240 --> 00:14:58,800 image in the images folder which is 346 00:14:55,980 --> 00:15:01,199 really good practice and they're all 347 00:14:58,800 --> 00:15:02,639 pngs then it just works as a string like 348 00:15:01,199 --> 00:15:05,399 this which is Magic 349 00:15:02,639 --> 00:15:08,100 the other thing is that over here we 350 00:15:05,399 --> 00:15:10,800 have that whole rectangle thing where to 351 00:15:08,100 --> 00:15:13,019 make it move and set its x value you 352 00:15:10,800 --> 00:15:16,440 have to do three lines of code 353 00:15:13,019 --> 00:15:20,279 over here brick just has its own X and Y 354 00:15:16,440 --> 00:15:23,279 value there's also an extra step where 355 00:15:20,279 --> 00:15:25,800 Pi game zero has re-registered X and Y 356 00:15:23,279 --> 00:15:27,860 to be the center of the image whereas 357 00:15:25,800 --> 00:15:31,740 does anybody know where Pi game 358 00:15:27,860 --> 00:15:33,839 automatically puts the X Y value 359 00:15:31,740 --> 00:15:36,300 top left 360 00:15:33,839 --> 00:15:37,760 explain that and I have 361 00:15:36,300 --> 00:15:40,800 um 362 00:15:37,760 --> 00:15:43,260 uh yeah so everything is built from the 363 00:15:40,800 --> 00:15:44,699 top left whereas in pi game zero things 364 00:15:43,260 --> 00:15:47,300 are built from the center out which is 365 00:15:44,699 --> 00:15:47,300 just useful 366 00:15:47,459 --> 00:15:52,139 okay 367 00:15:48,779 --> 00:15:53,519 all right so that was the initial setup 368 00:15:52,139 --> 00:15:56,339 that's all the stuff that happens before 369 00:15:53,519 --> 00:15:58,139 the game Loop and now we have the game 370 00:15:56,339 --> 00:16:01,980 Loop itself 371 00:15:58,139 --> 00:16:03,620 okay so uh I have 372 00:16:01,980 --> 00:16:07,920 uh 373 00:16:03,620 --> 00:16:11,820 the function here update all and the 374 00:16:07,920 --> 00:16:14,579 function here display all right and over 375 00:16:11,820 --> 00:16:16,380 here I've got a function update and a 376 00:16:14,579 --> 00:16:21,240 function draw 377 00:16:16,380 --> 00:16:23,880 in pi game zero you are required to use 378 00:16:21,240 --> 00:16:27,300 the function name update and the 379 00:16:23,880 --> 00:16:30,120 function name draw so it will do the 380 00:16:27,300 --> 00:16:32,699 update thing and then the draw thing one 381 00:16:30,120 --> 00:16:34,380 after the other inside the loop over 382 00:16:32,699 --> 00:16:36,060 here I could call them anything which is 383 00:16:34,380 --> 00:16:39,720 why I called them slightly different so 384 00:16:36,060 --> 00:16:42,120 they didn't get confused and the global 385 00:16:39,720 --> 00:16:45,300 still required but you can see here the 386 00:16:42,120 --> 00:16:48,180 positioning of the different Sprites is 387 00:16:45,300 --> 00:16:51,660 much trickier in pi game than in pi game 388 00:16:48,180 --> 00:16:54,540 zero and the Collision detection is 389 00:16:51,660 --> 00:16:57,480 actually yuckier too so Collision 390 00:16:54,540 --> 00:17:01,259 detection where Collide rectangle 391 00:16:57,480 --> 00:17:04,319 between the brick and the wall top and 392 00:17:01,259 --> 00:17:05,480 the brick and the wall bottom over here 393 00:17:04,319 --> 00:17:09,299 we've got 394 00:17:05,480 --> 00:17:13,020 this this Collide rect but it has to be 395 00:17:09,299 --> 00:17:16,079 brick wrecked and not brick itself and 396 00:17:13,020 --> 00:17:19,620 wall top rect instead of wall top so 397 00:17:16,079 --> 00:17:21,000 it's just an extra an extra thing that 398 00:17:19,620 --> 00:17:23,220 they have to keep in their heads and 399 00:17:21,000 --> 00:17:26,400 these are just this is every single 400 00:17:23,220 --> 00:17:28,860 mistake a kid has made is has been 401 00:17:26,400 --> 00:17:31,080 anticipated and kind of corrected in pi 402 00:17:28,860 --> 00:17:34,200 game zero which is amazing the last 403 00:17:31,080 --> 00:17:36,840 thing I want you to look at is down here 404 00:17:34,200 --> 00:17:39,240 I have brick dot draw walltop dot draw 405 00:17:36,840 --> 00:17:41,220 wall bottom dot draw fantastic right you 406 00:17:39,240 --> 00:17:45,299 know what that does it's almost like 407 00:17:41,220 --> 00:17:49,020 English over here we have screen dot BLT 408 00:17:45,299 --> 00:17:50,520 brick image Brit rect X Brit wrecked y 409 00:17:49,020 --> 00:17:53,340 right 410 00:17:50,520 --> 00:17:57,480 what the heck is a blit 411 00:17:53,340 --> 00:18:01,280 this is a heck of visible it okay so you 412 00:17:57,480 --> 00:18:03,900 have a set of pixels and you have to 413 00:18:01,280 --> 00:18:05,820 mesh them sew them together with the 414 00:18:03,900 --> 00:18:08,220 another set of pixels a larger set of 415 00:18:05,820 --> 00:18:11,640 pixels like a screen then that process 416 00:18:08,220 --> 00:18:13,140 is called blitting uh and I think it 417 00:18:11,640 --> 00:18:16,080 stands for something but that's that's 418 00:18:13,140 --> 00:18:17,460 the process that's splitting and so 419 00:18:16,080 --> 00:18:20,100 blitting 420 00:18:17,460 --> 00:18:22,860 is what it's called in pie game because 421 00:18:20,100 --> 00:18:25,860 it's correctly called blitting but no 422 00:18:22,860 --> 00:18:28,260 kid needs to know that so drawing is the 423 00:18:25,860 --> 00:18:30,900 thing that they think of it doing so 424 00:18:28,260 --> 00:18:34,140 um the the language is much clearer 425 00:18:30,900 --> 00:18:35,940 okay so there's our blit okay so now we 426 00:18:34,140 --> 00:18:38,880 have you that they're the things that 427 00:18:35,940 --> 00:18:41,160 are inside the loop now we have the user 428 00:18:38,880 --> 00:18:44,520 input and the loop itself 429 00:18:41,160 --> 00:18:48,419 all right so user input in pi game is 430 00:18:44,520 --> 00:18:50,100 awful we have to Loop through the events 431 00:18:48,419 --> 00:18:51,900 this is the one that I showed you 432 00:18:50,100 --> 00:18:54,840 earlier in my tutorial this is how you 433 00:18:51,900 --> 00:18:58,440 make it quit when the top X is pressed 434 00:18:54,840 --> 00:19:00,960 and this is how we find that there has 435 00:18:58,440 --> 00:19:02,900 been a button click we look for an event 436 00:19:00,960 --> 00:19:05,340 type of 437 00:19:02,900 --> 00:19:08,820 mouseapygame.mouse button down and then 438 00:19:05,340 --> 00:19:11,940 we jump the rectangle up 30 up the 439 00:19:08,820 --> 00:19:14,880 screen is minus 30. same thing over here 440 00:19:11,940 --> 00:19:18,500 up the screen is -30 but we're just 441 00:19:14,880 --> 00:19:18,500 using an on Mouse down event 442 00:19:19,020 --> 00:19:24,179 and then the last thing to look at is 443 00:19:21,799 --> 00:19:26,640 pygamestplay.flip right 444 00:19:24,179 --> 00:19:29,820 that's not necessary now the other thing 445 00:19:26,640 --> 00:19:32,400 is see this while not done that while 446 00:19:29,820 --> 00:19:35,760 loop doesn't exist in pi game not at all 447 00:19:32,400 --> 00:19:38,520 there's no loop it's all implicit which 448 00:19:35,760 --> 00:19:43,260 is a bit wacky and this is my biggest 449 00:19:38,520 --> 00:19:46,679 problem with pi game zero is that it 450 00:19:43,260 --> 00:19:49,500 hides a lot and it does get you part the 451 00:19:46,679 --> 00:19:50,700 way across that bridge image we showed 452 00:19:49,500 --> 00:19:54,960 earlier 453 00:19:50,700 --> 00:19:57,419 um to the to introduction to guis but it 454 00:19:54,960 --> 00:19:58,500 doesn't get you all the way so in 455 00:19:57,419 --> 00:20:01,500 summary 456 00:19:58,500 --> 00:20:04,620 pie game zero is awesome it really does 457 00:20:01,500 --> 00:20:07,460 mean that students have that efficacy to 458 00:20:04,620 --> 00:20:10,140 do things without constant tutorials 459 00:20:07,460 --> 00:20:13,860 constant hand-holding that is really 460 00:20:10,140 --> 00:20:17,400 useful but the questions that are asked 461 00:20:13,860 --> 00:20:19,140 are I know how a function works why is 462 00:20:17,400 --> 00:20:21,780 this why have I defined this function 463 00:20:19,140 --> 00:20:24,480 but never called it and it's because Pi 464 00:20:21,780 --> 00:20:26,280 game zero calls the function itself it 465 00:20:24,480 --> 00:20:28,679 calls the update function it calls the 466 00:20:26,280 --> 00:20:29,940 draw function by itself without the user 467 00:20:28,679 --> 00:20:32,820 having that without the programmer 468 00:20:29,940 --> 00:20:35,400 having to do it which is confusing to 469 00:20:32,820 --> 00:20:37,140 smooth the transition to the next step 470 00:20:35,400 --> 00:20:40,440 and it's confusing to the students who 471 00:20:37,140 --> 00:20:42,419 know how functions work so it's really 472 00:20:40,440 --> 00:20:45,360 quite useful for the students that are 473 00:20:42,419 --> 00:20:48,179 making that first jump in but it doesn't 474 00:20:45,360 --> 00:20:50,460 quite bridge the gap well enough to do 475 00:20:48,179 --> 00:20:53,580 the jump out to the next stage which is 476 00:20:50,460 --> 00:20:56,400 taking on I guess pie game by itself and 477 00:20:53,580 --> 00:20:58,919 so teachers uh like I've been doing this 478 00:20:56,400 --> 00:21:01,080 a long time teachers that embrace race 479 00:20:58,919 --> 00:21:03,360 Pi game zero because look how easy it 480 00:21:01,080 --> 00:21:06,539 makes this stuff are going to need 481 00:21:03,360 --> 00:21:08,640 training and support to have those 482 00:21:06,539 --> 00:21:11,160 conversations with their students to 483 00:21:08,640 --> 00:21:13,320 bridge the gap to the next step and help 484 00:21:11,160 --> 00:21:16,919 them understand why there's some magic 485 00:21:13,320 --> 00:21:19,919 going on there and how much Magic 486 00:21:16,919 --> 00:21:21,360 I guess so there are some downsides we 487 00:21:19,919 --> 00:21:24,120 have a bunch of functions that are never 488 00:21:21,360 --> 00:21:26,520 called it obscures too much in some 489 00:21:24,120 --> 00:21:30,840 aspects and it makes the next step for 490 00:21:26,520 --> 00:21:32,280 novices very difficult but in conclusion 491 00:21:30,840 --> 00:21:33,360 whoops 492 00:21:32,280 --> 00:21:35,520 um 493 00:21:33,360 --> 00:21:39,299 uh yeah in conclusion I'll continue to 494 00:21:35,520 --> 00:21:40,679 use it but I I will be doing it with 495 00:21:39,299 --> 00:21:42,360 these conversations that I've already 496 00:21:40,679 --> 00:21:44,760 rehearsed with my students to make sure 497 00:21:42,360 --> 00:21:46,679 they understand that there's some stuff 498 00:21:44,760 --> 00:21:49,380 being done there for them 499 00:21:46,679 --> 00:21:51,620 and that is my GitHub if you want to go 500 00:21:49,380 --> 00:21:51,620 play 501 00:21:52,080 --> 00:21:56,580 thank you very much 502 00:21:54,190 --> 00:21:59,880 [Applause] 503 00:21:56,580 --> 00:22:01,919 thank you Amanda gaming I love it it 504 00:21:59,880 --> 00:22:03,659 certainly um is a way to engage our 505 00:22:01,919 --> 00:22:05,520 students do we have any questions out 506 00:22:03,659 --> 00:22:08,159 there 507 00:22:05,520 --> 00:22:09,840 oh they're all in all that's because I 508 00:22:08,159 --> 00:22:12,900 explained everything so well I know 509 00:22:09,840 --> 00:22:14,940 you're such an educator 510 00:22:12,900 --> 00:22:17,159 um and I I do think that you will have 511 00:22:14,940 --> 00:22:20,280 some conversations in the change over 512 00:22:17,159 --> 00:22:22,380 time with maybe Dr Allison who about the 513 00:22:20,280 --> 00:22:26,820 physics that your game does not hold yet 514 00:22:22,380 --> 00:22:28,980 and and the unrealistics of me yeah so 515 00:22:26,820 --> 00:22:31,559 who whoever said that science and gaming 516 00:22:28,980 --> 00:22:33,900 doesn't ever overlap it really does so 517 00:22:31,559 --> 00:22:35,039 I'd like to say thank you Amanda well we 518 00:22:33,900 --> 00:22:36,299 um 519 00:22:35,039 --> 00:22:38,640 um and there'll be a very short break 520 00:22:36,299 --> 00:22:40,919 while we mic up our next victim guest 521 00:22:38,640 --> 00:22:42,840 star thank you very much for this and 522 00:22:40,919 --> 00:22:46,679 congratulations on being one of the very 523 00:22:42,840 --> 00:22:50,280 only times that we we we let the border 524 00:22:46,679 --> 00:22:52,320 between uh organizer and presenter but 525 00:22:50,280 --> 00:22:54,650 obviously very well worth it so thank 526 00:22:52,320 --> 00:22:59,939 you very much again 527 00:22:54,650 --> 00:22:59,939 [Applause]