Differences

This shows you the differences between the selected revision and the current
version of the page.


wmebook:ch1_3 2008/01/10 11:16 wmebook:ch1_3 2008/01/10 11:27 current
Line 54: Line 54:
In section 5 click on the black figure and navigate to “data->actors->molly->molly.actor” In section 5 click on the black figure and navigate to “data->actors->molly->molly.actor”
-Molly appears on the screen. Notice, that if you bring her outside of the floor region, she turns red. Click with her anywhere in the screen, and use the **<** button. Her position gets filled automatically. If you no longer need her in the screen, simply click on the crossed out black figure in section 5.+Molly appears on the screen. Notice, that if you bring her outside of the floor region, she turns red. Click with her anywhere in the screen, and use the "<" button. Her position gets filled automatically. If you no longer need her in the screen, simply click on the crossed out black figure in section 5.
Now you can only select which direction actor should be facing upon reaching the place and you’re set. Also there’s another button “>” which position actor to the coordinates written in Walk to. Now you can only select which direction actor should be facing upon reaching the place and you’re set. Also there’s another button “>” which position actor to the coordinates written in Walk to.
-**Sound panning** means that if the entity has sound attached to it pans from left to right according to the entity position on the screen.+**Sound panning** means that if the entity has sound attached to it, sound pans from left to right according to the entity position on the screen.
**Ignore items** is here for the case that you don’t want the entity to interact with inventory items. **Ignore items** is here for the case that you don’t want the entity to interact with inventory items.
Line 81: Line 81:
Let’s get back to our Node discovery and let’s try to add the last kind of Node. It’s the **Region Entity**. Let’s get back to our Node discovery and let’s try to add the last kind of Node. It’s the **Region Entity**.
-In section 1 click on the yellow icon and select **Add Region Entity**. Immediately a red rectangle appears. Now it’s something in between Region and Sprite entity. You can manipulate it in the scene as you can the region by adding or removing vertexes and positioning it, but you can set the properties similarly to the Sprite entity. So what’s the purpose?+In section 1 click on the yellow icon and select **Add Region Entity**. Immediately a red rectangle appears which acts as something in between Region and Sprite entity. You can manipulate it in the scene as you can the region by adding or removing vertexes and positioning it, but you can set the properties similarly to the Sprite entity. So what’s the purpose?
It’s one of the most useful nodes in WME. Imagine you have a door in this scene and you’ll never want to include them in the game design in other way then making actor say something like “This door is welded shut.” If you had to use Sprite entity for such interaction your game would gradually become very large. By using region entities you can exactly define what in the screen is interactive and what not. Also there are much more benefits coming from the fact that Region Entities are independent on the graphics which will become obvious when we’ll start doing a little game together. For now practice a bit and make this region entity you’ve just created cover the door and set its name to Door. **Save your scene**! It’s one of the most useful nodes in WME. Imagine you have a door in this scene and you’ll never want to include them in the game design in other way then making actor say something like “This door is welded shut.” If you had to use Sprite entity for such interaction your game would gradually become very large. By using region entities you can exactly define what in the screen is interactive and what not. Also there are much more benefits coming from the fact that Region Entities are independent on the graphics which will become obvious when we’ll start doing a little game together. For now practice a bit and make this region entity you’ve just created cover the door and set its name to Door. **Save your scene**!
Line 97: Line 97:
Now I know I am a bit ahead of you, but also I don’t like when you do something you don’t understand. scene_init.script is the file, which gets executed right when the scene is loading. So it’s the entry point of every scene. What we did was changing the actor position so it’ll be in the floor region which means that it will be able to walk. If your actor is positioned outside the region, it’s stuck in place and can’t move. You already played with actor positioning in the scene edit so you can easy see, that the provided values are reasonable for our floor region. Now I know I am a bit ahead of you, but also I don’t like when you do something you don’t understand. scene_init.script is the file, which gets executed right when the scene is loading. So it’s the entry point of every scene. What we did was changing the actor position so it’ll be in the floor region which means that it will be able to walk. If your actor is positioned outside the region, it’s stuck in place and can’t move. You already played with actor positioning in the scene edit so you can easy see, that the provided values are reasonable for our floor region.
-Ok, save the file and close it. Now in the Project Manager set the Startup Scene in Debugging settings Section to our warehouse.scene (browse for it). And let’s try our nice scene. Press f5 and walk around with molly. Of course ignore the bubbles, they’re here from the global demo setup, but focus on two things:+Ok, save the file and close it. Now in the **Project Manager** set the Startup Scene in Debugging settings Section to our warehouse.scene (browse for it). And let’s try our nice scene. Press f5 and walk around with molly. Of course ignore the bubbles, they’re here from the global demo setup, but focus on two things:
1. Door is interactive now. If you move over it with the mouse, the cursor change and the caption Door appears. Neat, isn’t it? 1. Door is interactive now. If you move over it with the mouse, the cursor change and the caption Door appears. Neat, isn’t it?
-2. Ah-oh, you can walk directly through the boxes. That’s too bad. Gamers will throw some rotten tomatoes on you, unless we fix it.+2. Ah-oh, you can walk directly through the boxes. That’s too bad. Gamers will throw rotten tomatoes at you, unless we fix it.
-Before we can fix it, I have to tell you a secret about WME rendering. When WME draws a scene for you, it looks in the layer, starts with the first node and draws it (in our case background), then it looks below and draws the next over it, then the next etc. So what do we have there? A way how to put objects in front of others! But how about our poor actor? How does she get sorted correctly? That’s where regions come in! You can see, that our actor must be positioned on some region otherwise she’ll refuse to walk. But this region is also positioned in the layer (see section 1). So let’s try a little experiment: add a sprite entity to our scene (yellow icon in section 1). Set the sprite to crates.jpg and position it exactly over the crates so it will replace them. +Before we can fix it, I have to tell you a secret about WME rendering. When WME draws a scene for you, it examines the layer, starts with the first node and draws it (in our case background), then it looks below and draws the next over it, then the next etc. So what do we have there? A way how to put objects in front of others! But how about our poor actor? How does she get sorted correctly? That’s where regions come in! You can see, that our actor must be positioned on some region otherwise she’ll refuse to walk. But this region is also positioned in the layer (see section 1). So let’s try a little experiment: add a sprite entity to our scene (yellow icon in section 1). Set the sprite to crates.jpg and position it exactly over the crates so it will replace them.
Trick: sometimes the positioning is a bit tricky. But you can use keyboard (arrow keys) to move entities around and also you can switch the reference background by pressing the space key. If you press space, your entity is invisible and this way you can very fast bring it to the correct position. Trick: sometimes the positioning is a bit tricky. But you can use keyboard (arrow keys) to move entities around and also you can switch the reference background by pressing the space key. If you press space, your entity is invisible and this way you can very fast bring it to the correct position.
Line 130: Line 130:
And theoretically we’re set. So let’s save our scene and try it again! And theoretically we’re set. So let’s save our scene and try it again!
-Hmm, something is rotten. Molly doesn’t seem to find her way around the scene anymore. Why is that? Let’s introduce a new concept – WME pathfinding. +Hmm, something is rotten. Molly doesn’t seem to find her way around the scene anymore. Why is that? We have to introduce a new concept – WME pathfinding.
I’ll start to introduce this concept by two images: I’ll start to introduce this concept by two images:
Line 162: Line 162:
You can see 4 waypoints (red crosses) around the crates. It’s enough for actor to find her way around the whole scene. Just save and try it for yourself. You can see 4 waypoints (red crosses) around the crates. It’s enough for actor to find her way around the whole scene. Just save and try it for yourself.
-But there is still something rotten. It seems that the actor is sometimes not correctly covered with crates. Why’s that? Remember our hot spot discussion in the Sprite editor chapter? Well, that’s the cause! So let’s fix it. In the project manager add new sprite to the warehouse folder.+But there is still something rotten. It seems that the actor is sometimes not correctly covered with crates. Why’s that? Remember our hot spot discussion in the Sprite editor chapter? Well, that’s the cause! We're going to fix it right now.
-Insert one frame (crates.png) and move the hotspot to the bottom of the crates. This hotspot falls in some region (our block region) and we can easily set the scene sorting order. +In the project manager add new sprite to the warehouse folder. Insert one frame (crates.png) and move the hotspot to the bottom of the crates. This hotspot falls in some region (our block region) and we can easily set the scene sorting order.
{{wmebook:s16.jpg|}} {{wmebook:s16.jpg|}}
Line 170: Line 170:
Save your sprite and then in Scene Edit change the sprite entity from png file to sprite file. Save and test the scene. Finally it works. That was quite some work, wasn’t it? Save your sprite and then in Scene Edit change the sprite entity from png file to sprite file. Save and test the scene. Finally it works. That was quite some work, wasn’t it?
-But I promised to show you a shortcut, didn’t I? The shortcut is called a free entity and it’s useful for smaller scene objects, so the crates are serious contender for that.+But I promised to show you a shortcut, didn’t I? The shortcut is called a free entity and it’s useful for smaller scene objects, so the crates are serious contenders for that.
-But what are the **free entities**? They are entities which (in the similar way to your actor) are being drawn depending on where in the scene they are placed (in other words, in which region is positioned their hotspot). +But what are the **free entities**? They are entities which (in the similar way to your actor) are being drawn in respect to their position in the scene (in other words, in which region is positioned their hotspot).
Let’s try it. First select the “Behind” region and delete it (red X), then delete “Crates” sprite entity (red X). Resize the floor region so it covers the whole ground. Now switch to the layer called **“Free entities”** and create a sprite entity in the way you’re already used to. Name it crates and use the sprite file we’ve created earlier. Position it to the correct place, save your scene and test the game. See? It works in exactly the same way as before. Let’s try it. First select the “Behind” region and delete it (red X), then delete “Crates” sprite entity (red X). Resize the floor region so it covers the whole ground. Now switch to the layer called **“Free entities”** and create a sprite entity in the way you’re already used to. Name it crates and use the sprite file we’ve created earlier. Position it to the correct place, save your scene and test the game. See? It works in exactly the same way as before.
Line 198: Line 198:
On the layer bar you can also see two green lines. One is horizontal and one vertical. **The horizontal green line is for defining scale**. Your scene already contains two of those scale lines. In the real world you see something which is called perspective which is the reason why people far away appears to be smaller than they really are. In WME when using 2d actors we have to simulate how much gets the actor smaller when she walks to the camera or away from the camera. Setting scale lines is pretty simple. Either right click on existing scale line to adjust its properties or remove it altogether or simply drag is around to adjust y position. Let’s try some down-the-rabbit-hole effect. Select the scale line which reads 70%, set its properties and set the scale to 20. Then drag this scale line so it goes through the middle of the crates. Create a new scale line which goes through the light above the warehouse door. Set its value to 5. Now save your game and test it. Neat, eh? On the layer bar you can also see two green lines. One is horizontal and one vertical. **The horizontal green line is for defining scale**. Your scene already contains two of those scale lines. In the real world you see something which is called perspective which is the reason why people far away appears to be smaller than they really are. In WME when using 2d actors we have to simulate how much gets the actor smaller when she walks to the camera or away from the camera. Setting scale lines is pretty simple. Either right click on existing scale line to adjust its properties or remove it altogether or simply drag is around to adjust y position. Let’s try some down-the-rabbit-hole effect. Select the scale line which reads 70%, set its properties and set the scale to 20. Then drag this scale line so it goes through the middle of the crates. Create a new scale line which goes through the light above the warehouse door. Set its value to 5. Now save your game and test it. Neat, eh?
-The **vertical green line** is for defining rotation. This may be useful for someone as it can emulate the infamous fish eye camera effect but I don’t think I’d ever use it and it’s up to your experiments to play with it. Only note, that if you’re going to use this feature, you have to set the “Rotatable” attribute for your actor. We’ll get to it later.+The **vertical green line** is for defining rotation. This may be useful for someone as it can emulate the infamous fish eye camera effect but I don’t think I’d ever use it and it’s up to your experiments to play with it. Only note, that if you’re going to use this feature, you have to set the “Rotatable” attribute for your actor. We’ll get to it in the actor's chapter.
The last issue covered in this chapter is **“Properties”** tab located on the layer. The last issue covered in this chapter is **“Properties”** tab located on the layer.
Line 204: Line 204:
{{wmebook:s20.jpg|}} {{wmebook:s20.jpg|}}
-Here you can look at the scripts which are attached to the scene (by the default template you’ll find there always scene_init.script and scene.script. You can set some custom attributes for the scene, you can set if the Scene in the game remembers changes to the nodes (typically you want for example to hide some sprite entity and if you reenter the scene you want that it’s still hidden). You can pick colors for depicting scene elements in the editor, set the margins and finally set up what elements should be visible in the editor.+Here you can look at the scripts which are attached to the scene (by the default template you’ll find there always scene_init.script and scene.script). You can set some custom attributes for the scene, you can set if the Scene in the game remembers changes to the nodes (typically you want for example to hide some sprite entity and if you reenter the scene you want it still hidden). You can pick colors for depicting scene elements in the editor, set the margins and finally set up what elements should be visible in the editor.
On closing of the scene editor chapter I want to stress that I on purpose didn’t touch the 3D options. We’ll get to them much later when you’ll have the basics of the wme game covered. I know that some of you may be impatient to start your great 2 1/2 D games, but trust me, everything will be much faster if you went through the basics without skipping to much more complicated tasks. On closing of the scene editor chapter I want to stress that I on purpose didn’t touch the 3D options. We’ll get to them much later when you’ll have the basics of the wme game covered. I know that some of you may be impatient to start your great 2 1/2 D games, but trust me, everything will be much faster if you went through the basics without skipping to much more complicated tasks.
 
wmebook/ch1_3.1199960178.txt.gz · Last modified: 2008/01/10 11:16 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki