BrainBlitz.org

September 24, 2009

AS3 A* pathfinding demo

Filed under: Programming — Anthony @ 4:11 am

Space to step the algorithm, r to reset, and click a square to toggle it’s “walkable” status.

I created this as I worked through the excellent A* Pathfinding for Beginners tutorial by Patrick Lester, bless his heart. My app is actually not 100% done, in a way that will make it sometimes not take quite the shortest path.

Note that this demo, as opposed to Patrick’s tutorial, does not allow for diagnol movement (as my final application will use a more zelda-esque movement).

Here’s the code.

September 2, 2009

Meta-Lifehack

Filed under: Blogorrhoea — Anthony @ 2:59 pm

Stop reading inspirational blogs; stop reading about how to be more efficient; stop reading “20 lifehacks you can’t live without.”

Nike says it best: Just Do It.

I wonder how many would-be successful people will never BE successful, because they spend so much time READING about how to be successful.

D.eval() Reloaded

Filed under: Programming, Uncategorized — Anthony @ 12:48 am

An evolved version of the simple D.eval() app in the previous post can be found on this page. Yes, it’s so cool I had to make a page just for it.

Again, it’s really a simple application, and uses rather little of the API’s capability. Even so, its raises exciting possibilities.

August 31, 2009

eval() for Actionscript 3

Filed under: Bloody Cool, Programming — Anthony @ 4:33 am

Quite a long time ago I came across this page: http://riaone.com/products/deval/. Being in the thick of BoxCAD, I bookmarked it with the intent of exploring it later.

It’s been over a year now, since I first bookmarked it. Life interfered, see, so I haven’t done much of ANY programming for nearly a year. Anyway, I set myself, today, to the arduous task of learning something new.

D.eval is basically an AS3 interpreter that will run arbitrary code on the fly.

I was floored by the possibilities this offered. Obviously at the time, BoxCAD was on my mind, and so my initial excitement was so directed. Over time though, new possibilities made themselves evident. Basically, this API opens the door to limitless application extensibility. Using BoxCAD as my primary example, this API could allow end-users to add new, powerful functionality to the application, in a language they already know (my target audience in BoxCAD was AS3 developers).

Or, as in the swf below, it can serve as a very interactive tutorial tool. Go ahead… define functions, variables, loops, etc, and then run it. As you’ll note in the default code, variables are created and dynamically typed on the fly.

Now, for the really nifty thing, copy this in: removeChild(txtDevalOut);

txtDevalOut is simply the name of the output TextArea object. The base class extends sprite, so all sprite methods are available (i.e. removeChild, addChild, etc).

The way I set up D.eval in this little app is such that the context is that of the base class. So you have access to every property and function of the compiled class! The application can modify itself.

There are so many possibilities here. Mutating/Genetic code, dynamic loading of user-coded modules, scripting, etc.

Thanks to the folks at http://riaone.com. The simple app in this post is just a trivial example of the capabilities of the API.

Here’s the code. You’ll have to install the component (free) from the aforementioned website.

  • Print this article!
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • Yahoo! Bookmarks
« Newer PostsOlder Posts »

Powered by WordPress