Virtual Polyhedral Dice

May 25th, 2009

I’ve been interested in learning how to play D&D for a while and I recently acquired the Player’s Handbook so I could read up on the game before I ventured out into said game with others. One of the required items is a set of polyhedral dice for determining various things throughout the game, as I’m sure you all know, and since I didn’t own a set, I made one. It’s very straight forward but I wanted something a little more interesting to look at than text boxes.

This movie requires Flash Player 9

Searching for Elegance

March 23rd, 2009

When you create multiple connections from the same module, they accumulate graphically as they should.  Previously though, they didn’t deccumulate (if I may make up a word). New connections were added to total number of connections a module had, even if they didn’t have them anymore.  I had simply forgotten to reduce the number of outputs.  No biggie.  But then I found something very frustrating.  If you create multiple connections between two modules. then kill them in the opposite order, everything works perfect.  Try and kill them out of order and poof, the whole system breaks down.  I tried one solution, and it kinda worked, but I quickly realized that I’d need to create separate lists  of connections for each side of the module and it just felt clunky.  Plus, it had some bugs.  I just think there is a more elegant solution eluding me at the moment.

This movie requires Flash Player 9

Finally, Visable Lines

March 19th, 2009

Finally you can have your connections and eat them too. Or see them anyway. I’ve selected a nice red dashed line for the “pre-connection” wire. I hope you like it. In this version (0.1.99) I’ve also fixed some problems that cropped up when I created the lines.  For modules that were in front of other modules (z depth), when you dragged the wire over the left input area of the intended module, it wouldn’t activate the input area -I think because the line (which is part of the first module) was in front of it.  So…now, when you start a new connection, it moves the parent module down to the bottom of the display stack. When just dragging a module, I decided to pull it up to the top of the stack.

I played briefly writing my own dashed line class, and actually wrote a very simple function that drew the connecting line with 10 equally sized dashes and spaces (which scaled as you drew it), but then I found the wonderful dashed line class below:

http://www.cartogrammar.com/blog/drawing-dashed-lines-with-actionscript-3/

This movie requires Flash Player 9

Version 0.1.95

March 17th, 2009

So I’ve picked a naming convention. This is version 0.1.95. 0.1 meaning very very pre-alpha and .95 to mean the SVN revision number. I’ve fixed some bugs from the last version.

  1. First a module can’t connect to itself anymore.
  2. In the last version, if you hovered over the left input area of a module, then clicked and dragged a connection from one module to anywhere on the stage and released it, it would draw a connection to the first module you hovered over.
  3. The LED now outputs it’s value correctly, allowing for a chain of LEDs.
  4. The Button and Switch can both receive input ala NeatTools, however, unlike NeatTools, they don’t exhibit their down behavior when fired. They simple pass through the value.
  5. The size of the output and input areas has been changed to more closely match NeatTools. Plus it’s easier to hit.
  6. And I’ve re-added the round button that will cycle through the connection drawing options.

This movie requires Flash Player 9

Connections You Can Believe In…And See

March 16th, 2009

Ok, so you still have to use your imagination while making the connections, but once made you’ll actually be able to see them. And as an added bonus, when you make more than one connection from a module, it adjusts the position of the first connection.

One little problem I’ve found so far, when you click on an existing connection to kill it, it doesn’t reset the output point of existing or subsequent connections. This was anticipated, but I don’t know how to deal with it right now.

I’ve also switched to using global variables to track the modules and connections.

This movie requires Flash Player 9

I’ve Made a Connection

March 15th, 2009

Ok. I think for once, I’ve figured out the logic side before the graphical side. In the file below, you can make a connection NeatTools style. Now, you won’t see anything happen, but a logical connection will be made. In fact the blue connecting line will look like it’s doing something very strange, but trust me it’s working.

So, for example, click in the right hand edge of the button and drag an invisible connection to the left hand edge of one of the LEDs. Repeat with any of the other modules that were previously connected (except the minus and the division, I don’t have the top inputs setup, but you can access their left inputs). Now when you click the button, the LEDs will react as if there was a connection. You just can’t see it. Yet.

This movie requires Flash Player 9

ReleaseOutside

March 15th, 2009

Sounds like something a dog would do. Anyhow, this functionality is missing from AS3, but it can be recreated. Essentially, I have allowed for the dragging of modules over the top of each other (hmmm. I just thought of something. Maybe I should make them not able to overlap) Anyway, that new thought aside, I’ve made it so that even if you overlap a module, or underlap, when you release the mouse, the button, for instance, will now turn off, rather than staying in the on position like it used to. The more current problem is creating connection and frankly I’m stuck. I’ve created hit areas (I’m not even getting into finding the correct input and output yet.) on the left and right side of every module. when you mouse down on the right side and drag, a line will run from the right side of the module to your mouse. If you release the mouse, the line dies. What I can’t do is figure out how to tell if you’ve dropped the line in the left input of another module. The code that detects the inputs and outputs is in the module class and what I can’t figure out is how I need to reference the two modules I want to connect.

This movie requires Flash Player 9

IE is being a little punk

March 15th, 2009

My thoroughness is the bane of my existance sometimes. I typically use Firefox, but being a web designer, I feel the need to ensure cross-browser compatibility. There seems to be an issue with either the theme I’m using or the plugins or the html tags that prevents IE 6 (I haven’t even tried the others yet) from rendering my posts correctly. It definitely revolves around my syntax highlighter, but whether it is the html (ie, <pre>) or the javascript in the plugin, or the sheer length of the lines, or another plugin for that matter that is putting the kybosh on everything, I can’t say.  In some cases, it just doesn’t highlight the code at all, in others it treats it like a quote, in others actually eats the code.  I’ve been trying some combination that will make it all work, but nothing yet…grrrrr.

I love Points

March 13th, 2009

I’d never really looked into the new Point class until tonight, and I must say, I love it. Just for the organizational aspect alone, rather than tracking individual x and y coordinates, but it has some other nice features, like interpolate, which will find a point between two points from 0% to 100%, so for instance:

Point.interpolate(a, b, .5);

will get you the midpoint, x and y between points a and b. Instead of having to plug in the formula, which isn’t difficult (x1+x2)/2,(y1+y2)/2 but when you’ve got long expressions, long confusing expressions for each one, it adds up.
I went from something like this:

_line.graphics.curveTo(m1.x + m1.mod.width + buffer, deltaY, (((m1.x + m1.mod.width + buffer) - (m2.x -buffer)) / 2) + m2.x -buffer,deltaY);

(You can’t see it but it’s shooting off the right side of the screen)
to this:

_line.graphics.curveTo(c.x, c.y, cd.x, cd.y);

773

March 12th, 2009

http://sourceforge.net/project/stats/rank_history.php?group_id=230996&ugn=neattools