Escape A sticky man adventure using TKINTER python module By: Channing Burgess.

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

Create a Simple Game in Scratch
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
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.
Basic Powerpoint NEXT. Viewing Your Slides Click on Slide Show and on View Show. The slide show will automatically be displayed on the screen.
Space Rescue Chad Seippel Cory VanHooser. Story 2050 brand new International Space Station Distress call from ISS about “alien attack” No further communication.
A Christmas Scratch game
Windows 8 Windows Phone 8 Web Mobile … and WakeUpAndCode.com.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
Guide to Programming with Python
Chapter 9 IF Statement Bernard Chen. If Statement The main statement used for selecting from alternative actions based on test results It’s the primary.
SOURCE 2006 Presentation by Luke Arntson Game Programming Optimization.
Introduction to TouchDevelop
Game Maker Day 2 Making a Maze Game.
Locally Edited Animations We will need 3 files to help get us started at
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 23 Game Graphics II.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
Python Programming Graphical User Interfaces Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Computing Science 1P Lecture 17: Friday 23 rd February Simon Gay Department of Computing Science University of Glasgow 2006/07.
Learning Unity. Getting Unity
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
How the Session Works Outline Practical on arrival Talk 1 Reflect on practical Clarify concepts Practical exercises at your own pace Talk 2: Further concepts.
Guide to Programming with Python Chapter Twelve Sound, Animation, and Program Development: The Astrocrash Game.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech June 2008.
Python 101 Dr. Bernard Chen University of Central Arkansas PyArkansas.
Tkinter Basics. Initial Stuff To get the package: from tkinter import * To make a window, give it a title and operate it: windowVar = Tk() windowVar.title(“your.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
Creating visual interfaces in python
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
ADOBE PREMIERE Filters, Effects, and Titles. Timeline: An important note DRAGGING! What’s this? You can drag your clip from either the PROJECT PANE, or.
Zack Russ.   A simple platform game using pygame.  Player collects jewels and progresses through the levels. A Platformer.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 22 Game Graphics.
Lives and Scoring Games Programming in Scratch. Games Programming in Scratch L2 Lives and Scoring Learning Objectives Define a variable Understand the.
Sprite sets. project of the week: bubble popper o objects appear from the bottom and slide up o player needs to avoid objects to earn points (objects.
COMPSA Exam Prep Session by Paul Allison On: April 8th from 1:30-3:00 Location TBA Winter 2016CISC101 - Prof. McLeod1.
Creating a Simple Game in Scratch Barb Ericson Georgia Tech May 2009.
Distribution Statement A: Unlimited Distribution Introduction to Microsoft PPT.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
PowerPoint Tips MGT 200 For each of the following slides, you are to read the tips and then complete the task listed. At the end of this PowerPoint you.
School of Computer Science Space School 2015 Programming a Lunar Lander Game.
DAY 4. MAKING SOMETHING ‘JUMP’ Simple! Move it a certain amount ‘up’ Glide back to your original spot.
Index Background Costumes Making object walk smoothly Controlling an object with the keyboard Control an object with the mouse Changing costume when hit.
Event Binding Make something to react when something happens to it, like pressing a key, it’s called event binding. Events: things that occur while a program.
Using TKINTER For Better Graphic Tkinter module offers more functions: Button Widget: from tkinter import * tk =Tk() btn=Button(tk, text=‘Click me’) btn.pack()
13. Sprites. Outline 1.Game Things in Pygame (again) 2.The Pygame sprite Module 3.The Sprite Class 4.Groups of Sprites 5.Types of Collision Detection.
Building a rocks and spaceship game with Pygame Zero
Sprites (Images) and Sounds
MOM! Phineas and Ferb are … Aims:
Tk Widgets in Javascript
Intro CS – Screens and Variables
Games Programming in Scratch
Graphical User Interfaces (GUIs)
10. User Input.

GUI Using Python.
Tkinter GUIs Computer Science and Software Engineering
Let’s make a shape…. Move!
13. Sprites Let's Learn Python and Pygame
Introduction to TouchDevelop
10. User Input Let's Learn Python and Pygame
Using the coords function (Coordinates)
Objective of the lesson
Double Page Spread Versions
Introduction to TouchDevelop
NexTk/NtkWidget A replacement for Tk ?! 1.
Let’s begin our game!.
Topics Graphical User Interfaces Using the tkinter Module
CoE Software Lab II , Semester 2, Sprites.
Presentation transcript:

Escape A sticky man adventure using TKINTER python module By: Channing Burgess

How to use the game! To use the game. Use the LEFT and RIGHT arrow keys to move. PRESS SPACE to jump. Try using all the space on each platform to gain momentum and time your jumps just right to be successful in getting to the ship!

Modify game window size and canvas layout 1. self.tk = Toplevel() 2. self.tk.title("Mr.Sticky Man -----Episode Mission: Reach the crew at the crashed ship!----") 3. self.tk.resizable(0, 0) 4. self.tk.wm_attributes("-topmost", 1) 5. self.canvas = Canvas(self.tk, width=900, height=600, highlightthickness=0) 6. self.canvas.pack() 7. self.tk.update() 8. self.canvas_height = self.canvas_width = self.bg = PhotoImage(file="background.gif") 11. self.bh = PhotoImage(file="background1.gif") 12. w = self.bg.width() 13. h = self.bg.height() 14. for x in range(0, 9): 15. self.canvas.create_image(x * w, 0 * h, image=self.bh, anchor='nw') 16. for x in range(0, 9): 17. self.canvas.create_image(x * w, 1 * h, image=self.bg, anchor='nw') 18. for x in range(0, 9): 19. self.canvas.create_image(x * w, 2 * h, image=self.bh, anchor='nw') 20. for x in range(0, 9): 21. self.canvas.create_image(x * w, 3 * h, image=self.bg, anchor='nw') 22. for x in range(0, 9): 23. self.canvas.create_image(x * w, 4 * h, image=self.bh, anchor='nw') 24. for x in range(0, 9): 25. self.canvas.create_image(x * w, 5 * h, image=self.bg, anchor='nw') 1. Change TK() tkinter call to toplevel to run over top of the clock 2. Change the title 3. Lines 5,8,9 changes the size of the canvas and window size 4. Lines 15,25. Originally it the canvas was made by two nested for loops. I took it out of the nested loop to have six different fill options the highlighted numbers are the order of each fill method form top to bottom

Change sprite jump size 1. def jump(self, evt): 2. if self.y == 0: 3. self.y = self.jump_count = 0 1. Very simply, just made the sprite jump height a little lower to make the game seem bigger

Add platform layout 1. I deleted the old layout from sitckyman and added 43 platforms by hard coding.

Added a Timer 1. def update_timeText(): 2. if (state): 3. #Always true gate 4. global timer 5. #centiseconds plus one 6. timer[2] += 1 7. if (timer[2] >= 100): 8. #seconds plus one 9. timer[2] = timer[1] += if (timer[1] >= 60): 12. #minutes plus one 13. timer[0] += timer[1] = #tkinter function 16. timeString = pattern.format(timer[0], timer[1], timer[2]) 17. timeText.configure(text=timeString) 18. root.after(100000, update_timeText) 19. state = True 20. root = tk.Tk() 21. timer = [0, 0, 0] 22. pattern = '{0:02d}:{1:02d}:{2:02d}' 23. #Makes the window 24. timeText = tk.Label(root, text="00:00:00", font=("Helvetica", 50)) 25. #packs it in the window 26. timeText.pack() 1. Implemented a function with simple if else statement with centiseconds, seconds, and minutes. Then using tkinter method of tk.Tk() it packs it into its own window using pattern.format to keep the pattern the same. A lot of help from online forums. 2. The call of this function is in the same place as updating the sprites movement.

Animation Configuration 1. self.bar_imagefile1 = PhotoImage(file="background.gif") 2. self.bar_x = self.bar_y = 0 4. self.bar_speed = self.bar_image1 = game.canvas.create_image(self.bar_x, self.bar_y, image=self.bar_imagefile1, anchor='nw‘) 1. def animateblocks(self): 2. self.bar_x = self.bar_x + self.bar_speed 3. if self.bar_x < 0: 4. self.bar_speed = elif self.bar_x > 900: 6. self.bar_speed= self.bar_x2 = self.bar_x2 + self.bar_speed2 8. if self.bar_x2 < 0: 9. self.bar_speed2 = elif self.bar_x2 > 900: 11. self.bar_speed2 = Lines 1-5 is one of the 6 animation images that seen here, show how I configured them bloc 2. Lines 1-11 are the function I made to keep the configured blocks in the canvas window

Animation 1. self.animateblocks() #Image 1 move 4. #image #x #y 5. self.game.canvas.move(self.bar_image, self.bar_speed, 0) 6. #Image 2 move 7. self.game.canvas.move(self.bar_image2, self.bar_speed2, 0) 8. #Image 3 move 9. self.game.canvas.move(self.bar_image3, self.bar_speed, 0) 10. #Image 4 move 11. self.game.canvas.move(self.bar_image4, self.bar_speed2, 0) 12. #Image 5 move 13. self.game.canvas.move(self.bar_image5, self.bar_speed, 0) 14. #Image 6 move 15. self.game.canvas.move(self.bar_image1, self.bar_speed2, 0) 1. Underneath the class that animates the sprite I call my animate blocks function. 2. Lines 5-15 move my images using TKINTER method canvas.move taking in the image and x,y movement speed.

Conclusion 1. I learned a lot by using tkinter. I wish I had used pygame instead because of it’s limited abilities and simple class structure. I feel as though I would be better at class stuctures that way. However, I did gain a lot by learning individual problem solving having to look up and study each tkinter built in method. 2. In the future I would like to set the clock and the canvas in a frame and add a high score keeper in the frame as well. 3. Thank you Dr. Hua for all of your help!