Platformer

Platformer

My first attempt at a platformer and my first time working with tile maps and grids.


The game map is built up using individual tiles arranged in a grid and it is limited to the boundaries of the screen. There are a few levels and a level editor is included to allow for expansion of the game. One of the trickiest features of this game were the moving platforms, which you see in the later levels.


Controls are LEFT and RIGHT arrow keys for movement and SPACE to jump

10 thoughts on “Platformer

  1. very good tutorial and very beginner friendly as i am new to this i am following you vid but cant find out why im getting this message wen i have install pygame sun_img = pygame.image.load(‘img/sun.png’)
    FileNotFoundError: No file ‘img/sun.png’ found in working directory ‘C:\Users\charl\PycharmProjects\pythonProject1’. thanks

    1. Hello. This error means that it can’t find the file sun.png, so there are a few things to check:
      1. Is the file actually in that folder?
      2. Depending on your editor (VS code for example) you need to use “open folder” and open the folder where your main code is. If you open a different folder and then navigate to your code, you could have this error.
      3. If none of those are the issue then you can get the full location of the file such as “C:/Program files/etc…” and put that into the image.load code

    2. Ryan,

      I noticed a simple piece of knowledge was missing that is not very intuitive. This code:

      pygame.image.load(‘img/sun.png’)

      Tells pygame to look for the the folder named ‘img’ in the current directory where your main.py file is (or where the code that is throwing the error is currently located. This is the current working directory) and within that folder there is a sun.png file that should be there.

      With this knowledge, Russ’s answer will make more sense along with the error you received from pygame.

  2. Hi Russ and thank you for the tutorial. When I finished my own game I noticed that the screen is way to big for my laptop. I figured out how to make it resizable, but then the pictures and content don’t resize with the screen.
    Can you help me with that?

  3. My lava appeared to far up. I checked in the world map and the lava came as it was ment to but to far up. It appeared on the line that had 2 7s on it.

  4. is it me? cuz when i try the same screen width and height on my laptop its cropped? (I’ve only watched Part 1

    1. The screen_width and screen_height variables define the overall size of the game window, so the settings i used may be too big for a laptop screen. You can reduce the variables to suit your screen but you would need to adjust the “tile_size” variable too. It should always be equal to screen_width or height divided by 20, since that’s the number of tiles the game uses for the x and y axes.

Leave a Reply

Your email address will not be published. Required fields are marked *