Chapter 3:
Entities; Populating your world

Entities:
As stated above "Entities" are the sprites that you put on your map for your player to interact with in a variety of ways.
The difference between an "entity" and a "sprite" is that when we refer to a "sprite" we are just talking about what it looks like and how it animates. An entity, has a few properties that designate how the sprite behaves when it is on a map. This means that there are a few options that we can assign to an entity, that affect a variety of its characteristics. We'll go into much more detail regarding an entities properties, but let's first look at how we can place one on a map.

Methods for Placing Entities:
There are two ways that you can place an entity on your map. The first way would be to code it in your maps .vc file, (like how we place "darin.chr" on our tutorial map with EntitySpawn()), and assign its properties using VergeC's built-in variables. Normally we wouldn't use this method, as it is long, and ultimately far more complicated than the method I am about to introduce. However, there are a few circumstances where this is the desirable method.
The other method, and the one we'll use, is to place it on your map using the map editor.

Maped3: Adding Entities
The first step to adding an entity is to first create one. We do this by clicking on the "Entities Layer" in maped3. Notice the highlighted section in the image.
Above the layer list, is a button that says "Edit Entities". Click it now, and a new window will open. At the bottom, click "Add New Entity". The once greyed areas now become available to edit.


These are all the properties we can assign to an entity. By adding/changing values we determine how the entity will function. Let's take a look at all the properties one at a time.

Types of Movement that you can choose from: First we said "L3". This is telling the entity to move Left 3 tiles.
We then put "R2". Here we're telling the entity to then move Right 2 tiles.
Next we put "U1". This tells the entity to move Up 1 tile.
We then put "D10", which tells the entity to move Down 10 tiles.
Finally, we said "B", which tells the entity to go back to beginning of the movement script and repeat what it's just done.

There are other codes we can use to do a few other things. These are "W", "F" and "Z".

*Phew* that was a lot to take in. Well, it just seems like a lot because you're just learning. This stuff becomes second nature real quick, so don't worry. :)
With this new found information, let's add "Crystal" to the map. Follow the steps and create a new entity. For it's CHR file, browse for "crystal.chr", and do whatever you like to its properties (but leave onActivate blank, we'll do something next for that). It will appear as a yellow block in the map editor, with a number on it. Save the map, and run verge.exe to see Crystal now on the map. Play around with the different options and see first hand what changing things will do to its behaviour. Use the tileset and add some trees or a house, and lay some obstructions down, etc. Experiment! And when you're content, move on to the next section.

Giving the entity meaning to its existence:
It's all fine and dandy that we have another person in our world now, but unless we give it *some* reason to be there (other than to fill space) she's pretty pointless. ~_^ So let's give her something to do.
We won't be adding any fancy way for her to talk to you just yet. The goal is to teach you how to make it so when you have a textbox function, you can use it to make her talk to you. In the mean time, we'll use another built-in function to cheat, and mimic her talking to you. Fire up "tutorial.vc" and add these lines:

void TalkToCrystal()
{
	MessageBox("Hola!");
}

Let's recap. We created a new script "void TalkToCrystal()", which makes a call to the built-in function "MessageBox()" and carries out what we tell it to do. In this case, when we call "MessageBox()" a small window will pop-up displaying any message we tell it to. So for us it will say "Hola!", and give you an "OK" button to push. It's kind of like the "Exit()" function we called way in the beginning, only in this case, after clicking "OK", the box will disappear and return you to your game.
Of course this action won't carry out unless we tell the entity that it's activation script is "TalkToCrystal", the script we just created. So, get back to the entities screen in maped3, select crystal's entity, and in the box that says "onActivation", put "TalkToCrystal". Save your map.

Now when we run our game, and activate Crystal, the message box will appear that says "Hola!", like the image above. How do you activate Crystal? By moving your player sprite up to her and pressing the "activation key". By default this is Enter. Try it out!

To Summarize, this is what you now know:




Table Of Contents      Chapter 4: Zones; Where, What and How?