Translations of this page:

This is an old revision of the document!
—-

1.3. Scene Editor

As both scenes in the demo have too many things going on, we’ll start something simpler. In the Project Manager right click the folder scenes and choose Add scene. From the left side choose a template “Empty Scene 800x600” and name the scene warehouse.
Then locate the folder warehouse in your sandbox→scenes folder and copy the contents of Chapter 1 resources inside. Double click on the warehouse.scene in the Project Manager to open a Scene Editor.

As you can see in the section 4, your scene can consist of many layers, but we’ve selected the main layer for now and we’ll get to the purpose of multiple layers later. Also you see there Waypoint groups and Free entities. Let’s demonstrate how to use them after we get used to the logic of our Scene editing.

For now we’ll focus on sections one and two:

Tip: You can see that next to each scene element in the Scene Editor is a little checkbox. You can uncheck it to make the Node invisible and disabled at the same time. Shortcut for that is a keyboard
key “space”. This sets the internal attribute of the Node called Active to either true or false. More on that comes later.

Before we try to experiment with the scene, let’s clarify a couple of terms again. In WME each element of the scene is called Node. It’s important later because you can from your script reference every scene node. Now let’s see what nodes are available. The third image from the left in section 1 creates a region.

Region is used for actors and it serves several purposes:

  1. To show where actor can go (floor).
  2. To block actor from entering certain places.
  3. To decorate actor with a color (for example if there is a blue light from the sign player can get blue when entering the region.
  4. To make a trap region – upon entering some game event is triggered.
  5. To help determine where actor stands. This is crucial for z-order to know when actor stands in front of objects and when behind.

Some time there is confusion with region entity, but I’ll try to clarify the difference. So again note the reason why we have regions → Only for actor’s movement on the screen.

Next to it you find a yellow icon which lets you select between sprite entity and region entity. It also has written sound entity, but this one is grayed out (you can use it as a free entity only).

Sprite entity is an entity which puts a graphic in your scene. You can put here single image or sprite constructed in the Sprite edit. As you can see, we have one sprite already there → the image of the bluish background. We’re going to change this now.

In section 2 you see that the first column is Name. This is important parameter as in our scripts we’ll find the Node under this name. Let’s leave background there. Next line is Caption. This line is used for interactive Nodes. When you move your mouse over them, you can easily display a caption according to this field.

Sprite points to the filename which is being displayed here. Let’s change it and locate the file background.jpg in the data→scenes→warehouse instead.

Cursor is another goodie. You can set here a specific cursor, which appears when you move your mouse over the Node (provided it’s interactive). This way you can simply make intelligent contextual cursors in your game.

Font allows you to set a specific font for the Node.

Item allows you to couple the entity with an inventory item. More about this will come when we’ll be playing around with inventory.

Scripts are here for attaching (dramatic pause) scripts to our Node. This way we’ll be handling interactions.

Custom is here for setting custom attributes to regions. For example you can to regions set the surface type so the actor can have surface dependent sound of steps. But I don’t want to rush too fast ahead.

Pos is position of the sprite entity on the screen.

Scalable means that you can scale the entity programmatically.

Interactive means that the Node gets recognized by mouse! This is vital for all entities which are to be clicked on.

Colorable means that the Node is affected by the decoration region.

Next line is dedicated to the actor. Let me explain why it’s here. Normally, when you click on the object, the actor walks to some place, maybe turn to the object and comment or interact with it. To make this process faster, WME offers the way how to handle the situation with ease. Either you can fill in position of the actor manually, or you can use the following trick:
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.

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.

Ignore items is here for the case that you don’t want the entity to interact with inventory items.

Let’s abandon Sprite entities for now and get back to the Regions. We already have one region in our scene. So let’s play with it for a while. Select the floor region in the section 1 and look at the two buttons x+ and x-. The first one adds a vertex to the region, the other deletes it. You can also use + and – keys on the numeric keyboard.

As you selected the region, its color is now red and you can see the four vertexes in the corners. Simply left click them and you can move them as you wish. Use x+ button and add two vertexes by clicking on the region line and shape the region as follows:

Now look at the section 2.

Again you see a Name where you can name the region for your convenience when you’ll be referencing the region from the script. Under you see three types of region:

Layout – means that it’s the main factor for deciding where in the z-position actor stands. Decoration – means that the region mixes its color with actors color (neon light example).
Blocked – is here for places where actor can’t enter.

You can also set a special scale for the actor (you can make him very small upon entering special region (some of you remember Sam and Max: Mystery Vortex location).

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?

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!

Before we get further on, I have a special task for you so listen closely. In your Project Manager navigate to scenes→warehouse→scr. This is the folder where all scripts are located. Double click the file scene_init.script and it opens.

You should immediately see the line which reads:

[code]actor.SkipTo(400, 400);[/code]

change it so it will read:

[code]actor.SkipTo(733, 562);[/code]

 
wmebook/ch1_3.1196869708.txt.gz · Last modified: 2007/12/05 16:48 by metamorphium
Recent changes RSS feed Creative Commons License Driven by DokuWiki