Tuesday, 27 March 2018

Problem Solving With Python #1

INTRO

Over the last couple of weeks I have been learning the basics of  Python and by learning the rules of it. I have been learning about the codes and how they need to be perfectly set out, (if you missed out one letter or you haven't put a capital letter you code/game wouldn't work). When I'm Writing out the code I cheek several times just to see if the code is right.

# When you put a hashtag in your game template it turns into a note which the game software doesn't turn into a code so if you want to label things just put a hashtag and write next to it (it should turn red).

SETTING UP THE GAME

The first thing that you have to do at the start of every template/game you make you have to import the player and the scene otherwise there would be nothing and your game wouldn't work.

#Import Game/Player
Code: import pygame
      import player 
The next part is the template layout (the Width, Height and the FPS)

#Setting up the window
Code: WIDTH =360
      HEIGHT = 460
      FPS = 30
The following step is defining colors (I'll show you the basic colors) and setting up the page with the colors that you put in, (you can do it two ways but I'll show you the easiest way)

#Defining colors and screen
Code: WHITE = (255, 255, 255)
      BLACK = (0, 0, 0)
      Red = (255, 0, 0)
      Green = (0, 255, 0)
      Blue = (0, 0, 255)
      pygame.init()
      pygame.mixer.init()
      screen = pygame.display.set_mode (WIDTH, HEIGHT)
      pygame.display.set_caption ("My Game")
      clock = pygame.time.Clock()


GAME LOOP

In the loop sections there are 4 main parts of it, The

USING PYTHON WITH 3 DIFFERENT PLATFORMS


PROBLEM SOLVING

I managed to write the code down by following the video and  Ms Chowfin explained the reason


No comments:

Post a Comment

Thank you for your positive, thoughtful, helpful comment.