Posted on ven. 26 janvier 2018

Swish

Swish is a basketball game made with canvas. You have 3 minutes to score as many points as you can but beware of the 2 defensive players, they will stop your shots !

game

You control the hand at the bottom of the screen, you can only move on the left and the right. The hoop is moving and so are the 2 defensive players, you will have to find the right time to throw the ball and score points. You can only shoot 1 ball at a time, if you shoot another one the first ball you shot will disappear. So if you missed your first shot, don't wait and start shooting another one!

Once the time runs out, a new screen will appear with Coach Yves telling you how many points you got.

gameend

Behind The Game

Swish was made with canvas only in a javascript file and it required 233 lines of code. My goal was simple, I wanted to create a game where you could move an element and shoot with it. I also wanted to have elements who could stop your shots to make the game a little bit more difficult and interesting. That's why a basketball game was perfect, you control the player, you shoot the ball into the moving hoop and the 2 defensive players are trying to stop the ball.

code

On those images, you can see how I made the animation for the basketball hoop and for the defensive players. Also, you can see the collision function which is necessary in order to make the ball disappear if it touches a player or the hoop.

I used an image found online for the basketball hoop because our game artits were busy working on their project, but I asked Maryon if she could make a basketball with a hand holding it. And this is what she made for me.

hand

Valentin Bachelot-Lallier

Commentaires


Links