| Start hub - it knows it is a start hub because it doesn't have any inputs, so it automatically sets it to "powered" |
| Generic hub, un-powered - this means you can connect the outputs to things, but it won't power them until all of the inputs are powered. |
| same function hub after a powered plug has been attached to it, all outputs are powered because all the inputs (only one on this) were powered. |
the really nice thing with this now is that you can make a chain of powered hubs, but if you remove the power on the first it causes a chain effect down the line, and they all become un-powered.
My next step i think will be adding distance limits to how far you can drag the plugs - at the moment you can connect plugs over any distance, which A. gets messy and B. doesn't have much of a puzzle element to it.
unfortunately I'm a bit rusty on distance calculations (I've been using box2D to do such things in other projects for so long) I'll have to have another read-up on it.
I'll also have to design a range indicator too... That will be interesting.
Take a look at Vector2.distance for your distance calculations requirements.
ReplyDeleteoohhh That's going to be useful! Thankyou!
Delete