1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 25 Game Graphics--Text and Animation.

Slides:



Advertisements
Similar presentations
Cosc 5/4730 Game Design. A short game design primer. A game or animation is built on an animation loop. – Instance variables of “objects” are updated.
Advertisements

Introduction to Computers Section 10A. home Presentation Programs Provide powerful design tools to outline, create, edit, arrange and display complex.
Microsoft® Small Basic
Harry Potter Scratch Game
 graphic organizers in the form of illustrations or images displayed in sequence for the purpose of pre-visualizing a motion picture, animation, motion.
Code Club Session 3 Shark Eats Fish. Picture of finished product here.
This game is loosely based on the Whack-A- Mole arcade game.  Each game starts with 45 seconds of play.  Moles randomly pop out of holes on the landscape.
Using Captivate To create Multimedia Presentations.
2.02E Adding and Animating Text into Computer Animations 2.02 Develop Computer Animations.
Extending the Pong Example Barb Ericson Georgia Tech June 2011.
GameMaker.  A lot of Different Definitions  Easier to Say What is NOT a Game  Movie is Not a Game  No Active Participation  Final Outcome is Fixed.
Guide to Programming with Python
I210 review (for final exam) Fall 2011, IUB. What’s in the Final Exam Multiple Choice (5) Short Answer (5) Program Completion (3) Note: A single-sided.
GameMaker Workshop Geoff Cameron Sarah Scialli. What this workshop will teach you GameMaker GameMaker No Programming Required No Programming Required.
Game Design Creating a game called PING Phase 3: Steps for building basic game.
CATCH SCRATCH! Programming from Scratch. Remember Scratch?
Code Club Session 2 Dance Party. What will we learn ?  How to change the background  How to create animations  How to make objects talk to each other.
GAME:IT Bouncing Ball Objectives: Create Sprites Create Sounds Create Objects Create Room Program simple game.
Game Maker Day 2 Making a Maze Game.
VIDEO GAME PROGRAMMING Video Game Programming Level One – Breakout INSTRUCTOR Big Dan Teague TEACHER’S ASSISTANT Delmar O'Donnell.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 23 Game Graphics II.
 graphic organizers in the form of illustrations or images displayed in sequence for the purpose of pre-visualizing a motion picture, animation, motion.
Dealing with Errors. Error Types Syntax Errors Runtime Errors Logical Errors.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
Microsoft® Small Basic Collision Detection Estimated time to complete this lesson: 1 hour.
Game Maker Terminology
AD 305 Electronic Visualization I : School of Art and Design : University of Illinois at Chicago : Spring 2007 Intro to Action Script 9 "The games of a.
Brief Tutorial. Here are your themes. Mouse over each one to see it in action. Click the one you want.
Fish Chomp. The screen where you can see what happens when you play your game is called the STAGE. The SCRIPT BANK is where the types of instructions.
Guide to Programming with Python Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
Guide to Programming with Python Week 15 Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
AD 206 Intermediate CG : School of Art and Design : University of Illinois at Chicago : Spring 2009 Intro to Action Script 9 "The games of a people reveal.
COMPUTER GAMES. Learning objectives Evaluate a computer game and suggest how it can be improved Create a design for a computer game Create a computer.
Image #1 Getting Started
Variables and Random Numbers Computer App Session 4.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Motion Graphics & Animation.
PowerPoint 2012 Tips for Creating a Presentation.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Starting Out with Games & Graphics in C++ Tony Gaddis Chapter 8 The.
Unit Seven: Basic Layout In this unit… ► Display Area: Layout View ► Sizing & Scaling Data ► Adding Map Elements  North Arrow  Title  Legend.
CompSci 44.1 Game Package Introduction to Jam’s Video Game Package.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 22 Game Graphics.
1 CSC 221: Computer Programming I Fall 2009 Introduction to programming in Scratch  animation sprites  motion, control & sensing  costume changes 
Lives and Scoring Games Programming in Scratch. Games Programming in Scratch L2 Lives and Scoring Learning Objectives Define a variable Understand the.
11. Skier Let’s Learn Saengthong School, June – August 2016 Teacher: Aj. Andrew Davison, CoE, PSU Hat Yai Campus
App Inventor Chapter 17 – Creating Animated Apps.
PowerPoint Computer Solutions 1. Multimedia A powerful blend of text, graphics, sound, animation, and video on your computer.  Multimedia is an effective.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
Reference: What is it? A multimedia python library – Window Management – Graphics geometric shapes bitmaps (sprites) – Input Mouse Keyboard.
 Many people like the flexibility of digital images. For example:  They can be shared by attaching to /uploading to Internet  Sent via mobiles.
