A Scheme Game Project from two years ago

Squares GameDownload and try the game at the end of the page.
What is Scheme:
Scheme is a functional programming language developed at the MIT AI Lab by Guy L. Steele and Gerald Jay Sussman, who introduced a thing called Lambda.
This language is applied to teaching students programming theories at MIT, and then is now used in may universities around the world.
Scheme IDE can be downloaded here. (It is now named “Racket”)
The Scheme Programming Language is a good book to begin with for self learning.

High level description:
Our ship is a fairlly big sized pink square,
whose posn is our mouse position.
The objects come from random position of four sides
Colliding with the following objects will have the following effects.
1. good.(good): hitting one of these will give you points;
2.better.(better): hitting this will give you an even bigger points bonus

3. bomb.(bomb): this is an enemy. if you hit one of these, you lose.

4.worse.(worse): hitting this will deduct points from your score


+1000 points – adds 1000 points to your score

-1000 points – subtracts 1000 points to your score

– The width and height of the scene
– range from which initial velocity are chosen

At each point in time, there are a number of objects,
each with a position and velocity.
And a score shown at the up-left corner.
This is all the information needed in our world.

Representation of The Squares World:


– Generate random objects

– Update objects positions over time

– Detect collisions between our ship and objects

– Control the ship by mouse

– Game Over

Possible factoring:

render-squares-world : World -> Scene
To render our game world onto a Canvas

handle-mouse : World Num Num String -> World
to update the ship position controlled by our mouse

handle-tick : World -> World
To update to the next frame of the animation

handle-key : World String -> World
Press “h” for gaming instructions;
Press “s” to start the game.

update-positions : World -> World
To move each object by its velocity

remove-collisions : World -> World
Remove black objects or red circle that have collied with our ship;
or Game Over if the red square has collied with our ship

remove-collisions-one : loo -> loo
To remove the object in the objects list that has collied with our ship,
if not game over.

collides? : Posn object -> Boolean
Does our ship hit an object?

perform-reflections : World -> [ListOf Number]
Compute the number of the objects was hit respectly.

compute-score : [ListOf Number] -> score
Compute the score we get according to [perform-reflections]

Download Link: Squares