A few tutorials that may or may not help me.
Drop shadow filters.
Collision detection.
Sound (plus more- general tutorials).
Removing objects.
Thursday, April 24, 2008
Wednesday, April 23, 2008
Trees Hate One Another
New version of Treemaker. It's automatically set in a two-player mode, to test, so realize that you are taking turns placing seeds and then branches and such for alternate trees. The player turn switches when you place a knot (not a branch with a leaf or root or an additional leaf). Sunlight gathering finally actually works, but resources are not properly-balanced (I'm working on it... but I'll probably get all of the basic parts working first).
Tuesday, April 8, 2008
More Things to Do:
1. Turn the branches into objects so that I may add a "IsAStem" Boolean property to each.
This property will be marked "true" if the branch ends up placing roots or leaves, and branches with "IsAStem == true" will have their growth handled differently. Turning branches into objects will also allow me to add properties like OriginalScale, which might be useful in setting the growth limits for said Stems (or perhaps these stems are simply not allowed to grow?), and ParentKnotIndex, which would allow me to delete branches and knots whose parents have been destroyed.
2. Figure out how to destroy branches, and make it so that destroying a branch kills all branches connected to the seed by it. Making the new branches AddChild onto the knot they sprang from (may need to use event.target, or even track the index of the event.target knot in a public variable) might just accomplish this.
3. Incorporate an "IsPlaceable" Boolean into the branch placement functions- it should change to "false" if the branch is overlapping an object that it cannot be placed upon (underground obstacles and enemy branches which are larger than it), and the branch placement function should recognize this and not allow branch placement there.
This property will be marked "true" if the branch ends up placing roots or leaves, and branches with "IsAStem == true" will have their growth handled differently. Turning branches into objects will also allow me to add properties like OriginalScale, which might be useful in setting the growth limits for said Stems (or perhaps these stems are simply not allowed to grow?), and ParentKnotIndex, which would allow me to delete branches and knots whose parents have been destroyed.
2. Figure out how to destroy branches, and make it so that destroying a branch kills all branches connected to the seed by it. Making the new branches AddChild onto the knot they sprang from (may need to use event.target, or even track the index of the event.target knot in a public variable) might just accomplish this.
3. Incorporate an "IsPlaceable" Boolean into the branch placement functions- it should change to "false" if the branch is overlapping an object that it cannot be placed upon (underground obstacles and enemy branches which are larger than it), and the branch placement function should recognize this and not allow branch placement there.
Treemaker Version 9
Here's the newest version of the Treemaker!
(Yes, I know it's been a while since my last post, and yes, I realize I skipped a version; version 8 incorporated things like resource calculation and the precursor to the current growth/shrinkage system.)
Instructions:
Click on the white screen to place a seed. Click on the seed to start placing branches. Branches below a certain length will spawn leaves or roots, depending upon whether they are above or below ground.
Press "a" on your keyboard to activate one round of resource calculation/growth. Pressing it quickly over and over again allows you to see lots of growth over time.
What is new:
1. Resources. Pressing "a" (make sure if you are playing with it in Flash itself, you disable keyboard shortcuts while you try it out) will activate a round of Growth. This calculates resources (including a function that, theoretically at least, tests whether each leaf is blocked by something else from the sun), meaning sunlight and roots, and then grows or shrinks each tree based upon its resource surplus/deficit.
2. Sunlight. I haven't gotten around to putting in the functions that will allow for two or more players, but they are almost there. The sunlight function draws a line from each leaf to the sun, then tests to see if anything breaks that line. It should(!) work.
3. Growth. Everything has been built and tweaked so that things should grow more or less like they are supposed to... Roots grow and shrink faster than branches/knots, and leaves do not shrink at all. The branch placement system has been changed to allow for this sort of thing without odd-looking graphical mishaps (for instance, all branches now start at the center of the knot which spawned them).
On a side note, there are now a few tree-type variables available for implementation. They're already in there as properties.
What I forgot to do:
1. Add a function that removes listeners from other knots while a branch is awaiting placement. There is still a bug remaining that will end a branch placement without a new knot, or with a leaf or something instead, if you click on a knot while you are placing a new branch.
Next time:
1. The Unlistener/Relistener functions (should be simple enough- just add a for loop that runs through each knot and removes its listener while the branch is being added, and another that adds the listeners again after its placement).
2. Multiplayer.
3. Resource limiting? Rather than not letting a player place new branches when they have negative resources (which could straight-out kill their chances of recovery), I think the shrinkage system is better- players can still come back from a bad turn, but they are penalized for poor building techniques by losing the strategic upper hand (their tree will shrink, and therefore the other player will be able to break through their branches). We'll have to see what happens through playtesting.
(Yes, I know it's been a while since my last post, and yes, I realize I skipped a version; version 8 incorporated things like resource calculation and the precursor to the current growth/shrinkage system.)
Instructions:
Click on the white screen to place a seed. Click on the seed to start placing branches. Branches below a certain length will spawn leaves or roots, depending upon whether they are above or below ground.
Press "a" on your keyboard to activate one round of resource calculation/growth. Pressing it quickly over and over again allows you to see lots of growth over time.
What is new:
1. Resources. Pressing "a" (make sure if you are playing with it in Flash itself, you disable keyboard shortcuts while you try it out) will activate a round of Growth. This calculates resources (including a function that, theoretically at least, tests whether each leaf is blocked by something else from the sun), meaning sunlight and roots, and then grows or shrinks each tree based upon its resource surplus/deficit.
2. Sunlight. I haven't gotten around to putting in the functions that will allow for two or more players, but they are almost there. The sunlight function draws a line from each leaf to the sun, then tests to see if anything breaks that line. It should(!) work.
3. Growth. Everything has been built and tweaked so that things should grow more or less like they are supposed to... Roots grow and shrink faster than branches/knots, and leaves do not shrink at all. The branch placement system has been changed to allow for this sort of thing without odd-looking graphical mishaps (for instance, all branches now start at the center of the knot which spawned them).
On a side note, there are now a few tree-type variables available for implementation. They're already in there as properties.
What I forgot to do:
1. Add a function that removes listeners from other knots while a branch is awaiting placement. There is still a bug remaining that will end a branch placement without a new knot, or with a leaf or something instead, if you click on a knot while you are placing a new branch.
Next time:
1. The Unlistener/Relistener functions (should be simple enough- just add a for loop that runs through each knot and removes its listener while the branch is being added, and another that adds the listeners again after its placement).
2. Multiplayer.
3. Resource limiting? Rather than not letting a player place new branches when they have negative resources (which could straight-out kill their chances of recovery), I think the shrinkage system is better- players can still come back from a bad turn, but they are penalized for poor building techniques by losing the strategic upper hand (their tree will shrink, and therefore the other player will be able to break through their branches). We'll have to see what happens through playtesting.
Subscribe to:
Posts (Atom)