PlatformDemo

Description: User presses keys to control players' jumps between platforms
Programmer: Steven Binns
Compiler: Smart Mobile Studio 2.2

Introduction

This demonstration should help aspiring game programmers to make their own platform games. It demonstrates (using a circle for a player):
  • object-oriented code, with classes for platforms and players;
  • keyboard input for moving a player left and right and for jumping;
  • collision detection, preventing players from moving through platforms;
  • gravity;
  • friction, so that when left and right keys are not pressed a moving player slows to a standstill;
  • the use of real numbers that can be represented exactly in binary e.g. 0.25 and 0.125.

You will see from the code that the w, a and d keys control the blue player and the up, left and right arrows move the red player. Click on the graphics window before your first key press.

In order to familiarise yourself with the techniques you could, for example:

Features

Object-oriented code, keyboard input, Round, FillRect, Ellipse

Note:

This project has 3 versions.(SMS v2.0, v2.1 and v2.2). We provide the code for a single player and platform in the final section to enable you to understand the collision code more easily.