Elemental Destruction (cont.) [Finished]

Derek

  • Posts: 163
Previously on the Elemental Destruction thread, I successfully completed the behavior for Water and I'm wrapping up the work on Fire and moving on to Wood. Basically I was asking for help on how to make the elements destroy each other in my game Elemental Clash. I'll probably still need help with the other three elemental attack behaviors (due to their complexity).

« Last Edit: April 12, 2011, 09:55:44 am by Derek »
Don't be a critic on the internet while eating and drinking at your computer.

Derek

  • Posts: 163
Speaking of which, Fire is refusing to attack in a diagonal direction, whether it's effective or not.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
I didn't think you wanted to be able to attack diagonally. Here's the post I was going off of:
Quote
Here you go:

Fire Element: Destroys all adjacent (non-diagonal) Wood pieces if initial target is Wood.
Water Element: Very basic single direction attack, scoring heavily influenced by moon phases.
Earth Element: Destroys all vulnerable pieces in a line if initial attack is successful
Wood Element: Harms all pieces surrounding it (moon phase determines which of the targets grants more points)
Metal Element: Plows through all elements in a direction based on initial target directory.

Derek

  • Posts: 163
What I meant by that is Fire having the same attack directory as Water, Earth, and Metal (Wood attacks all surrounding pieces) for its initial strike. For example, If Fire attacks a Wood piece, which also happens to be next to another Wood piece (non-diagonally speaking) it would get destroyed along with it.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Check Forge again. The initial strike should only attack an element in one direction, depending on the moon phase.

Derek

  • Posts: 163
Okay, now it's working. Now how do I add the part where it destroys Metal while maintaining the changes you've made?
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
In the Fire Behavior, add an Otherwise If block below where we check if the Actor Type inside the region is Wood and check for Metal instead. Then create/modify a Metal Behavior, and base it off the changes I made to the Wood Behavior to handle actually killing the Actor. If all you want it to do is kill the single metal block and increase the score, that should be pretty straightforward to do (e.g., you won't have to spawn four regions). Let me know if you get stuck.

Derek

  • Posts: 163
I'm not, it's done. Now it's time to do Wood (which attacks all surrounding pieces, if they are vulnerable). I'll take a crack it on my own since all have to do is create all the regions simultaneously. As always, I'll post for help should I get stumped.
Don't be a critic on the internet while eating and drinking at your computer.

Derek

  • Posts: 163
The basic intent for Wood is complete. Right now, it's completely borked, it won't do the "harm surrounding elements that are vulnerable" thing and keeps going for Metal (which shouldn't happen). Check the demo on Forge for more details.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
I think you're reverting some of the changes I'm making. Anyway, some notes:

- You probably want to be using <mouse was pressed> instead of <mouse is down>.
- You can't use the [actor inside region] block outside the [for each actor inside region] block, as shown in the attached screenshot.
- If you're going to use the "Attack was Effective" block, you have to set it to false every time the mouse is pressed, not just in the "when created" block. I think this is the reason for the "keeps going" part of your last post.
- I allowed the Fire Offense Behavior to attack Metal, in a similar manner. Hopefully you can start to see the pattern. To get the wood blocks to work, you'll want to do a similar thing. Do the actual killing of the actors that are inside the region inside their Behaviors, and just pass a message to them in the primary Behavior.
- The region placement is off. You'll notice that, if you try to click the fire element on the right, both metal elements get destroyed. With region drawing on, you can see that both elements are inside the region.

Grab the latest demo from Forge and let me know what you think.

Derek

  • Posts: 163
Well, Fire is done. But you wouldn't mind taking a look at the Wood offense behavior (snapshot below) and see what I'm doing wrong (it's supposed to attempt to attack all surrounding pieces and be only allowed to harm Earth and Water).
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Look at the screenshot in my last post. You're still using the [actor inside region] block inappropriately in the Wood Offense Behavior. You'll have to kill the Actors just before or after you're increasing the score, up above. Otherwise, the [actor inside region] block isn't well-defined since you're not using it inside a [for each actor in region] wrapper block.

Does that make sense? I thought I was doing an okay job of explaining it, but if not, let me know and I'll try to be more explicit (e.g., with pictures).

Derek

  • Posts: 163
Mission accomplished (for Wood anyway). The demo is now on the site if you want to take a look.
Don't be a critic on the internet while eating and drinking at your computer.

Derek

  • Posts: 163
Okay, something's going on with the Wood attack in the demo. You'll have to check it out on either of the two demos (on Forge or on the site) to see what I mean. Also, the slight movement that threw off the attack range strikes again.

« Last Edit: March 16, 2011, 11:49:15 am by Derek »
Don't be a critic on the internet while eating and drinking at your computer.

Derek

  • Posts: 163
I checked the Wood attack behavior myself and I can't quite put my finger on what might be the issue.
Don't be a critic on the internet while eating and drinking at your computer.