Simon Potter's
Complete
Furcadian Guide
DragonSpeak 105
Loco-Motion!
Rides are unquestionably one of the more
interesting and entertaining things you can create using DragonSpeak. It
takes quite a bit of code, so patience and determination are required in
order to create an effective ride.
The Slide - A Furcadia Classic The technique for building a slide is so common it is often referred to as "slide DS." The "slide DS" was improved some in the recent update to make the animation smoother, but I'll show you an extra trick to make your slide look even better. A slide is a series of teleports based on a single trigger. Here's the concept: When a furre does something,
When a furre does something,
When a furre does something,
Now you might think that the furre has to keep doing something in order to move. Not so. DS is executed line by line so if a furre "does something" once, it will trigger every line of code starting with that cause. Let's set up a slide now. We'll put a gray orb at position (26,31) to use as a trigger and place a line of water tiles in front of it heading northwest. (0:7) When somebody moves into position
(26,31), (the gray orb is here)
So far it looks like a simple teleport. Now let's add the next lines. (0:7) When somebody moves into position
(26,31), (the gray orb again)
Notice we reused to the same trigger and moved the furre ahead one more square. Remember, the furre need only touch the orb once but every (5:14) line will be executed because the DS "remembers" that the furre touched the orb. One trigger can set off multiple effects. (0:7) When somebody moves into position
(26,31),
Same trigger, move the furre ahead 3 squares. Get the idea? You can keep this up as long as you like, moving the furre ahead one square each time. The DragonSpeak is executed line by line and it "remembers" that you touched the gray orb until is gets all through every line of dragonspeak. So your furre is propelled from one end of the slide to the other. Easy enough? Now a special trick: to slow the slide animation down a bit you could add this line after each (5:14) line above: (5:1000) redraw the screen and show everything that's just changed. Forcing a screen redraw each time the furre is moved one square will add a slight delay and make the movement even more visible. It isn't necessary, but you may want to try it and see if you like the slower rate of movement. Coasters and Trains and Boats and Planes Coaster rides work similar to slides except that we are also moving an object along with the furre. SInce we are moving a chair along as well, the coaster should probably not move as fast as a slide. We can control the rate of movement by using timers. Let's build a simple train. We'll lay out some tiles in a row and place a chair on it to move along with the furre. (0:100) When # seconds have passed,
offset by #,
There's the basic code for a ride. Simple! In fact, its so simple its hard. Here's why: We just moved the furre and the chair from square 1 to square 2. Now we move them from square 2 to square 3, right? Wrong. If we write the DS in order from 1 to 2 to 3 etc the furre would scoot down the track in ONE move like a slide! Why? Remember, DS reads from top to bottom and executes line by line. So if the first thing it does is move the furre from square 1 to square 2, what happens when it gets to the next line? Right! It moves the furre from 2 to 3, then 3 to 4, all the way through the DS. Fortunately we can outsmart the DS with a little trick. We write the DS for the LAST move of the ride FIRST. Now what happens? We have a furre at the start of the ride and the first thing the DS sees is the last move of the ride so nothing happens. It goes to the next line and sees the next to last move of the ride so again nothing happens. It finally gets to the bottom of the DS and sees it should make the first move of the ride so it does. Now the DS starts over at the top. The timer kicks off and it works down until it moves the furre again. By writing the DS in reverse order, we make it wait and use the timer each time before moving the furre. Is your head hurting yet? I've created a sample dream you can download and see how it all works. Click here to grab the file. Upload the dream and study the DS. Soon you will have that ride you want! You can use this code to build a ride which goes farther and carries more furres if you like. You could also substitute a boat or cart for the chair to create any type of ride you like. The process is always the same. Timer goes off, move the object and furre one square. That's it! You are now an expert in ride-making technology Furcadia style. Does this give you some ideas for making things like a boat or cart you could move manually? Next up - Temporal Mastery, also called
more on using timers. :-)
|