Create a game with an Ipad and Python (Full / wip)

Welcome to Pythonista

 

In the following videos I will start explaining how to maka a videogame with the Ipad and Python, through the app Pythonista. This app is not free, but it’s the coolest app to code on the Ipad, in my opinion. You can easily create a videogame. This post is a work on progress: you will find new videos every two – three days. Stay tuned.

History of post updates:

  • (new) 19/04/2019: new video with player sprite added to the ground
  • before 19/04/2019: two videos with background and sprite for the ‘ground’

The game: step by step

The sky is blue! Aka Let’s show the background

This code is based on the module scene for the animation in 2d on the ipad through Python. Here is the documentation: link to the documentation of scene module.

The first thing that we are going to do is to color the background. Nothing fancy, just a nice blue color. And it is very easy to do it, we just add an attribute to our object that is, by the way, called background.

Let’s put our feet on the earth: aka let’s draw some land

Now let’s draw the ground where our character will put his feet on, because we will have gravity… and we will use the ‘gravity’ to move our sprite in the next videos.

Here come the player, with feet on the ground

Now it’s time for the actor of our game. What actor will we choose? An alien, of course, why not. It’s a cute alien, do not worry and it comes with the free stuffs included in Pythonista.

Move, move… move!

Now it’s time for our Alien sprite to move around this little planet and try to survive. Let’s command him moving the ipad… cool, isn’t it?

Avoid going outside the screen

Let’s change a line of our code to avoid our Alien Sprite from going outside the screen. You can find many examples about the documentation of pythonista here: click here for the doc

The playlist with all the videos of the tutorial serie

Watch the playlist

External links

Video about pythonista in classroom

Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.