Susan Ibach | Technical Evangelist Sage Franch | Technical Evangelist.
2.02F Adding and Animating Text in Computer Animations
PYGAME.
WITH PYGAME ON THE RASPBERRY PI
Game Maker Intro to Programming Game Maker Pop Quiz (Both Groups)
Today's Ninja Challenge: Make Better GhostBuster Game
Scratch Programming Intro
3.01E Adding and Animating Text into Computer Animations
2.02E Adding and Animating Text into Computer Animations
I210 review.
Development Laboratory
2.02E Adding and Animating Text into Computer Animations
Image #1 Getting Started
Game Over Module 4 Lesson 2.
CSC 221: Introduction to Programming Fall 2018
Lesson Nine Variables.
Presentation transcript:

1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 25 Game Graphics--Text and Animation

2 The games.Text class The games module provides a games.Text class that can be used to add text of a given value to the screen. The Text object is a type of Sprite. Example: from livewires import games, color myScore = games.Text(value = 0, size = 60, color = color.black, x = 550, y = 30) games.screen.add(myScore) Notes: The size of the text is given in pixels. To use color.black, you must import the color module from livewires.

3 Problem: Because games.Text inherits from the Sprite class, if we use it in our Pizza Pan game, we will get an error if we move the pan over the text, because we have not provided a handle_collide function. Solution: Create a new class that inherits from games.Text and provide a handle_collide function for it. Example: class Score(games.Text): def handle_collide(self): x = 0 #Line of code that does nothing relevant Note: Must change games.Text to Score in the main program. myScore = Score(value = 0, size = 60,...) The Problem with Text and Collisions

4 Changing the Text Value To change the value of the text, use the dot notation: myScore.value = myScore.value + 10 In our Pizza game, we can do this whenever the Pan collides with a pizza by changing the value of myScore.value in the handle_collision function: class Pizza(games.Sprite): def handle_collision(self): myScore.value = myScore.value + 10 self.destroy( )

5 Adding a Message The games.Message class can be used to add a message: Example: won_message = games.Message(value = "You won!", size = 100 color = color.red, x= games.screen.width/2, y = games.screen.height/2, lifetime = 250, after_death=games.screen.quit) games.screen.add(won_message) Notes: lifetime is the number of frames for the display. 250 frames is 5 seconds for a screen being displayed at 50 frames per second. after_death gives the name of the function (without parentheses) that is called after the message disappears.

6 Handling Collisions (Again) As with Text, we need to Handle collisions for our message. We can do this by creating a new class: class WinMessage(games.Message): def handle_collide(self): x = 0 #Essentially do nothing Make sure to change the creation of the message to the WinMessage class: won_message = WinMessage(value = "You Won!",...) games.screen.add(won_message)

7 Displaying the Message at the End of the Game We would like the message to appear at the end of the game. In our demo games, the user wins when they have caught all 4 pizzas, and thus have 40 points. We will change the handle_collide function in the Pizza class to display the message when the score is 40 or greater. In Pizza class: def handle_collide(self): myScore.value = myScore.value + 10 self.destroy( ) if myScore >= 40: self.displayMessage( )

8 The displayMessage( ) function In the Pizza class: def displayMessage(self): won_message = WinMessage(value = "You Won!", size = 100 color = color.red, x= games.screen.width/2, y = games.screen.height/2, lifetime = 250, after_death=games.screen.quit) games.screen.add(won_message)

9 Creating an Animation The Animation class in the games module of livewires allows you to create an animation from a set of individual frames. This class takes a list of images and displays them one after the other. Step 1. Create a list of files: explosion_files = ["explosion1.bmp", "explosion2.bmp", "explosion3.bmp", "explosion4.bmp", "explosion5.bmp", "explosion6.bmp", "explosion7.bmp", "explosion8.bmp", "explosion9.bmp"]

10 Animating the Frames Step 2: Create the Animation object. explosion = games.Animation(images = explosion_files, x = games.screen.width/2, y = games.screen.height/2, n_repeats = 0, repeat_interval = 5) games.screen.add(explosion) Notes: n_repeats is the number of times the animation repeats. If it is set to zero, the animation will loop forever. repeat_interval is the delay between frames. Higher numbers result in slower animation.