• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Game Development with Pygame
 

Game Development with Pygame

on

  • 148 views

This slide introduct about pygame and show some technique that used in demo game Mario of Happycodyng Group.

This slide introduct about pygame and show some technique that used in demo game Mario of Happycodyng Group.
More info at: http://tech.blog.framgia.com/vn/

Statistics

Views

Total Views
148
Views on SlideShare
139
Embed Views
9

Actions

Likes
1
Downloads
4
Comments
0

1 Embed 9

http://www.slideee.com 9

Accessibility

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Game Development with Pygame Game Development with Pygame Presentation Transcript

    • Game Development with Pygame HappyCodying Group 2014/03/29
    • Members • Nguyen Anh Tien • Nguyen Anh Tuan • Cao Thanh Luc • Nguyen Thi Huyen • Nguyen Minh Tien • Ngo Duy Trung • Pham Ngoc Tam • Nguyen Van Tung
    • What’s Pygame ? • Cross-platform set of Python modules • designed for writing video games • No need knowledge about C, OpenGL, …. • Pyweek Contest – Write a game during one week using Python
    • Pygame’s core module • pygame • pygame.Surface • pygame.Rect • pygame.sprite.Sprite • pygame.display • pygame.event • …
    • Hello world in Pygame import sys import pygame if not pygame.font: print 'Warning, fonts disabled' pygame.init() size = width, height = 640, 480 screen = pygame.display.set_mode(size) while True: if pygame.font: # render font and set position font = pygame.font.Font(None, 36) text = font.render("Hello World !", 1, (255, 0, 0)) textpos = text.get_rect(centerx=width/2) # draw to screen screen.blit(text, textpos) # change buffer pygame.display.flip()
    • Mario Clone • Purpose ? – Learn basic game development principle – Learn to code with Python • Platform game • (Try) minic the good old Super Mario Bros • New features ?
    • Sprite (1) • Core class for each object in game • 2 important properties – image : what we see on screen – rect : position and bounding box of object • How to load and draw image ? img = pygame.image.load(“mario.png”) screen.blit.(img, (100, 100))
    • Sprite (2) • self.image • Crop to each frame • Change and blit it on screen according to object state
    • Sprite (3) • self.rect -> rectangle • Used to check collision with other object
    • Map • TMX file (Tilemap XML) • Tiled (www.mapeditor.org/) • Pygame: TMX library written by Richard Jones Tileset
    • Map with layer • Z-order • Background layer • Midground layer – Mario – Turtle – Coinbox, Coin, …. • Foreground layer
    • Map with layer Background layer Midground layer Trigger layer Foreground layer
    • Trigger Layer • Invisible layer • Hold information of Object – Start position – Custom properties • Flower : Color • Coinbox: HIDDEN, SECRET, BLANK – What contain in coinbox : Mushroom, Star, … • …
    • map: underground.tmx Trigger Layer Coins Mario Bricks CoinBox Item Mushroom Platform
    • Time for Demo ! Soure code: https://github.com/vigov5/mario_game/
    • Thank you for your listening !!!