Loading [MathJax]/extensions/mml2jax.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

Search

  • Filter Results
  • Location
  • Classification
    • Article type
    • Author
    • Set as Cover Page of Book
    • License
    • Show TOC
    • Transcluded
    • OER program or Publisher
    • Autonumber Section Headings
    • License Version
    • Print CSS
  • Include attachments
Searching in
About 2812 results
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/06%3A_Simulate/00%3A_Front_Matter/01%3A_TitlePage
    6: Simulate
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/02%3A_Installing_Python_and_Pygame/zz%3A_Back_Matter/10%3A_Index
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/01%3A_Introduction/1.01%3A_Who_Is_This_Book_For
    This book is for the intermediate programmer who has learned what variables and loops are, but now wants to know, "What do actual game programs look like" There was a long gap after I first learned pr...This book is for the intermediate programmer who has learned what variables and loops are, but now wants to know, "What do actual game programs look like" There was a long gap after I first learned programming but didn’t really know how to use that skill to make something cool.
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/09%3A_Squirrel_Eat_Squirrel/9.05%3A_Describing_the_Data_Structures
    Player data structure keys: 'surface' - the pygame.Surface object that stores the image of the squirrel which will be drawn to the screen. 'facing' - either set to LEFT or RIGHT, stores which directio...Player data structure keys: 'surface' - the pygame.Surface object that stores the image of the squirrel which will be drawn to the screen. 'facing' - either set to LEFT or RIGHT, stores which direction the player is facing. 'size' - the width and height of the player in pixels. (The width & height are always the same.) 'bounce' - represents at what point in a bounce the player is in.
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/09%3A_Squirrel_Eat_Squirrel/9.30%3A_Backwards_Compatibility_with_Python_Version_2
    However, in Python version 2, the / division operator will only evaluate to a floating point value if one of the operands is also a floating point value. But if we always convert one of the values to ...However, in Python version 2, the / division operator will only evaluate to a floating point value if one of the operands is also a floating point value. But if we always convert one of the values to a floating point value with the float() function, then the division operator will evaluate to a float value no matter which version of Python runs this source code.
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/09%3A_Squirrel_Eat_Squirrel/9.12%3A_Keeping_Track_of_the_Location_of_Things_in_the_Game_World
    grassObjs = [] # stores all the grass objects in the game squirrelObjs = [] # stores all the non-player squirrel objects # stores the player object: playerObj = {'surface': pygame.transform.scale(L_SQ...grassObjs = [] # stores all the grass objects in the game squirrelObjs = [] # stores all the non-player squirrel objects # stores the player object: playerObj = {'surface': pygame.transform.scale(L_SQUIR_IMG, (STARTSIZE, STARTSIZE)), 'facing': LEFT, 'size': STARTSIZE, 'x': HALF_WINWIDTH, 'y': HALF_WINHEIGHT, 'bounce':0, 'health': MAXHEALTH} The grassObjs variable holds a list of all the grass objects in the game.
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/zz%3A_Back_Matter
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/03%3A_Pygame_Basics/3.13%3A_Rect_Objects
    For example, if you need to know the X coordinate of the right edge of the pygame.Rect object we stored in the spamRect variable, you can just access the Rect object’s right attribute: The Pygame code...For example, if you need to know the X coordinate of the right edge of the pygame.Rect object we stored in the spamRect variable, you can just access the Rect object’s right attribute: The Pygame code for the Rect object automatically calculated that if the left edge is at the X coordinate 10 and the rectangle is 200 pixels wide, then the right edge must be at the X coordinate 210. The int value of the X-coordinate of the left side of the rectangle.
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/05%3A_Slide_Puzzle/5.10%3A_%E2%80%9CEqual_To_One_Of%E2%80%9D_Trick_with_the_in_Operator
    It is a way of saying "evaluate to True if event.key is equal to one of K_LEFT or K_a". The following two expressions will evaluate the exact same way: You can really save on some space by using this ...It is a way of saying "evaluate to True if event.key is equal to one of K_LEFT or K_a". The following two expressions will evaluate the exact same way: You can really save on some space by using this trick when you have to check if a value is equal to one of multiple values. spam == 'dog' or spam == 'cat' or spam == 'mouse' or spam == 'horse' or spam == 42 or spam == 'dingo' spam in ('dog', 'cat', 'mouse', 'horse', 42, 'dingo')
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/05%3A_Slide_Puzzle/zz%3A_Back_Matter/10%3A_Index
  • https://eng.libretexts.org/Bookshelves/Computer_Science/Programming_Languages/Making_Games_with_Python_and_Pygame_(Sweigart)/04%3A_Memory_Puzzle/4.18%3A_The_Game_Loop
    On each iteration of the game loop in the Memory Puzzle program, the mouseClicked variable stores a Boolean value that is True if the player has clicked the mouse during this iteration through the gam...On each iteration of the game loop in the Memory Puzzle program, the mouseClicked variable stores a Boolean value that is True if the player has clicked the mouse during this iteration through the game loop. (This is part of keeping track of the game state.) The program then calls drawBoard() to draw the current state of the board based on the board and "revealed boxes" data structures that we pass it. (These lines of code are part of drawing and updating the screen.)

Support Center

How can we help?