Using the templates

Top  Previous  Next

Last month I have decided to include both versions of the template project inside the downloadable "Resources"; experiment_init was used as a starting point, while experiment was the finished version of the template project. I didn't change my mind ;)


This time we will learn to work with the rope / ladder template script. Let's start by opening the exp1.wmp file in Wed. Then, we have to choose File -> Project Manager to bring on the "Project Manager" window.




This is the window that tells you (among other things) that you need A6.50 or a newer version of it if you want to play with these templates, so make sure to update the engine to the latest official version as often as possible.


Click the "Add" tab, and then choose "Climbing objects" from the "Script" drop-down list, just like in the picture below.




Click the "Add Script -=>>" button to add the "Climbing objects" script to our project.




As you can see from the "Actions" window in the above picture, the rope / ladder script uses two actions; we need to attach these actions to 2 small entities / sprites / whatever. But first, let's build a ladder!


Add a "medium" block to the level, make it taller, and then texture it as you want it.




I have decided to use a different texture for one of the faces; this will show us where the ladder will be placed. In a "real" game, you would add a passable ladder model close to this face of the cube. Here's how my virtual ladder looks like:




Come really close to the cube, press space and... surprise! You can jump on the top of the block! Since we didn't add a ladder to the level yet, we've got a problem. We must decrease the height of player's jump right away - we aren't building Kangaroo Strikes Back 2, after all...


Right click player's model, and then choose "Behavior" to display player's customizable options.




Change the "Jump" parameter from 275 to 75, as indicated in the picture above, press "Save" and then build the level again. You will see that the player jumps much more like a human now, so we can get back to our business.


As you know, we need 2 entities for our ladder's starting and ending points. Fortunately, we've got the lovely kugel.mdl inside the project's folder, so let's add 2 instances of it close enough to our tall block, just like in the picture below.




As you can see, the entities are close to the block, but aren't touching it; if you move them too close, the ladder won't work. Now let's attach the action named BipedClimb01_Start to the sphere model at the bottom. Oh, you did that already? Let's right click the model and examine its "Behavior" panel.




We need to change some values here. First of all, let's set "Speed" to 3; our player isn't a ninja granny, after all. Then, let's increase "Range" from 90 to 200; this will allow the ladder to scan a larger area, thus making it easier for us to start climbing. Finally, we must set the "Icon" parameter to 1; we'll use the same value for the entity that acts as the top of the ladder.


This is how the starting point should look like:




Press "Save", and then select the sphere at the top of the ladder. Right click it, choose "Properties", click its "properties" tab, and then get the name of the entity as it is stored in Wed.



Select the name of the entity using the mouse, as if you were selecting a block of text in your favorite text editor. Press Ctrl + C to copy the name of the entity to the clipboard.




Time to get back to the starting point of the ladder! Dismiss the window above, select the entity that will serve as a ladder bottom, and then right click it and choose "Properties". Click the "Attached" button.




This will bring on another window, which gives us a list with all the entities that can be attached to the entity that serves as the bottom of the ladder.




Right click the empty text box at the top of the window, and then choose "Paste". The name of the entity that will be used as the top of the ladder should now be attached to our entity.




Press OK to get rid of the window. Our bottom and top parts of the ladder are now connected - good job!


Important note: the names of your kugel entities will (almost for sure) be different; use your own names - don't copy them from here!


Select the kugel entity at the top of our virtual ladder, and then attach it the action named "BipedClimb01_End". Dismiss the "Object Properties" window, right click the entity again and then select "Behavior" - you will see the following window.




Set "Icon" to 1, the value that was used for the bottom of the ladder as well. Press "Save", and then save, build and run the level.




Move close to the kugel entity that's used as the bottom of the ladder; you should see a "1" popping when you come closer than 200 quants to it. Make sure that you are in a position where the "1" is visible, and then press the Ctrl key to put the player into the climbing mode, placing it at the bottom of the ladder automatically. You don't need to press and hold Ctrl; a simple key push will do the job.


Press "W" to climb or "S" to descend; you can't fall off the ladder, so feel free to look up and down if you want to. We can now climb to the top of the ladder, but we can't land on the top of our level block because the kugel entity isn't that close to the block. What can we do to change that?


I know! The action attached to the top of the ladder has some parameters that take care of that, so let's customize its "Behavior" right away:




The ExitX, ExitY and ExitZ parameters will teleport the player, using the X, Y, Z offset that are input here, as soon as the player has reached the top of the ladder.


Since I have placed the entity that will be used as the top of the ladder at a convenient height, it looks like I'll only have to set ExitX to about 50 quants; this should make the player land at the top of the block. I've got the approximate value of 50 quants from Wed's top view, in case that you were wondering.




Here's how the modified "Behavior" window should look like:




If you don't use my demo, you might need to use another value for ExitX, and maybe even set non-zero values for ExitY and ExitZ. Anyway, I'll press "Save", build the level and see if everything works as expected.


It worked! Can you believe that? Of course that you can (and you should!) make the two kugel entities invisible in the final version of your game.