Download presentation
Presentation is loading. Please wait.
Published byCharlene Ferguson Modified over 9 years ago
1
Copy, paste, amend This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open myEtchASketch.py in IDLE 3.Check you have the code below: 4.Copy and paste the whole function and try to amend it to create a p1_move_S(self) function. ##### Functions: # player controls def p1_move_N(self): global p1_y canvas.create_line(p1_x, p1_y, p1_x, (p1_y-line_length), width=line_width, fill=p1_colour) p1_y = p1_y - line_length
2
Lesson Aims [ slide 2 ] In this lesson you are going to: 1.practise writing functions 2.practise using tkinter’s lines widget 3.review how to add keyboard control to your game 4.finish the MyEtchASketch game 5.Open and customise a free two player Etch A Sketch® game
3
Finishing Off [ slide 3 ] 1.Check your code for p1_move_N(self) is correct by looking at Code Box 5.4 on page 68 in Python Basics 2.Copy all the missing code from Code Box 5.4 into your Etch A Sketch® app 3.Test it out and make sure it works. Top Tip: There are four very similar functions supplied. It is quickest to copy the first function three more times and then amend it. Whenever a coder keeps copying and pasting it hints that there is probably a better way of doing things.
4
What now? [ slide 4 ] Try the Quick Ideas on page 70 1 Try the Puzzle on page 71 (this is quite difficult). 2 Get ourEtchASketch.py from the source code folder and try some of the Extra ideas on page 72 3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.