Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: learn to code
Views: 92
Kernel: Python 3
University of Reading logo   


Begin Programming: Build Your First Mobile Game | Jez Phipps

The Begin Programming course is a free MOOC (Massive Open Online Course) created by the University of Reading and hosted by FutureLearn, a UK-based social learning platform.

This hands-on course involved the use of:

Over 7 weeks, the course introduced the basic constructs used in many programming languages and help learners to put this knowledge into practice by changing the game code we have provided

Having successfully completed the course, I subsequently decided to create this online record of my learning.

My FutureLearn profile can be found here: Jez Phipps


Week 1 - Welcome to Begin Programming

In the first week, we learned how to:

  • install and check the Java SE SDK

  • install and configure the Android Studio IDE, including:

  • how to set up an emulator;

  • how to set up an Android Device using the Direct Connection method;

  • how to set up an Android Device using the APK method.

Practical work

After learning about the options for setting up Android Studio, students were required to choose the best methods. I found the emulation method very slow, resource-hungry and unreliable and hence opted for a direct device connection (USB). Note: The APK method is useful for sharing the code but does not provide direct control from inside Android Studio.


Week 2 - Introducing code constructs

In Week 2, learners are introduced to some of the basic constructs used in programming, including:

  • variables and data types

  • the most commonly used operators, namely:

  • assignment operators

  • arithmetic operators

  • unary operators

  • equality, conditional and relational

  • operator precedence

Practical work

After being introduced to the Android Studio debugging functions, students were encouraged to make some changes to the game code, including:

  • increasing the speed of the ball

  • experimenting with setting the ball (x, y) location

  • testing the actionOnTouch() method


Week 3 - Conditional statements

In Week 3, students learned the basics of conditional statements and Boolean expressions and how these can be used to improve the game.

Practical work

The hands-on activities involved making several important changes to the game, including:

  • ensuring the ball is positioned correctly at the start

  • making the ball bounce off the edge of the screen

  • adding a Bitmap for the paddle, positioning it and drawing it

  • adding the code required for the paddle to respond both to touch and to device movement

  • adding the conditional statements required to create ball-to-paddle collision logic

  • test the collision detection code to ensure the ball rebounds as expected


Week 4 - Arrays and loops

In Week 4, learners explored how arrays and loops are useful in programming.

Practical work

The practical work involved making some key changes to the game, including:

  • adding multiple obstacle images to the game using arrays

  • using iteration (loops) to draw the images held in an array


Week 5 - Algorithms

In Week 5, the concepts that underpin algorithms were introduced, including:

  • the use of 'Structured English' pseudocode to define algorithms

  • the use of nested loops and conditional statements in sorting algorithms

  • applying the knowledge gained so far to programmatically solve more complex problems

Practical work

The practical work involved considering how the game could be improved. I came up with a number of ideas and began implementing the following in Android Studio:

  • adding an updateLives() function, and the required supporting code, to limit player lives to 3

  • add the code required such that the Number of Lives text is displayed/updated on screen using TextView

  • changed the background and paddle images to match my chosen theme

  • added conditional statements such that an image swap function is executed when certain collisions occur


Week 6 - Functions

In Week 6, the use of functions for reusable code was explored. In particular, we covered:

  • how functions help to make code simpler, easier to maintain and easier to modify later on

  • how to use the debugger in Android Studio to step in and out of functions

  • how the combination of the function name and parameter types used create a ‘signature’

  • the advantages of using return values to create more useful functions

Practical work

The practical work involved continuing to make improvements to the game, including:

  • developing a paddle repositioning function that executes each time points are scored

  • making use of Android Studio debugger to identify and fix any problems in the code

  • creating a function from scratch; I chose to add sound effects to the game using a SoundPlayer class and associated functions


Week 7 - Consolidate, reflect and celebrate

In the final week, learners were required to:

  • share ideas and successes with others on the course

  • assess knowledge gained with the 3 end-of-course tests, which are:

  • 'Speaking the language', which tests your knowledge of programming terms

  • 'Putting knowledge into practice', which challenges your coding skills

  • 'Bringing it all together', which draws together questions from across the course

  • Reflect on what you have explored and achieved and the skills gained during the course

Practical work

In the final week I decided to make the following improvements to the game:

  • added code to cause target to move back-and-forth along top of screen when certain score is reached

  • created custom app icon (ic_launcher)

  • generated a signed APK to allow app to be shared


Course result

My end-of-course test score: 98% - Eligibility for a Certificate of Achievement confirmed.

Note: This record does not imply the conferment of a University qualification nor does it verify the identity of the student. For more information about the effort required to become eligible, visit FutureLearn's Certificates and Statements FAQ.

from IPython.display import display, HTML HTML('''<style> .iconTwitter{ background:url("./twitter.svg") center no-repeat; display:inline-block; width:22px; height:22px; background-size:22px; } </style> <script> $('div.input').hide(); location.href="#Top"; </script>''')