Coding for artists (part 2)

Programming physics

Hello !

This week was dedicated to introduce us to Godot Engine, a programming language using physics. Although we already used Python two weeks ago, this one was (in my opinion) was more subtle to use.

I re-used the assets I created for Battle for Wesnoth : a vindicative nun (as the protagonist) and a vampire hunter (as the enemy).* So this time, I'm gonna write a basic tutorial for artists who want to implement their assets into the game.

Step 1 : Starting a new project

Once Godot is installed, choose "New Project" to create your game folder. The location of these files are up to you.


Then, once you are in the editor, click "+" in the "Scene" tab and choose "Area2D" (by scrolling or typing in the search bar) to create a node.


Step 2 : Creating your character

Select your node and add a new one to it by selecting "+" (still in the "Scene" tab) and choose "AnimatedSprite" this time. It will allow you to give shape to your character by implement its picture and/or animations.


Repeat the step above and choose "CollisionShape2D" to give your character a hitbox. You can modify the shape of your collision by manipulating the internal hands but NEVER (ever, ever) the external ones !


Step 3 : Importing your assets

Create a file where you want all your assets to go into (animation sprites, background...) When it's done, copy-paste into the game folder you created. The editor will then load your assets for you to implement them in-game.


Step 4 : Giving life to your character

Select the AnimatedSprite node. In the inspector, select "Frames" to choose "New Sprite Frames". Then, choose the paper sheet icon with a plus to create an animation. Name it and drag and drop the corresponding pictures into "Animation Frames" (you can find in the "assets" folder you've loaded to the left of your screen).


Choose the animation speed (frames per second) and loop it if needed. Go back to the inspector to check the "Playing" option and now your character finally breathes ! ^^


Step 5 : Saving your progress

You probably already did it but you need to define your main scene fr the game to work. Create a new scene and call it "Main" and click the "Link" button to instantiate your character scene. Every progress you will make on your character scene will now be updated on your main scene. Use F5 lo launch the game.


Step 6 : Implementing the bakcground

Choose your "Main" node and add a "TextureRect" node to it. Then drag and drop your background picture to "Texture".


I hope this little tutorial will be useful to you ! Have a nice week !

 18 oct. 2018 -  Fabian Mosakowski - Game Art 2,   Godot