What is Pygame…?

  • Upload
    arryz

  • View
    244

  • Download
    5

Embed Size (px)

Citation preview

  • 8/14/2019 What is Pygame?

    1/28

  • 8/14/2019 What is Pygame?

    2/28

    WHAT IS PYGAME?

  • 8/14/2019 What is Pygame?

    3/28

    INTRODUCTON

    Based on creating games.

    Canrunonanyplatform.

    User friendly.

    Varieties of modules.

  • 8/14/2019 What is Pygame?

    4/28

    WEBSITE

    http://www.pygame.org

  • 8/14/2019 What is Pygame?

    5/28

    HOW TO INSTALL..?

  • 8/14/2019 What is Pygame?

    6/28

    MODULES

  • 8/14/2019 What is Pygame?

    7/28

    MODULES IN PYGAME

    CD Channel Font Joystick RectSound Surface pygame UserRect

    cdrom constants cursors displaydraw event font image joystick

    key mixer mixer_music mouse

    surfarray time transform version

  • 8/14/2019 What is Pygame?

    8/28

    RECTcollidepoint - point inside rectangle.

    Rect.collidepoint(x, y)

    colliderect -check overlapping rectangles.

    Rect.colliderect(rectstyle)

    move_ip -movetheRectbythegivenoffset.

    Rect.move_ip(x, y)

  • 8/14/2019 What is Pygame?

    9/28

    SURFACE

    blit -copyaoneSurfacetoanother.

    Surface.blit(source, destpos, [sourcerect])

    get_rect - get a rectangle covering theentire surface.

    Surface.get_rect()

  • 8/14/2019 What is Pygame?

    10/28

    PYGAME

    Rect - create a new rectangle.pygame.Rect(rectstyle)

    Surface - create a new Surface.pygame.Surface(size, [flags,

    [Surface|depth, [masks]]])

  • 8/14/2019 What is Pygame?

    11/28

    get_error- get current error message.

    pygame.get_error()

    init - autoinitialize all imported pygamemodules.

    pygame.init()

  • 8/14/2019 What is Pygame?

    12/28

    CONSTANTSevents - These constants define the various

    event types.pygame.constants.events (constants)

    keyboard - These constants represent the

    keys on the keyboard.

    pygame.constants.keyboard (constants)

  • 8/14/2019 What is Pygame?

    13/28

    DISPLAY

    flip - update the display.

    pygame.display.flip()

    get_caption -get the current title of thewindow.

    pygame.display.get_caption()

  • 8/14/2019 What is Pygame?

    14/28

    set_caption - changes the title of the window.

    pygame.display.set_caption(title, [icontitle])

    update -updateanareaofthedisplay.

    pygame.display.update([rectstyle])

  • 8/14/2019 What is Pygame?

    15/28

    IMAGEload -loadanimageto a newSurface.

    pygame.image.load(file, [namehint])

    save - save surface as BMP data.

    pygame.image.save(Surface, file)

  • 8/14/2019 What is Pygame?

    16/28

    KEYget_pressed - get the pressed state for all

    keys.pygame.key.get_pressed()

    name -get the nameof a key.

    pygame.key.name(int)

  • 8/14/2019 What is Pygame?

    17/28

    MOUSE

    get_pos - gets the cursor position.pygame.mouse.get_pos()

    get_pressed - state of the mouse buttons.pygame.mouse.get_pressed()

  • 8/14/2019 What is Pygame?

    18/28

    set_cursor-stateof shapeof themousecursor.

    pygame.mouse.set_cursor(size,hotspot,xormasks, andmasks)

    set_pos - moves the cursor position.pygame.mouse.set_pos(pos)

    set_visible - show or hide the mouse cursor.

    pygame.mouse.set_visible(bool)

  • 8/14/2019 What is Pygame?

    19/28

    TIME

    delay - delay for a number of milliseconds.

    pygame.time.delay(millseconds)

    get_ticks - milliseconds since startup.pygame.time.get_ticks()

  • 8/14/2019 What is Pygame?

    20/28

    CREATING GAMES WITH

    PYGAME

  • 8/14/2019 What is Pygame?

    21/28

    FIRST STEP:

    The first step in creating our game is toimport Pygame.

    SYNTAX:

    import pygame

  • 8/14/2019 What is Pygame?

    22/28

    SECOND STEP: Basic steps to follow on main function

    are:-

    1.Initializing .

    2.Loading game resources .

    3.Preparing game objects .

    4.Entering the gameloop .

  • 8/14/2019 What is Pygame?

    23/28

    INITIALIZING Initialize the default pygame modules

    for you.

    SYNTAX:

    pygame.init()

  • 8/14/2019 What is Pygame?

    24/28

    DISPLAYING SURFACE: The next part of our main function is

    creating thedisplay surface.

    SYNTAX

    pygame.display.set_mode((640, 480),

    FULLSCREEN)

  • 8/14/2019 What is Pygame?

    25/28

    IMAGE LOADING: Next step is to load the image.

    SYNTAX

    pygame.image.load('a.bmp)

  • 8/14/2019 What is Pygame?

    26/28

    Preparing game objects.

    Entering the game loop .

  • 8/14/2019 What is Pygame?

    27/28

    Project guidance:Mr. A.Ponnusamy

    Project done by :K.Karthik

    P.R.ManiD.Arun Kumar

    S.Caroll

  • 8/14/2019 What is Pygame?

    28/28

    ANY QUERIES.?