Arcade Documentation Release 2021

Arcade Documentation Release 2021

Arcade Documentation Release 2021 Paul Vincent Craven Sep 22, 2021 CONTENTS 1 Chapters 3 1.1 Foreword.................................................3 1.2 Setting Up Your System.........................................5 1.3 Version Control Systems.........................................7 1.4 The Print Function............................................ 18 1.5 How to Draw with Your Computer.................................... 27 1.6 What is a Programming Language?................................... 47 1.7 Variables and Expressions........................................ 53 1.8 Creating Functions............................................ 62 1.9 Drawing With Functions......................................... 77 1.10 If Statements............................................... 86 1.11 For Loops................................................. 98 1.12 While Loops............................................... 107 1.13 Random Numbers............................................ 111 1.14 Advanced Looping............................................ 116 1.15 Introduction to Lists........................................... 124 1.16 Classes, Constructors, and Attributes.................................. 137 1.17 Class Methods.............................................. 149 1.18 Using the Window Class......................................... 163 1.19 User Control............................................... 171 1.20 Sound Effects............................................... 185 1.21 Sprites And Collisions.......................................... 188 1.22 Moving Sprites.............................................. 202 1.23 Debugging Programs........................................... 215 1.24 Using Sprites to Shoot.......................................... 224 1.25 Sprites and Walls............................................. 235 1.26 Libraries and Modules.......................................... 253 1.27 Searching................................................. 270 1.28 Array-Backed Grids........................................... 287 1.29 Platformers................................................ 297 1.30 Sorting.................................................. 297 1.31 Exceptions................................................ 303 1.32 String Formatting............................................. 308 1.33 Recursion................................................. 319 1.34 Virtual Environments In PyCharm.................................... 336 2 Labs 341 2.1 Lab 1: First Program........................................... 341 2.2 Lab 2: Draw a Picture.......................................... 342 2.3 Lab 3: Drawing with Functions..................................... 346 i 2.4 Lab 4: Camel............................................... 348 2.5 Lab 5: Loopy Lab............................................ 353 2.6 Lab 6: Text Adventure.......................................... 358 2.7 Lab 7: User Control........................................... 363 2.8 Lab 8: Sprites.............................................. 365 2.9 Lab 9: Sprites and Walls......................................... 366 2.10 Lab 10: Spell Check........................................... 367 2.11 Lab 11: Array-Backed Grids....................................... 369 2.12 Lab 12: Final Lab............................................ 372 2.13 Quantitative Reasoning Reflection.................................... 376 3 Languages 377 ii Arcade Documentation, Release 2021 Learn to program in the Python computer language by creating 2D video games with the Arcade library. CONTENTS 1 Arcade Documentation, Release 2021 2 CONTENTS CHAPTER ONE CHAPTERS 1.1 Foreword This book teaches programming through creating 2D video games. It covers all the standard topics in a normal first- semester college class, but the projects are games. Video games provide great visual feedback for your code. Further- more, programming can be fun. 3 Arcade Documentation, Release 2021 Programming is consistently one of the top paid skills that you can learn. It is also one of the most flexible majors you can get. You can take your programming skills to almost any industry, and any location. Even if programming isn’t going to be your main job, as a skill it can still enhance your career. Need an interactive website? Need to crunch sales numbers? What about automatically saving experiment data and graphing results? Maybe you want your home to automatically e-mail you if the garage door is left open? Learning programming, be able to do this and more. 1.1.1 Programming Is For Everyone With programming you get to create. Making beautiful graphics and designing programs is an art. Good design requires people from all walks of life, and that’s one of the reasons Apple was able to gain a foothold in the computing industry: Picasso had a saying. He said, “Good artists copy, great artists steal.” And we have always been shameless about stealing great ideas and I think part of what made the Macintosh great was that the people working on it were musicians and poets and artists and zoologists and historians who also happened to be the best computer scientists in the world. Steve Jobs in PBS’s “Triumph of the Nerds: The Rise of Accidental Empires” (1996) The artistry behind a program isn’t just how it looks, but how it is designed. How the interface between the human and the computer functions: Design is a funny word. Some people think design means how it looks. But of course, if you dig deeper, it’s really how it works. The design of the Mac wasn’t what it looked like, although that was part of it. Primarily, it was how it worked. Steve Jobs in Wired’s “The Next Insanely Great Thing” (1996) Programming requires all kinds of people. Successful programs require idea people, business people, project people, artists, subject-matter experts, testers, writers, and more. You may not have ever thought of yourself as a programmer, but you can be. 4 Chapter 1. Chapters Arcade Documentation, Release 2021 1.1.2 Programming Pays Well Search up “top paid majors” and you’ll see computer science is usually one of the best paying degrees you can get. In 2020 the National Association of Colleges and Employers (NACE) says that computer science majors are projected to have the highest starting salary. Payscale agrees, says computer science is second only to petroleum engineering. Learning to program is worth your time. 1.1.3 What Can You Create By The End Of The Course? Here are some videos of games students have created in prior semesters. Students who didn’t know any programming were able to create these games by the time they finished the semester. 1.2 Setting Up Your System Before you begin programming, we need to install a few things. Using a school computer? Yay! You may have these already installed. Still, read through this part, as you might need to set up your own system in the future. Getting a system set up and ready to program can be a bit frustrating. Don’t give up. Once you’ve got a system set up for programming you don’t need to think about it again. You can concentrate on the programming part. It is normal to get stuck during setup, so don’t hesitate to reach out and get help. 1.2.1 Setup the Programming Environment In this chapter we’ll show you how to: • Install an “IDE” to type in your programs. (We’ll use a program called PyCharm. You can use the community edition for free, or if you have an email address that ends in .edu get can get a free student license for the professional version.) • Install the Python programming language. • A minor configuration tweak so we can see file extensions. In the next chapter we’ll cover: • A version control system to track and turn in your work. (Git) • Setup with the Arcade code library and a template project. Let’s go through these items in detail. 1.2. Setting Up Your System 5 Arcade Documentation, Release 2021 Installing an IDE We need an editor. Python comes with an editor called IDLE, but it is awful and not worth using. We’ll use an editor called PyCharm. PyCharm is a powerful program that lets you do more than just edit the program, it also includes a large set of tools that programmers need. This type of environment is called an Integrated Development Environment, or IDE for short. Download and install PyCharm. You can use their community edition for free. We won’t use the features in the professional edition. If you decide to pick the professional edition anyway, you’ll need a license to use it. But licenses are free for educational use! If you have an e-mail that ends in .edu you can ask for a student license. It can be used on a school computer, or on your own computer. Installing Python We will be using the “Python” computer programming language. (We’ll learn more about what a computer language is in the What is a Programming Language? chapter. Also, the creator of Python was a fan of Monty Python, hence the name.) Download Python from the official Python website: https://www.python.org/downloads/ When installing Python, make sure to add Python to the path (1) before clicking the Install button (2). 6 Chapter 1. Chapters Arcade Documentation, Release 2021 After that, you can just close the dialog. There’s no need to increase the path length, although it doesn’t hurt anything if you do. 1.2.2 Viewing File Extensions It is a great idea to change your windows configuration to show file extensions. A file usually has a name likeBook report.docx where the .docx tells the computer it is a Microsoft Word compatible document. By default Windows hides the .docx

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    381 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us