• Home
  • Design worlds
  • Download
  • Sources
  • Documentation

SourceForge.net Logo

Start - Back - Forward


Shifting ground

The second map is going to be a little simpler, just a bit of fun for the player. He should have to go through a maze of "shifting ground" (pieces of ground, which shift the avatar into a specified direction when entering them); that's what it should look like:

+-------------+
|  W  E E S   |
|  +N WWWWW + |
|   N E E E | o
+o------------+

Create Shift.txt und include it into the driver:

#Shift.txt

Base map

First, we'll create the base map, without the doors and shifts. You may format the map as you like,

karten:

shift = 15 5
w w            w w w w w w w w w w w w w
w e            e e e e e e e e e e e e w
w e            e w e e e e e e e e w e w
w e=shift_name e e e e e e e e e e w e=shift_steps w
w w            w w w w w w w w w w w w w

Notice just the two coordinate names; the former one (on the left) is the target of the door in our last map. Give it a try, it should work so far.

Shifts

To include the shifts in the map, we need four new prototypes (one for each shifting-direction):

/* Prototypes */

prototypen:

// Shifts
s_n =	Rutsche(N, "Images/ShiftN.png")
s_e =	Rutsche(O, "Images/ShiftE.png")
s_s =	Rutsche(S, "Images/ShiftS.png")
s_w =	Rutsche(W, "Images/ShiftW.png")

The class net.daniel_kraft.wissenSchafft.standard.Rutsche implements such a behaviour, the parameters are the direction to shift and the image to display. As usual, one can add a third argument to give the background image.

With these new prototypes, the map becomes:

karten:

shift = 15 5
w w w w w w w w w w w w w w w
w e            e s_w e   e s_e e   s_e e   s_s e e e w
w e            e w   s_n e s_w s_w s_w s_w s_w e w e w
w e=shift_name e e   s_n e s_e e   s_e e   s_e e w e=shift_steps w
w w w w w w w w w w w w w w w

Make sure it works.

Finally: The doors

Last but not least we need two doors and a new prototype for them:

// Doors back & forward
s_d =	Teleporter("Images/Teleporter.png", "Images/Bricks.png")

The Teleporter class is just a simple door, which can't be locked. The parameters state the image and the background, which is optional.

In the map we finally get:

karten:

shift = 15 5
w w w w w w w w w w w w w w w
w               e e s_w e   e s_e e   s_e e   s_s e e e w
w               e e w   s_n e s_w s_w s_w s_w s_w e w e w
w e=shift_name	e e w   s_n e s_e e   s_e e   s_e e w e=shift_steps s_d(steps_shift)
w s_d(name_shift) w w w w w w w w w w w w w

This doesn't work as steps_shift is currently not defined, but it will be defined in the next section.


Start - Back - Forward