Level 4: Online Articles - IncrediCoders/Python1 GitHub Wiki
SideWinder added this page on June 6, 2023
Here are some more Online Articles that will help with Elif, Key Events, and Moving/Rotating Sprites. You can skip down to these sections on the page:
More About Elif Statements
-
Python Elif - 365datascience.com - This site give an in depth description of the definition of elif as well as the different code commands for elif. It also provides coded examples using these code commands, as well as displaying the output of the program.
-
Python Elif Statement - tutorialgateway.org - This page goes into detail about the syntax of the elif statement. It describes what can be put after "elif" and it describes what happens when that event is true and false. It also provides coded examples using elif statements.
-
Python Elif - tutorialandexample.com - This page gives a brief description and definition of what elif is as well as the different code commands. Then, it displays diagrams of the process of how elifs work with coded examples below each diagram using the elif code commands.
-
Python Elif Example - pythonexamples.org - This page gives a brief description of what elif is, as well as the syntax used and needed to write elif statements. Then, it gives coded examples using these code commands and describes the output of each program as well as alternate outputs when the code is changed.
-
Python If-Else - tutorialspoint.com - This site describes what elif code commands are and how they can be used. Then, it displays diagrams of the process of the elif statements, as well as coded examples that show the diagram being used in an actual program.
-
Python If, Elif, Else Statements - pythonforbeginners.com - This page gives a definition for elif statements, as well as describing how it is used with if and else statements. Then, it gives examples of all three of these statements used together in a coded example.
-
If-Elif-Else Python - datatofish.com - This page gives a definition for elif statements, as well as describing the different code commands used for all three of these statements (if, else, and elif). Then, it gives coded examples of elif statements using the correct syntax and describing what the output means.
Elif Videos
-
Python 3: If Elif Else - sentdex - In this video, he describes what if and elif statements are, as well as if-else and elif statements. He also provides detailed coded examples in Python programs of these different statements, and describes what each of the commands mean and the output.
-
If Elif Else Statements in Python - Telusko - In this video, he gives a definition for If, Elif, and Else statements and how they are used in Python. Then, he gives coded examples of each of these different statements and describes what each command means.
-
If/Elif/Else Tutorial - TechWithTim - In this video, he describes how to use the if, elif and else keywords in python make decisions. He then provides written out coded examples of each of these three statements, describing what each of the steps mean in the overall program.
Elif Examples
-
Python Elif - w3schools.com - This page starts with a brief description of what an elif statement is. Then, it gives coded examples with varying amounts of lines, as well as the output of the program and a description of the different parts of the program, as well as the meaning of the output.
-
Python If-Else - tutorialspoint.com - This site describes what elif code commands are and how they can be used. Then, it displays diagrams of the process of the elif statements, as well as multiple coded examples that show the diagram being used in an actual program.
More About Key Events
-
Keyboard events - pythonhosted.org - This site gives you the different commands that are considered "key events" where a key is pressed. It also goes more in depth than the challenges for this course talking about modifiers and how they interact with key events.
-
Pygame.key - pygame.org - This site gives you a list of all the different pygame.key commands that can be used in Python. Then, after the list, it describes what pygame.key means and where it can and should be used in code. Then, there are examples of some of the ways that pygame.key can be used.
-
Keyboard Input Events - coderslegacy.com - This site gives an in depth description of the different aspects of a key being pressed and the code that can be used to make that command. It also gives examples of code for each of those aspects and how it looks written out.
-
Pygame Programming - nerdparadise.com - This site gives a description of a few of the key event commands, as well as a brief description about what they mean. Then, at the bottom there is an example of the key events described used in a code example as well as other key events.
Key Event Videos
-
Keyboard Event Binding - Codemy.com - In this video, he explains that binding allows us to grab keyboard and mouse events. Then, he shows how to do keyboard event binding using written out coded examples that he takes step by step and explains what each part means.
-
Python GUI Keyboard Events - BroCode - In this video, he gives a basic tutorial for Python key bind events using tkinter and also GUI. He then provides examples using tkinter of keyboard events, and describes what each of the steps of the process does to the overall program.
-
Python Keyboard Press and Events - TechWithTim - In this video, he uses turtle graphics to make statements for keyboard presses. He then describes that the turtle graphics module has built in functionality to listen to events and detect key presses and he shows examples of this in a Python program.
-
Python Detect Keypresses - CoderGautam - This video describes an easier way to detect key presses in Python. He also describes how to use the "keyboard" module, and provides examples of these different concepts in an actual written coded example using Python code.
Key Event Examples
-
Pygame.KEYDOWN Example - programcreek.com - This site gives an example of specifically the pygame.KEYDOWN function, and the code commands that work for that function. However, there are other examples as well that use other key event commands.
-
Pygame.KEYUP Example - programcreek.com - This site is the same as the previous link, this one focuses on the pygame.KEYUP command. However, just like the last one, there are other key events that are used as examples throughout the site as well.
More About Moving/Rotating Sprites
-
Rotating/Moving Sprite - stackoverflow.com - This pages answers a question about moving and rotating a sprite. The answer is a coded example using the code commands for moving and rotating a sprite. Make sure you look at the answer, and not the question, in the answer, each part is important for moving or rotating the sprite.
-
Python Sprite Moving - python-forum.io - This site gives a specific example of the coding commands used to write out a program that moves the sprite. Above the program, there is a brief description of what the code does, or the output of it, and also which parts specifically refer to moving and rotating the sprite.
-
Rotating a Sprite - daniweb.com - This site gives you a brief description of the code commands used to move and rotate a sprite. Then, there is a coded example of the different code commands that were described, making one large program that moves but more specifically focuses on rotating the sprite.
-
Moving Sprites in Python - csteach488.github.io - This page gives an in depth description on the different parts of moving and rotating sprites. It gives examples of written code examples in between definitions that describe each of the parts that were described in the previous definition.
-
Asteroids Game Python - realpython.com - This sites starts with a brief description of how to move and rotate a sprite. Then, it gives an example of a coded asteroid game. Not all of the lines are about moving and rotating the sprite, but read through it and see if you can pick out the lines that do relate to moving and rotating the sprite.
Moving/Rotating Sprites Videos
-
Move a Sprite - GiovanniPythno - IN this video, he provides several examples on how to move your sprite in Python. He describes both the directions and the angle commands that can be used, and provides written out coded examples of several of these commands and show what they do to the sprite.
-
Rotating Sprites - ClearCode - In this video, he mainly describes how to rotate and object or image in pygame. He then takes an image of Pikachu and uses both pygame.transform.rotate and pygame.transform.rotozoom to rotate it around its own center using those pygame functions.
-
Rotating Player Sprite - KidCanCode - In this video, he shows how to implement rotation for the player sprite, and also handle how this affects our wall collision code. He then shows coded examples of these concepts, showing step by step what certain commands do to the overall program.
-
Centering Images and Clean Rotation - DaFluffyPotato - In this video, he explains that centering is how you get clean rotations in pygame with the weird image resizing pygame does when you rotate an image. He says that in general, centering is useful for a bunch of stuff.
Moving/Rotating Sprites Examples
-
Sprite Move Angle - arcade.academy - This site specifically looks at rotating your sprite on or at an angle. It gives you an example of the code commands used to rotate a sprite, as well as move that sprite around. You can run the code and see what each of the commands do for the sprite.
-
Sprite Collect Rotating- api.aracade.academy - This site give shows a full program on how to move and rotate sprites. There is the written out code of the program at the bottom, and the top graphic displays what the code does to the program.
Next Steps
Next, you can take on the two extra challenges to add to your Space Wars program and learn more! When you're done, you can move on to Level 5, the Creeper Chase!
Take the Challenges!
-
Challenge 1: In this challenge, you are going to write more code on the SpaceWars.py file!
-
Challenge 2: In this challenge, you are going to write code that will allow two players to play the Space Wars game together!
More Level 4 Resources
In addition to this Online Articles page and the instructions for our Level 4 challenges, we also have a Help Page, a Learning Quiz, an Unplugged Activity, and a Rewards article:
-
Level 4: Help - This page helps you complete the instructions in the book, in case you get stuck.
-
Level 4: Learning Quiz - I wrote some questions in case you want to quiz yourself about what you learned. Or you can teach others and quiz them!
-
Level 4: Unplugged Activity - I wrote this page with more details than what you saw in the book. In this game,
-
Level 4: Rewards - If you completed the Space Wars project that we talked about, then I set up this page to act as a reward. You can see some illustrations of me and learn more about who I am! You'll also find the **WHAT **Award digital download, to show off your accomplishment!
Level 5
After you're completely done with Level 4 (did you do the challenges?), then it's time to move on to Level 5! While you read through Level 5 in your book, you can check out the resources from Intelli-Scents, as she teaches you how to build the Creeper Chase program:
I hope you had fun learning about space wars!
-- SideWinder