In the previous tutorial you learned how to install and run the Enigma-Dev environment. Now we will discuss the basics of the interface.
We will learn many things as we go along, now I will focus on the most important things.
The interface itself is a bit like file managers. The left side is "directories" and files, and the right side runs their contents.
I will immediately inform you that it is best to create prefixes for resource names. So that if you have an error in e.g. spr_hero you know that it refers to a sprite and not e.g. object. In square brackets I will add my prefix suggestions.
Sprites (graphics). This is the place where we store graphics for our game. [spr]
Sounds. This is where we store music and sound effects. [snd]
Backgrounds are the backgrounds for the game [bkg].
Paths are paths that objects can walk on. [path].
Scripts are a collection of functions that we write in the EDL language. Usually code is added here that can be global, independent of specific objects. [scr]
Shaders - This is the code that beautifies our game. Such code is executed by the graphics card. [shr]
Fonts. These can be added to manage text drawn by the DRAW function. Apart from choosing your own font, you can set its size or parameters. [font]
Timelines are a way of doing things over time. For example, you would have your opponent walk left for 6 seconds and then walk right for 6 seconds. However, Event Alarm is often used for this, but this does not allow for extensive timing control. [time].
Objects are items in the game that perform tasks. For example, a game character or an enemy. Based on various previous elements and code, the created objects are implemented. Objects consist of Events and Actions. [obj]
An Event is a miscellaneous collection of ... events. This is where we choose the interactions of the object. For example, pressing a key, or colliding with another object.
Actions define what should happen to the object if the Event is fulfilled. For example, when obj_bullet hits obj_hero.
Room. Objects can be placed here. These are usually game maps or interfaces of some sort. [rm]
Game Settings are all sorts of settings for building the game. In this menu we set the behaviour of the game (e.g. if it should start in Fullscreen, icon, game name etc.). In this menu you can also set modules, platforms and so on.
IT'S HELLO WORLD TIME
Hello World is a classic program (right after a program that does nothing). Its task is to display the text "Hello World".
Of course in the world of computer games this can be done in several ways, but I'll use the draw_text function to do it.
1) Add obj_helloworld. To do this, right click on Objects and select "Create Resource".
This will automatically pop up an Object with 3 Actions. Create, Normal Step and Draw. As we need Draw, we don't need to add this Event. Select it.
Now we need to add an Action. As we will be based on EDL code (using code is much more powerful), we need to select the "control" submenu and move the "Execute a piece of code" block to the "Actions" field.
This will launch the "Code" window, in which ... write the code.
At the beginning, of course, I suggest to create general comments. Enigma-Dev has the option to name the code block with a triple /. So let's create a block name of Hello World:
/// Hello World
If we have that, let's start with the text drawing function. This is the draw_text function, which takes 3 parameters.
- X position.
- Y position
- Text
In programming you often (always?) start by writing the name of the function first, and then in parentheses give the values to the function. In our case it is:
draw_text(10, 10, "Hello World");
That is: Write the text "Hello World" at position X: 10, Y: 10. We save the code with the Green accept button. We also disable the object by pressing the same symbol, with "Save".
Now we add Room. Right click on Rooms and select Create resources. Select obj_helloword from the Room menu and add it to Room and save.
We now press the "Play" button in the Enigma menu, which will build the game and run it. So we get our "game" with Hello World written on it :)