Computer Project
Computer Project
e Gam
in pyt e
hon
1 Cover Page 1
2 Certi cate 2
3 Acknowledgement 3
4 Index 4
5 Assets 5
6 Setup 6
7 Code 7-14
8 Result 15
9 Bibliography 16
Page 4
fi
Assets
Download the assets from this QR code which links
to a google drive
Page 6
Code
Page 7
fi
fi
We then de ne the automatic movement of the Snake so
that the textures move with the Snake hitbox.
Page 9
fi
Now we can nally start coding the game mechanics. We
rst start by de ning the initial game state. We also de ne
the elements like the background, the update trigger and
the collision check system. We set up the trigger when the
snake touches the fruit, causing the fruit to go to another
random position
Page 11
fi
Here we set up a pre-game menu with start instructions.
The key to start has been set to SPACE here.
Page 12
The code here is used to bind the movements of the snake
to the arrow keys, as well as to de ne fps(frames per
second), Window size and Quitting.
Page 13
fi
Result
Page 14
Bibliography
https://youtu.be/QFvqStqPCRU?si=mTfJkS9YmHu6VsS8
https://github.com/clear-code-projects/Snake
Page 15