Tag: Coordinates

Estimating Pi using the Monte Carlo Method


One method to estimate the value of π (3.141592…) is by using a Monte Carlo method. This methods consists of drawing on a canvas a square with an inner circle. We then generate a large number of random points within

Python Turtle – WordArt Challenge


In this challenge we will use Python Turtle to draw text on screen and customise the appearance of our text. To do so we have created our own font as a Python dictionary. Each letter of the alphabet is represented

Confetti Artwork Challenges


For these challenges we will produce on screen artwork by randomly positioning confetti on different shapes of canvas. Our code will use Python Turtle to draw the canvas and the confetti. Square Canvas Check how the code provided below randomly

Confetti Challenge


In this Python challenge we will write a script to randomly draw confetti on a canvas while ensuring that none of the confetti overlap with each other! Problem Decomposition In this challenge we will need to solve the following problems:

Falling/Scrolling Object Algorithms

Scrolling/Falling Object Algorithms

In many arcade video games objects are flying across the screen (either vertically: falling objects, upcoming cars in car racing game) or horizontally (e.g. pipes in Super Mario or flappy bird, cars in Crossy Road). In frame based games, motions

Pacman Ghost Algorithm


In a game of Pacman a specific algorithm is used to control the movement of the ghosts who are chasing (running towards) Pacman. For this challenge we will assume that ghosts can walk through walls (as ghosts do!). So we

Bouncing Algorithm


Bouncing algorithms are often used in arcade games such as Pong or Breakout. To understand how to implement a bouncing algorithm it is essential to understand how the computer controls the trajectory of a sprite (e.g. ball) on the screen.

Closest Player Detection Algorithm

Edge Detection & Bouncing Algorithm

Have you ever noticed when playing a team sport video game such as a (football, basketball, rugby game, etc.) the computer often finds out who the closest player to the ball is so that you can run to the ball

Random Background Generator


In this challenge we will use a Python script (using Python Turtle) to generate a random background for a 2D video game. To create a mountain range skyline we will use a polynomial function:   In our example (see trinket

Oblique Projection Formulas

Oblique Projection Formula

The aim of this challenge is to demonstrate how the oblique projection formulas are used to convert 3D coordinates (x,y,z) into 2D coordinates (x,y). The oblique projection formulas are essential to understand how 3D models are displayed on a 2D