✔ Discovering the Tetra framework.
✔ Creation of your video game.
✔ Improve your Rust skills.
All the required information to install dependencies can be found in SETUP.md.
❗ To follow this part of the workshop we strongly advise you to have followed the workshop Introduction to Rust.
💡 We recommend you to follow the Tour of Rust for this workshop.
❗ We strongly advise you to use the resources given for this exercise.
The first step of this workshop is simple, you just need to display a basic window, with a title and a colored background.
For this, we will use throughout the workshop a framework called Tetra.
Tetra is a simple 2D game framework written in Rust. It uses SDL2 for event management and OpenGL 3.2+ for rendering.
This first window should be named PoC_WorkShop
and have the following dimensions: (800 x 500)
.
We just ask you to display a simple window with no content inside, the title is the name of the window and not any text inside.
To do this, create a file main.rs
in a folder called src
.
💡 Rust file has
rs
extension.
❗ We strongly advise you to use the resources given for this exercise.
Congratulations! 🎉
With the previous step, you have displayed your first window. Now, why not display some text in this window?
Using the font provided with the workshop, the file DejaVuSansMono.ttf
must be in a folder /assets/font/
.
To display text, you need to follow three steps:
-
Add the font to your program.
-
Create a variable
vector_text
with the valueHello world!
and the font of your assets.vector_text
uses the Text module. -
Display
vector_text
in your window.
💡 This step like the others is important for the rest of the workshop, don't hesitate to look at the resources.
❗ We strongly advise you to use the resources given for this exercise.
First, you need an image. Make sure you have a PoC.png
file in the assets/images
folder.
Your program must display an image with the parameter:
-
The scale of type
Vec2
. -
The position of type
Vec2
. -
The origin of the image of type
Vec2
.
You now have all the necessary information to display an image in your window.
It's up to you ! 👍
❗ We strongly advise you to use the resources given for this exercise.
The interactions between the user and your program are a mandatory part of creating a video game.
In this exercise, you will receive input from your keyboard to move an image assets/images/player_one.png
.
Four keys will be used to move the image:
-
Z
to move the fish up. -
Q
to move the fish to the left. -
S
to move the fish down. -
D
to move the fish to the right.
🎯 The objective is simple: Thanks to the previous exercises you can display a fish and now you have to make it move when you press the keys above.
❗ We strongly advise you to use the resources given for this exercise.
The serious things begin! 💪
This exercise aims to condense all the skills seen in this workshop and push it even further.
After this, you can officially say that you have created your first video game with Tetra in Rust.
You must all know the famous game snake
created in 1976. The game consists of leading a snake that grows by collecting items and thus constituting an obstacle itself.
For more information...
For this last exercise we impose no constraints, the idea is simple to have a functional game.
You have zero limits, it's up to you to add as many options or features as possible.
🎯 The goal is to create your own snake game.
Here are some bonus ideas if you want to venture further into the Rust adventure! 💪
- Why not create your own game concepts or reproduce existing games.
If you ever feel like sharing your creations, you can do it in the
software-chat
room on the Discord serverPoC - Community
.
Yoel EDERY |
Nicolas HEUDE |
---|
🚀 Don't hesitate to follow us on our different networks, and put a star 🌟 on
PoC's
repositories.