Walk to bone, but don’t forget food

February 19th, 2006

On the Adobe Director Forums someone posed a question about how to get started with a “virtual pet.” There are different ways to think about such things. As a physics guy I like to think about pets that obey rules of physics. In this example I set up a pet (let’s just say it is a dog) that will wander around on the screen. If you throw a bone (by clicking on the stage) it will head for that bone, but on occasion it will see something else of interest and forget about the bone. It slowly gets hungry, and if you don’t coerce it in to getting to the food bowl bad things will happen.

The behavior has a nifty “chase” algorithm in it. I’ll probably do more with this file in the future to expand upon my pet.

Can you call that a virtual pet?

The code uses a few DirMX 2004 specific features (named sprites), but could quickly be adjusted to run in older versions (these issues are commented in the code). The graphics in this one are rather primitive to say the least.

Walk to the bone source code.

Entry Filed under: Basic Lingo,Demo Files

1 Comment Add your own

  • 1. MultimediaGuy  |  February 21st, 2006 at 8:51 pm

    I noticed an error in the source code and updated that this evening. Had a line that could end up with the divide by 0 error. Not good!

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Director Sites

Calendar

February 2006
M T W T F S S
    Mar »
 12345
6789101112
13141516171819
20212223242526
2728  

Archives

Recent Posts

Recent Comments