Introduction to Game Programming Lesson 5 Lecture Notes, Part 1: The draw Module
|
|
- Alexandra Parsons
- 6 years ago
- Views:
Transcription
1 Introduction to Game Programming Lesson 5 Lecture Notes, Part 1: The draw Module Learning Objectives: Following this lecture, the student should be able to: Draw a line with pygame, using all parameters and variations correctly. Draw a rectangle with pygame, using all parameters and variations correctly. Draw a circle with pygame, using all parameters and variations correctly. Draw an ellipse with pygame, using all parameters and variations correctly. Draw an arc with pygame, using all parameters and variations correctly. Define radians and be able to draw the angles on a circle defined by 0,pi, pi/2,pi/4,5pi/4,3pi/2, and 7pi/4. Draw a series of lines with pygame, using all parameters and variations correctly. Draw a polygon with pygame, using all parameters and variations correctly. Draw an anti-aliased line with pygame, using all parameters and variations correctly. List two disadvantages of anti-aliased lined. List an advantage of anti-aliased lines. Motivation Once again we're going to work with Pygame. This chapter covers two very important subjects: drawing and event-handling. We'll see how to draw shapes on the screen and also how to get and respond to input from the user that comes from both the keyboard and the mouse. Bring up and run drawdemo.py. Drawing This program draws a bunch of junk on the screen. What i the junk? We have a line, a rectangle, a circle, an arc, an ellipse, some lines that form an H and i (sor tof), a polygon, and then normal and antialiased diagonal lines. Look at the code So let's look at the code. In addition to importing pygame, we import math. We're going to need the constant math.pi when we draw the arc. Let's look at this line: def drawstuff(background): Cold call What is happening in that line? Defining a function Cold call And what is background? A parameter; probably a Surface Right, so here he defines a function. He's encapsulating all of his drawing in one place. He's passing in a parameter called background. Copyright 2010 Margaret Burke. All rights reserved. 1
2 And if we look at the code inside, we can see he's passing that as a parameter to a lot of pygame.draw methods. If we go to the pygame docs, then maybe we can figure out what kind of variable background is. Go to pygame documentation, look at draw.line or draw.rect. Cold call Can you tell me what type Surface background is, based on its order in the parameter list and this documentation? Cold call What else is there, what else is being Depends on the method. passed in? Cold call What does this mean, this parameter with the equals sign and a value? It's a default, the parameter is optional. Now presumably this function is called from somewhere, because we know that the drawing does take place. Let s focus on how the function works, then we ll go down and look at the code that calls it. This function basically shows us almost every single method in pygame.draw. We will go over them one at a time. (Go over each bit of code by looking at the code, then looking at docs, then experimenting with code. #draw a line from (5, 100) to (100, 100) pygame.draw.line(background, (255, 0, 0), (5, 100), (100, 100)) From docs (or note, you can type in >>>import pygame >>>help(pygame.draw.line)): pygame.draw.line draw a straight line segment pygame.draw.line(surface, color, start_pos, end_pos, width=1): return Rect Draw a straight line segment on a Surface. There are no endcaps, the ends are squared off for thick lines. Experiment: Cold call How would we draw a blue line from the upper left corner of the screen to the bottom right? Reading docs, using the function Copyright 2010 Margaret Burke. All rights reserved. 2
3 #draw an unfilled square pygame.draw.rect(background, (0, 255, 0), ((200, 5), (100, 100)), 3) pygame.draw.rect draw a rectangle shape pygame.draw.rect(surface, color, Rect, width=0): return Rect Draws a rectangular shape on the Surface. The given Rect is the area of the rectangle. The width argument is the thickness to draw the outer edge. If width is zero then the rectangle will be filled. Keep in mind the Surface.fill - fill Surface with a solid color method works just as well for drawing filled rectangles. In fact the Surface.fill - fill Surface with a solid color can be hardware accelerated on some platforms with both software and hardware display modes. Experiment: Cold call How would we draw a red filled rectangle that fills the upper quarter of the screen? Reading docs, using the function #draw a filled circle pygame.draw.circle(background, (0, 0, 255), (400, 50), 45) pygame.draw.circle draw a circle around a point pygame.draw.circle(surface, color, pos, radius, width=0): return Rect Draws a circular shape on the Surface. The pos argument is the center of the circle, and radius is the size. The width argument is the thickness to draw the outer edge. If width is zero then the circle will be filled. Experiment: Cold call Can we draw a circle within the rectangle? Maybe a green circle with a thin border? Reading docs, using the function Okay, we re going to do the ellipse before the arc: #draw an ellipse pygame.draw.ellipse(background, (0xCC, 0xCC, 0x00), ((150, 150), (150, 100)), 0) pygame.draw.ellipse draw a round shape inside a rectangle pygame.draw.ellipse(surface, color, Rect, width=0): return Rect Copyright 2010 Margaret Burke. All rights reserved. 3
4 Draws an elliptical shape on the Surface. The given rectangle is the area that the circle will fill. The width argument is the thickness to draw the outer edge. If width is zero then the ellipse will be filled. So you can see how this is different from the circle, you specify a bounding rectangle. Experiment: Cold call Now can we draw an ellipse within the lower right rectangular quadrant, so diagonal to our other circle? Reading docs, using the function Now the arc. #draw an arc pygame.draw.arc(background, (0, 0, 0), ((5, 150), (100, 100)), 0, math.pi/2, 5) pygame.draw.arc draw a partial section of an ellipse pygame.draw.arc(surface, color, Rect, start_angle, stop_angle, width=1): return Rect Draws an elliptical arc on the Surface. The rect argument is the area that the ellipse will fill. The two angle arguments are the initial and final angle in radians, with the zero on the right. The width argument is the thickness to draw the outer edge. So this is similar to the ellipses in that you specify the rectangle, they both start Surface, color, Rect. But then there s start_angle and stop_angle, and this refers to radians. Radians are a measurement of angle that actually makes sense because it relates to the radius of the circle. There are 2π radians around any given circle (you might recognize that as the circumference formula). So a given angle is how far around the circumference you go for that angle. Copyright 2010 Margaret Burke. All rights reserved. 4
5 Experiment: Cold call Let s draw an ellipse along the edge of our circle, (from π/2 to π) show Reading docs, using the function them, don t tell them the radians. Cold call From π to 2 π Cold call From π/4 to 3 π/4 #draw lines, points = ( (370, 160), (370, 237), (372, 193), Copyright 2010 Margaret Burke. All rights reserved. 5
6 (411, 194), (412, 237), (412, 160), (412, 237), (432, 227), (436, 196), (433, 230) ) pygame.draw.lines(background, (0xFF, 0x00, 0x00), False, points, 3) pygame.draw.lines draw multiple contiguous line segments pygame.draw.lines(surface, color, closed, pointlist, width=1): return Rect Draw a sequence of lines on a Surface. The pointlist argument is a series of points that are connected by a line. If the closed argument is true an additional line segment is drawn between the first and last points. This does not draw any endcaps or miter joints. Lines with sharp corners and wide line widths can have improper looking corners. You have a list of lists, each list is a point on the screen. So this is the way you specify a list of points. The draw.lines will draw from one point to the next, in order, starting with the first. I m going to let you experiment with this one on your own. #draw polygon points = ( (137, 372), (232, 319), (383, 335), (442, 389), (347, 432), (259, 379), (220, 439), (132, 392) ) pygame.draw.polygon(background, (0x33, 0xFF, 0x33), points) pygame.draw.polygon draw a shape with any number of sides pygame.draw.polygon(surface, color, pointlist, width=0): return Rect Draws a polygonal shape on the Surface. The pointlist argument is the vertices of the polygon. The width argument is the thickness to draw the outer edge. If width is zero then the polygon will be filled. For aapolygon, use aalines with the 'closed' parameter. I am also going to let you play with the polygon yourself. Copyright 2010 Margaret Burke. All rights reserved. 6
7 Now let s compare a line and an anti-aliased line. #compare normal and anti-aliased diagonal lines pygame.draw.line(background, (0, 0, 0), (480, 425), (550, 325), 1) pygame.draw.aaline(background, (0, 0, 0), (500, 425), (570, 325), 1) pygame.draw.line draw a straight line segment pygame.draw.line(surface, color, start_pos, end_pos, width=1): return Rect Draw a straight line segment on a Surface. There are no endcaps, the ends are squared off for thick lines. pygame.draw.aaline draw fine antialiased lines pygame.draw.aaline(surface, color, startpos, endpos, blend=1): return Rect Draws an anti-aliased line on a surface. This will respect the clipping rectangle. A bounding box of the affected area is returned returned as a rectangle. If blend is true, the shades will be be blended with existing pixel shades instead of overwriting them. This function accepts floating point values for the end points. Okay, and that s another one I m going to let you work on in the lab. Before you move to the lab, we re just going to go over the main program, because this is a little different from what we ve seen before: def main(): screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("drawing commands") background = pygame.surface(screen.get_size()) background = background.convert() background.fill((255, 255, 255)) drawstuff(background) clock = pygame.time.clock() keepgoing = True while keepgoing: clock.tick(30) for event in pygame.event.get(): if event.type == pygame.quit: keepgoing = False elif event.type == pygame.mousebuttonup: print pygame.mouse.get_pos() screen.blit(background, (0, 0)) pygame.display.flip() if name == " main ": main() pygame.quit() Copyright 2010 Margaret Burke. All rights reserved. 7
8 Okay, so now the main program is also a function. ALL of the code is now organized into functions, and this line at the bottom tells the Python interpreter that this isn t just a library of functions, but this is a program and execution should being at the function called main. So from now on you will organize your programs in this way. I want you to organize your programs like this from now on. The primary reason is so we can see where data is modified, because we will pass variables into and out of functions. And you should recognize this as setting up the display (initialize is at the very top), creating your entities, and then drawing onto the background by calling the drawstuff function. Then Time ad the event loop. It also has this helpful event loop code to check for a mouse click which will print the coordinates to the console. That can help you draw, because it helps get you figure out where various coordinates are in the window. They should work on the first lab. Copyright 2010 Margaret Burke. All rights reserved. 8
9 Introduction to Game Programming Lesson 5 Lecture Notes, Part 2: Fonts and Events Learning Objectives: Following this lecture, the student should be able to: Draw text with pygame using a Font object. Compare and contrast system vs. custom fonts and give the advantages and disadvantages to using each in a game. Import and save an image using pygame. Handle mouse events including MOUSEBUTTONDOWN, MOUSEBUTTONUP, and MOUSEMOTION. Get the location of the mouse. Handle keyboard events. Get the name of the key that has been pressed. Write event handlers to handle basic events. Motivation Before we get to events, we're going to look at some other pygame functionality that you'll need. First importing and saving images, and then drawing text using the Font object, which you'll need to display information to your user such as her score and any other message you want to include that's text. Bring up and run face.py. Free graphics editing software The GIMP is an open-source package you can download that has a lot of the functionality that Photoshop has. It is not as easy to use, but it's free. There's a link to it on the Downloads page of the class website. Importing images Okay, this is so simple. This is how you import an image that you have created in a graphics program such as Photoshop or The GIMP, or using a royalty-free image that has been generously provided by an artist for you to use. Open face.py Look at the following code: face = pygame.image.load("k-9_andy.jpg") face = face.convert() Looking at the docs, we can see that image.load returns a Surface: pygame.image.load load new image from a file pygame.image.load(filename): return Surface pygame.image.load(fileobj, namehint=""): return Surface Copyright 2010 Margaret Burke. All rights reserved. 9
10 Load an image from a file source. You can pass either a filename or a Python file-like object. Pygame will automatically determine the image type (e.g., GIF or bitmap) and create a new Surface object from the data. In some cases it will need to know the file extension (e.g., GIF images should end in ".gif"). If you pass a raw file-like object, you may also want to pass the original filename as the namehint argument. The returned Surface will contain the same color format, colorkey and alpha transparency as the file it came from. You will often want to call Surface.convert - change the pixel format of an image with no arguments, to create a copy that will draw more quickly on the screen. For alpha transparency, like in.png images use the convert_alpha() method after loading so that the image has per pixel transparency. Pygame may not always be built to support all image formats. At minimum it will support uncompressed BMP. If pygame.image.get_extended - test if extended image formats can be loaded returns 'True', you should be able to load most images( including png, jpg and gif ). And it is recommended to call Surface.convert to create a copy that will draw more quickly. Now note this about formats, from the docs: The image module is a required dependency of Pygame, but it only optionally supports any extended file formats. By default it can only load uncompressed BMP images. When built with full image support, the pygame.image.load - load new image from a file function can support the following formats. JPG PNG GIF (non animated) BMP PCX TGA (uncompressed) TIF LBM (and PBM) PBM (and PGM, PPM) XPM So this is loaded in "Entities," and the image file is in the same directory as the program. Saving images Now you can also save images, and this is described in the book. It's not the same as saving a game, it's just saving an image. So you can read about that in the book. The example is called savecircles.py. Copyright 2010 Margaret Burke. All rights reserved. 10
11 Creating a text Surface One thing you absolutely need to know how to do is create a text Surface so you can put information up in text form for your users. To do this, you will write to a Surface using a Font object. You can then blit your Surface to the background. So first, creating a font. We'll look at the following two examples: load showtext.py and customfont.py First, in showtext, go over this code with enhancement: fontlist = pygame.font.get_fonts() print fontlist if "comicsansms" in fontlist: myfont = pygame.font.sysfont("comic Sans MS", 30) else: myfont=pygame.font.sysfont("none",30) label = myfont.render("text is Fun!!!", True, (255, 255, 0)) A font is a typeface and size None- pygame default font render returns a Surface Boolean - antialiasing Optional background color after text color allows for quicker drawing if the background is solid In customfont: myfont = pygame.font.font("gringonights.ttf", 40) label = myfont.render("python in the Wild West", True, (255, 255, 0)) This is a true type file that you have in the directory with your program. This will ensure the font looks correct and renders the correct size for your game. Events Review what events are When an event happens, objects are created that store the status of the input devices, such as the coordinates of the mouse The gaming loop is basically an event loop Look at basicevents.py and also basiceventsenhanced.py Go over this code Note that the author gets even information from the device, this could be slightly different from the info at the time of the event (i.e. the mouse might have moved since the event was generated) Copyright 2010 Margaret Burke. All rights reserved. 11
12 So if you use event.dict (dictionary for an event), you will get information at the time of the event. Just ask the dictionary for what you want, for example for a MOUSEBUTTONUP, you get pos, button, you use event.dict['pos'] to get the position. Use event.dict to get modified keys (event.dict['mod']) and then you can bit shift, for example control is >>6 %2 and compare to 1 (so you're using the power of 2 there that corresponds to the key, shifting over to make it last, and then determining if it's even or odd) Or you can use the modifiers. See Info below Events: QUIT none ACTIVEEVENT gain, state KEYDOWN unicode, key, mod KEYUP key, mod MOUSEMOTION pos, rel, buttons MOUSEBUTTONUP pos, button MOUSEBUTTONDOWN pos, button JOYAXISMOTION joy, axis, value JOYBALLMOTION joy, ball, rel JOYHATMOTION joy, hat, value JOYBUTTONUP joy, button JOYBUTTONDOWN joy, button VIDEORESIZE size, w, h VIDEOEXPOSE none USEREVENT code KMOD constants: mod is the bitfield of KMOD_* constants: pygame.kmod_none 0 pygame.kmod_lshift 1 pygame.kmod_rshift 2 pygame.kmod_shift 3 pygame.kmod_lctrl 64 pygame.kmod_rctrl 128 pygame.kmod_ctrl 192 pygame.kmod_lalt 256 pygame.kmod_ralt 512 pygame.kmod_alt 768 pygame.kmod_lmeta 1024 pygame.kmod_rmeta 2048 pygame.kmod_meta 3072 pygame.kmod_num 4096 pygame.kmod_caps 8192 pygame.kmod_mode So if you bitwise and (&) with the constant and the modifiers, it will come out as the modifier if it's been pressed (demonstrate bitwise and). #checking to see if the left control modifier is pressed: ctrlpressed=event.dict['mod']>>6 if ctrlpressed%2==1: print "The left control is pressed." altpressed=event.dict['mod']>>8 Copyright 2010 Margaret Burke. All rights reserved. 12
13 if altpressed%2==1: print "The left alt is pressed." #using a different method to check the right control modifier: rightctrlpressed=pygame.kmod_rctrl&event.dict['mod'] if (rightctrlpressed==pygame.kmod_rctrl): print "The right control is pressed." We can look at the paint.py program now, and see how event handling is incorporated into a larger program. Note that a function can be written to handle any given event to make the code easier to read. Bring up paint.py Copyright 2010 Margaret Burke. All rights reserved. 13
Introduction to Game Programming Lesson 4 Lecture Notes
Introduction to Game Programming Lesson 4 Lecture Notes Learning Objectives: Following this lecture, the student should be able to: Define frame rate List the factors that affect the amount of time a game
More informationPYTHON NOTES (drawing.py and drawstuff.py)
PYTHON NOTES (drawing.py and drawstuff.py) INTRODUCTION TO PROGRAMMING USING PYGAME STEP 1: Importing Modules and Initialization All the Pygame functions that are required to implement features like graphics
More informationCHAPTER 1. Command Arguments Description Example. Prints something to the console. A value can be text in quotes or a variable name.
GAME PROGRAMMING L LINE These are the tokens from the end of each chapter of Game Programming, the L Line I ve recombined these charts into one handy document you can and use as a reference. Thanks to
More informationThere s already a ton of code written called libraries that we can use by importing. One that we use often is random
There s already a ton of code written called libraries that we can use by importing. One that we use often is random import random print random.randint(2, 22) Random frequently used methods Name Use random.randint(a,
More informationPyGame Unit ?
PyGame Unit 1 1.1 1.? 1.1 Introduction to PyGame Text Book for Python Module Making Games With Python and PyGame By Al Swiegert Easily found on the Internet: http://inventwithpython.com/pygame/chapters
More informationPygame In a Few Minutes
Pygame In a Few Minutes By: Paul W. Yost Updated: 22 January 2016 Using Pygame: To use pygame, it must be imported and then initialized. import pygame pygame.init() # load the module # must be initialized
More information1 Getting started with Processing
cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For
More informationappend() function, 66 appending, 65, 97, 296 applications (apps; programs), defined, 2, 296
Index Note: Page numbers followed by f, n, or t indicate figures, notes, and tables, respectively. Symbols += (addition and assignment operator), 100, 187 + (addition operator), \ (backslash), 240 / (division
More information""" idea.py simplest possible pygame display demonstrates IDEA / ALTER model Andy Harris, 5/06 """
""" idea.py simplest possible pygame display demonstrates IDEA / ALTER model Andy Harris, 5/06 """ #I - Import and initialize import pygame pygame.init() #D - Display configuration screen = pygame.display.set_mode((640,
More informationPaint Tutorial (Project #14a)
Paint Tutorial (Project #14a) In order to learn all there is to know about this drawing program, go through the Microsoft Tutorial (below). (Do not save this to your folder.) Practice using the different
More information2 Working with Selections
2 Working with Selections Learning how to select areas of an image is of primary importance you must first select what you want to affect. Once you ve made a selection, only the area within the selection
More informationIntroduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons
Introduction To Inkscape Creating Custom Graphics For Websites, Displays & Lessons The Inkscape Program Inkscape is a free, but very powerful vector graphics program. Available for all computer formats
More informationScalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox
SVG SVG Scalable Vector Graphics (SVG) is an XML-based vector image format for twodimensional graphics with support for interactivity and animation. The SVG specification is an open standard developed
More informationslide 1 gaius Python Classes you can use theclass keyword to create your own classes here is a tiny example of a class
Python Classes slide 1 you can use theclass keyword to create your own classes here is a tiny example of a class Python Classes slide 2 tinyclass.py #!/usr/bin/python import math class vector: def init
More informationAdobe Photoshop How to Use the Marquee Selection Tools
Adobe Photoshop How to Use the Marquee Selection Tools In Photoshop there are various ways to make a selection and also various reasons why you'd want to make a selection. You may want to remove something
More informationIntroduction to Flash - Creating a Motion Tween
Introduction to Flash - Creating a Motion Tween This tutorial will show you how to create basic motion with Flash, referred to as a motion tween. Download the files to see working examples or start by
More informationPaint/Draw Tools. Foreground color. Free-form select. Select. Eraser/Color Eraser. Fill Color. Color Picker. Magnify. Pencil. Brush.
Paint/Draw Tools There are two types of draw programs. Bitmap (Paint) Uses pixels mapped to a grid More suitable for photo-realistic images Not easily scalable loses sharpness if resized File sizes are
More informationHow to create shapes. Drawing basic shapes. Adobe Photoshop Elements 8 guide
How to create shapes With the shape tools in Adobe Photoshop Elements, you can draw perfect geometric shapes, regardless of your artistic ability or illustration experience. The first step to drawing shapes
More informationEXCODE. Code An App From Scratch
3 EXCODE Code An App From Scratch Course Overview Weeks 1-2 Learning Python Weeks 3-5 Creating your game Week 6 Presenting the games Get the course notes exeterentrepreneurs.com/excode-content exeterentrepreneurs.com/excode-content/
More informationThe figures below are all prisms. The bases of these prisms are shaded, and the height (altitude) of each prism marked by a dashed line:
Prisms Most of the solids you ll see on the Math IIC test are prisms or variations on prisms. A prism is defined as a geometric solid with two congruent bases that lie in parallel planes. You can create
More informationpygame Lecture #5 (Examples: fruitgame)
pygame Lecture #5 (Examples: fruitgame) MOUSE INPUT IN PYGAME I. Detecting Mouse Input in pygame In addition to waiting for a keyboard event to precipitate some action, pygame allows us to wait for a mouse
More informationOn the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW
STAROFFICE 8 DRAW Graphics They say a picture is worth a thousand words. Pictures are often used along with our words for good reason. They help communicate our thoughts. They give extra information that
More informationCreating Vector Shapes Week 2 Assignment 1. Illustrator Defaults
Illustrator Defaults Before we begin, we are going to make sure that all of us are using the same settings within our application. For this class, we will always want to make sure that our application
More informationAnimations involving numbers
136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive
More informationThe options for both the Rectangular and Elliptical Marquee Tools are nearly identical.
Moon Activity Drawing Circular Selections The Elliptical Marquee Tool also allows us to easily draw selections in the shape of a perfect circle. In fact, just as we saw with the Rectangular Marquee Tool
More informationCorel Draw 11. What is Vector Graphics?
Corel Draw 11 Corel Draw is a vector based drawing that program that makes it easy to create professional artwork from logos to intricate technical illustrations. Corel Draw 11's enhanced text handling
More informationHonors Computer Science Python Mr. Clausen Program 7A, 7B
Honors Computer Science Python Mr. Clausen Program 7A, 7B PROGRAM 7A Turtle Graphics Animation (100 points) Here is the overview of the program. Use functions to draw a minimum of two background scenes.
More informationAdobe Photoshop CS2 Reference Guide For Windows
This program is located: Adobe Photoshop CS2 Reference Guide For Windows Start > All Programs > Photo Editing and Scanning >Adobe Photoshop CS2 General Keyboarding Tips: TAB Show/Hide Toolbox and Palettes
More informationHow to draw and create shapes
Adobe Flash Professional Guide How to draw and create shapes You can add artwork to your Adobe Flash Professional documents in two ways: You can import images or draw original artwork in Flash by using
More information1 Getting started with Processing
cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For
More informationPart 7 More fill styles and an effect
Part 7 More fill styles and an effect Introduction To break the uniformity of the grass fill style, this part will continue creating fill styles and adding sheets show how to copy fill styles show how
More informationAdobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand
Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand Photoshop is the software for image processing. With this you can manipulate your pictures, either scanned or otherwise inserted to a great extant.
More informationArea rectangles & parallelograms
Area rectangles & parallelograms Rectangles One way to describe the size of a room is by naming its dimensions. So a room that measures 12 ft. by 10 ft. could be described by saying its a 12 by 10 foot
More informationVideo Games. Writing Games with Pygame
Video Games Writing Games with Pygame Special thanks to Scott Shawcroft, Ryan Tucker, and Paul Beck for their work on these slides. Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0
More informationSNOWFLAKES PHOTO BORDER - PHOTOSHOP CS6 / CC
Photo Effects: Snowflakes Photo Border (Photoshop CS6 / CC) SNOWFLAKES PHOTO BORDER - PHOTOSHOP CS6 / CC In this Photoshop tutorial, we ll learn how to create a simple and fun snowflakes photo border,
More informationUnit 21 - Creating a Navigation Bar in Macromedia Fireworks
Unit 21 - Creating a Navigation Bar in Macromedia Fireworks Items needed to complete the Navigation Bar: Unit 21 - House Style Unit 21 - Graphics Sketch Diagrams Document ------------------------------------------------------------------------------------------------
More informationGraphics (Output) Primitives. Chapters 3 & 4
Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area
More informationDrawing a Circle. 78 Chapter 5. geometry.pyde. def setup(): size(600,600) def draw(): ellipse(200,100,20,20) Listing 5-1: Drawing a circle
5 Transforming Shapes with Geometry In the teahouse one day Nasrudin announced he was selling his house. When the other patrons asked him to describe it, he brought out a brick. It s just a collection
More information8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2) Horizontal Rule Element
Web Development & Design Foundations with HTML5 Ninth Edition Chapter 4 Visual Elements and Graphics Learning Objectives (1 of 2) 4.1 Create and format lines and borders on web pages 4.2 Apply the image
More informationCS 160: Lecture 10. Professor John Canny Spring 2004 Feb 25 2/25/2004 1
CS 160: Lecture 10 Professor John Canny Spring 2004 Feb 25 2/25/2004 1 Administrivia In-class midterm on Friday * Closed book (no calcs or laptops) * Material up to last Friday Lo-Fi Prototype assignment
More informationLearning to use the drawing tools
Create a blank slide This module was developed for Office 2000 and 2001, but although there are cosmetic changes in the appearance of some of the tools, the basic functionality is the same in Powerpoint
More informationCustom Shapes As Text Frames In Photoshop
Custom Shapes As Text Frames In Photoshop I used a background for this activity. Save it and open in Photoshop: Select Photoshop's Custom Shape Tool from the Tools panel. In the custom shapes options panel
More informationSomeone else might choose to describe the closet by determining how many square tiles it would take to cover the floor. 6 ft.
Areas Rectangles One way to describe the size of a room is by naming its dimensions. So a room that measures 12 ft. by 10 ft. could be described by saying its a 12 by 10 foot room. In fact, that is how
More informationPart 1: Basics. Page Sorter:
Part 1: Basics Page Sorter: The Page Sorter displays all the pages in an open file as thumbnails and automatically updates as you add content. The page sorter can do the following. Display Pages Create
More informationCreating or enlarging a hole in the center of a kaleidoscope (Paint Shop Pro)
TM Kaleidoscope Kreator Tutorial Series Creating or enlarging a hole in the center of a kaleidoscope (Paint Shop Pro) There may be times when you want to create (or enlarge) a hole in the center of a kaleidoscope:
More information2D & 3D CAD SOFTWARE USER MANUAL. AutoQ3D CAD for ipad & iphone
Type to enter text 2D & 3D CAD SOFTWARE USER MANUAL AutoQ3D CAD for ipad & iphone AUTOQ3D TEAM FIRST EDITION AutoQ3D CAD for ipad & iphone 2D / 3D cad software user manual 2015 by AutoQ3D Team. All rights
More informationMultimedia-Programmierung Übung 6
Multimedia-Programmierung Übung 6 Ludwig-Maximilians-Universität München Sommersemester 2018 Ludwig-Maximilians-Universität München Multimedia-Programmierung 6-1 Today Sprites, Sprite Groups and Sprite
More informationGenerating Vectors Overview
Generating Vectors Overview Vectors are mathematically defined shapes consisting of a series of points (nodes), which are connected by lines, arcs or curves (spans) to form the overall shape. Vectors can
More informationACS-1805 Introduction to Programming (with App Inventor)
ACS-1805 Introduction to Programming (with App Inventor) Chapter 8 Creating Animated Apps 10/25/2018 1 What We Will Learn The methods for creating apps with simple animations objects that move Including
More informationPhotocopiable/digital resources may only be copied by the purchasing institution on a single site and for their own use ZigZag Education, 2013
SketchUp Level of Difficulty Time Approximately 15 20 minutes Photocopiable/digital resources may only be copied by the purchasing institution on a single site and for their own use ZigZag Education, 2013
More informationAnimations that make decisions
Chapter 17 Animations that make decisions 17.1 String decisions Worked Exercise 17.1.1 Develop an animation of a simple traffic light. It should initially show a green disk; after 5 seconds, it should
More informationIntroduction to Computer Science Using Python and Pygame
Introduction to Computer Science Using Python and Pygame Paul Vincent Craven Computer Science Department, Simpson College Indianola, Iowa http://cs.simpson.edu c Draft date May 15, 2011 2 Contents Contents
More informationGRAPHICS & INTERACTIVE PROGRAMMING. Lecture 1 Introduction to Processing
BRIDGES TO COMPUTING General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. This work is licensed under the Creative Commons Attribution-ShareAlike
More informationStep 1: Create A New Photoshop Document
Snowflakes Photo Border In this Photoshop tutorial, we ll learn how to create a simple snowflakes photo border, which can be a fun finishing touch for photos of family and friends during the holidays,
More informationMultimedia-Programmierung Übung 7
Multimedia-Programmierung Übung 7 Ludwig-Maximilians-Universität München Sommersemester 2013 Ludwig-Maximilians-Universität München Multimedia-Programmierung 7-1 Today Sprite animations in Advanced collision
More informationa. Nothing. b. The game will run faster. c. The game will run slower. 5. What does this code do?
142-253 Computer Programming: Pygame Exercises BSc in Digital Media, PSUIC Semester 1, 2016-2017 Aj. Andrew Davison CoE, PSU Hat Yai Campus E-mail: ad@fivedots.coe.psu.ac.th Basics 1. What is the game
More informationInteractive Tourist Map
Adobe Edge Animate Tutorial Mouse Events Interactive Tourist Map Lesson 1 Set up your project This lesson aims to teach you how to: Import images Set up the stage Place and size images Draw shapes Make
More informationShape and Line Tools. tip: Some drawing techniques are so much easier if you use a pressuresensitive
4Drawing with Shape and Line Tools Illustrator provides tools for easily creating lines and shapes. Drawing with shapes (rectangles, ellipses, stars, etc.) can be a surprisingly creative and satisfying
More informationCISC 1600, Lab 3.1: Processing
CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/
More information+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.
+ Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create
More informationThe process of making a selection is fundamental to all Photoshop
102640 ch15.1.qxp 3/10/07 11:23 AM Page 303 Making Selections The process of making a selection is fundamental to all Photoshop documents. A selection isolates an area of an image so that you can apply
More informationCpSc 101, Fall 2015 Lab7: Image File Creation
CpSc 101, Fall 2015 Lab7: Image File Creation Goals Construct a C language program that will produce images of the flags of Poland, Netherland, and Italy. Image files Images (e.g. digital photos) consist
More informationGraphic Design & Digital Photography. Photoshop Basics: Working With Selection.
1 Graphic Design & Digital Photography Photoshop Basics: Working With Selection. What You ll Learn: Make specific areas of an image active using selection tools, reposition a selection marquee, move and
More informationOutput models Drawing Rasterization Color models
Output models Drawing Rasterization olor models Fall 2004 6.831 UI Design and Implementation 1 Fall 2004 6.831 UI Design and Implementation 2 omponents Graphical objects arranged in a tree with automatic
More informationFor this assignment, you are to implement three line drawers and a polygon drawer.
SFU CMPT 361 Computer Graphics Fall 2017 Assignment 1 Assignment due Thursday, September 28, by 11:59 pm. For this assignment, you are to implement three line drawers and a polygon drawer. These rendering
More informationLesson 6 Adding Graphics
Lesson 6 Adding Graphics Inserting Graphics Images Graphics files (pictures, drawings, and other images) can be inserted into documents, or into frames within documents. They can either be embedded or
More informationNote: Photoshop tutorial is spread over two pages. Click on 2 (top or bottom) to go to the second page.
Introduction During the course of this Photoshop tutorial we're going through 9 major steps to create a glass ball. The main goal of this tutorial is that you get an idea how to approach this. It's not
More informationHAPPY HOLIDAYS PHOTO BORDER
HAPPY HOLIDAYS PHOTO BORDER In this Photoshop tutorial, we ll learn how to create a simple and fun Happy Holidays winter photo border! Photoshop ships with some great snowflake shapes that we can use in
More informationCISC 1600, Lab 2.1: Processing
CISC 1600, Lab 2.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using Sketchpad, a site for building processing sketches online using processing.js. 1.1. Go to http://cisc1600.sketchpad.cc
More informationIT82: Multimedia Animation Master Practical
IT82: Multimedia Animation Master Practical The aims and objectives of this practical are two-fold: To reinforce the basic principles of animation from lectures. To use Hash s Animation Master to have
More information: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics
Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays
More informationIntermediate/Advanced. Faculty Development Workshop FSE Faculty retreat April 18, 2012
Intermediate/Advanced Faculty Development Workshop FSE Faculty retreat April 18, 2012 Remote Desktop Sharing Quick Reference Guide for Moderators The Moderator or a Participant may request control of another
More informationPhotoshop Basics A quick introduction to the basic tools in Photoshop
Photoshop Basics A quick introduction to the basic tools in Photoshop Photoshop logo courtesy Adobe Systems Inc. By Dr. Anthony R. Curtis Mass Communication Department University of North Carolina at Pembroke
More information0 Graphical Analysis Use of Excel
Lab 0 Graphical Analysis Use of Excel What You Need To Know: This lab is to familiarize you with the graphing ability of excels. You will be plotting data set, curve fitting and using error bars on the
More information13 PREPARING FILES FOR THE WEB
13 PREPARING FILES FOR THE WEB Lesson overview In this lesson, you ll learn how to do the following: Create and stylize a button for a website. Use layer groups and artboards. Optimize design assets for
More informationMultimedia-Programmierung Übung 5
Multimedia-Programmierung Übung 5 Ludwig-Maximilians-Universität München Sommersemester 2009 Ludwig-Maximilians-Universität München Multimedia-Programmierung 5-1 Today Sprite animations in Advanced collision
More informationUnit Lesson Plan: Measuring Length and Area: Area of shapes
Unit Lesson Plan: Measuring Length and Area: Area of shapes Day 1: Area of Square, Rectangles, and Parallelograms Day 2: Area of Triangles Trapezoids, Rhombuses, and Kites Day 3: Quiz over Area of those
More information4 Working with Selections
4 Working with Selections Learning how to select areas of an image is of primary importance you must first select what you want to affect. Once you ve made a selection, only the area within the selection
More informationCreate a Swirly Lollipop Using the Spiral Tool Philip Christie on Jun 13th 2012 with 12 Comments
Advertise Here Create a Swirly Lollipop Using the Spiral Tool Philip Christie on Jun 13th 2012 with 12 Comments Tutorial Details Program: Adobe Illustrator CS5 Difficulty: Beginner Es timated Completion
More informationA QUICK TOUR OF ADOBE ILLUSTRATOR CC (2018 RELEASE)
A QUICK TOUR OF ADOBE ILLUSTRATOR CC (2018 RELEASE) Lesson overview In this interactive demonstration of Adobe Illustrator CC (2018 release), you ll get an overview of the main features of the application.
More information(Refer Slide Time: 00:02:00)
Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts
More informationBobCAD-CAM FAQ #50: How do I use a rotary 4th axis on a mill?
BobCAD-CAM FAQ #50: How do I use a rotary 4th axis on a mill? Q: I ve read FAQ #46 on how to set up my milling machine. How do I enable 4th axis to actually use it? A: Enabling 4th axis in the machine
More informationPolygons and Angles: Student Guide
Polygons and Angles: Student Guide You are going to be using a Sphero to figure out what angle you need the Sphero to move at so that it can draw shapes with straight lines (also called polygons). The
More informationThis is the vector graphics "drawing" technology with its technical and creative beauty. SVG Inkscape vectors
1 SVG This is the vector graphics "drawing" technology with its technical and creative beauty SVG Inkscape vectors SVG 2 SVG = Scalable Vector Graphics is an integrated standard for drawing Along with
More informationCISC 1600, Lab 2.3: Processing animation, objects, and arrays
CISC 1600, Lab 2.3: Processing animation, objects, and arrays Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad. sketchpad.cc in your browser and log in. Go to http://cisc1600.
More informationLet s Make a Front Panel using FrontCAD
Let s Make a Front Panel using FrontCAD By Jim Patchell FrontCad is meant to be a simple, easy to use CAD program for creating front panel designs and artwork. It is a free, open source program, with the
More informationBy PAD Product Development and Support Team
Release Note Of PAD 2 V6 Pattern Design By PAD Product Development and Support Team 1 PAD System is a trademark and a system developed by: PAD System International Limited. Flat A, 2/F, Cheung Wing Industrial
More informationUsing Selection Tools and Layers
Using Selection Tools and Layers A version of the melon head. Yours does not need to look just like this. Start by opening the Lesson 02 Start file provided. Select File>Save As and rename file adding
More informationExercise III: Creating a Logo with Illustrator CS6
Exercise III: Creating a Logo with Illustrator CS6 Project 1: Creating Logos with the Shape Tools Now that we have some experience with Illustrator s tools, let s expand our goal to create a logo, web
More informationUV Mapping to avoid texture flaws and enable proper shading
UV Mapping to avoid texture flaws and enable proper shading Foreword: Throughout this tutorial I am going to be using Maya s built in UV Mapping utility, which I am going to base my projections on individual
More informationRenderize Live Overview
Renderize Live Overview The Renderize Live interface is designed to offer a comfortable, intuitive environment in which an operator can create projects. A project is a savable work session that contains
More informationRENDERING TECHNIQUES
RENDERING TECHNIQUES Colors in Flash In Flash, colors are specified as numbers. A color number can be anything from 0 to 16,777,215 for 24- bit color which is 256 * 256 * 256. Flash uses RGB color, meaning
More informationTo start, open or build a simple solid model. The bracket from a previous exercise will be used for demonstration purposes.
Render, Lights, and Shadows The Render programs are techniques using surface shading, surface tones, and surface materials that are then presented in a scene with options for lights and shadows. Modifications
More informationFig. A. Fig. B. Fig. 1. Fig. 2. Fig. 3 Fig. 4
Create A Spinning Logo Tutorial. Bob Taylor 2009 To do this you will need two programs from Xara: Xara Xtreme (or Xtreme Pro) and Xara 3D They are available from: http://www.xara.com. Xtreme is available
More informationDinoCapture Additional Software Instructions for Measurement models
DinoCapture Additional Software Instructions for Measurement models Window tools Microtouch: The microtouch is a touch sensitive area on the dome that connects to the USB Cable. It functions as a button
More informationINDESIGN AND PHOTOSHOP
NEIL MALEK, ACI With just a few basic tools, anyone can professionally polish photos in Photoshop and arrange them into a layout in InDesign. The incredible power and diverse tools can be intimidating,
More informationHOW TO. In this section, you will find. miscellaneous handouts that explain. HOW TO do various things.
In this section, you will find miscellaneous handouts that explain do various things. 140 SAVING Introduction Every time you do something, you should save it on the DESKTOP. Click Save and then click on
More informationAdobe Illustrator CS5 Part 2: Vector Graphic Effects
CALIFORNIA STATE UNIVERSITY, LOS ANGELES INFORMATION TECHNOLOGY SERVICES Adobe Illustrator CS5 Part 2: Vector Graphic Effects Summer 2011, Version 1.0 Table of Contents Introduction...2 Downloading the
More information2. If a window pops up that asks if you want to customize your color settings, click No.
Practice Activity: Adobe Photoshop 7.0 ATTENTION! Before doing this practice activity you must have all of the following materials saved to your USB: runningshoe.gif basketballshoe.gif soccershoe.gif baseballshoe.gif
More informationCS7026 CSS3. CSS3 Graphics Effects
CS7026 CSS3 CSS3 Graphics Effects What You ll Learn We ll create the appearance of speech bubbles without using any images, just these pieces of pure CSS: The word-wrap property to contain overflowing
More information