Making an Interactive Treasure Map

Index

Stats

5,958 visits, 17,097 views

Translations

This tutorial hasn't been translated.

Tools

Creating the Map Events

1. In the Project panel, rename the default Event Sheet 1 to Map Events.

2. Create a new event sheet and name it Globals.

3. Open the Globals event sheet and add three global variables. CurLocation is the LocationNumber of the current (last visited) location. LatestKnownLocation is the latest location to be discovered. (For tutorial purposes, the locations have to be discovered in order using the logic implemented here. You can modify the logic to suit your needs for your own game.)

4. Try running the project. You'll see gray shapes arranged over the blank map. This isn't what we want! The problem is that the masks need to be on the same level as the blank map--the layer that has Force own texture set to Yes. We have them on a separate layer so that we can hide the blank map while we arranged the masks.

You could move all of the masks to the BlankMap layer at design time, but we'll use an event to do it at run time. The advantage of doing it with an event is that you can more easily see to make adjustments to the masks if you keep them on a separate layer from the blank map.

5. Go to the Map Events event sheet and add an On start of Layout event, with an action to move the Location objects to the BlankMap layer. Note that since there are no conditions to choose Location objects, this will move all of the Location masks.

Now try running the project. That's more like it! However, we don't want all of the masked areas revealed at once. We want them to appear over time based on what the player does.

6. In the Project panel, select the Location object. Go to the Properties panel and set the Initial visibility for all of the Location objects to Invisible. Now if you run the project all you see is the blank map.

7. Go back to the Map Events sheet and add a sub-event to the On start of layout event to turn the Location mask visible if it is a known location as shown in the following figure:

Now when you run the project the colored map will be visible only under the first Location mask (Location 0).

8. Add an On Touch event so that when the Location object is touched the game goes to the layout named in Location.Layout. The Location is visible condition is needed or the hidden locations will work when we don't want them to.

Now that the Location objects respond to a touch we need some levels to go to.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!
  • Hi, links to .zip and .capx file are no longer valid (Dropbox error404). Any chance of an update? Thanks.