Elemental Destruction (cont.) [Finished]

Derek

  • Posts: 163
@Joe: Okay, we might have to do that. Two questions: 1. What was Alexin's solution in that thread? 2. How do I start implementing whatever Alexin's solution is into the attack behaviors while maintaining the traits set up for each of them?
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Let's start doing it on a case-by-case basis.

It took a bit of stumbling around, but based off a Code Mode Behavior that Alexin posted, I was able to get something working here for Metal. Currently it just works for "up"; you'll want to fill in the cases for the other moon phases. Go ahead and grab it from Forge. If you can get past the whole "code" part of it, this will end up being an easier solution to manage, and will scale well to a large number of Actors.

Also, one question: What does it mean for an attack to be effective? At first I thought you only wanted to destroy the block you click on if doing so happens to destroy another block (i.e., is effective). That's not what the current behavior is, however.

Derek

  • Posts: 163
Well, since this game is based on elemental rock paper scissors, attack was effective means that the attack will destroy the actor in the target region provided that it's of an assigned element (Water attacking Fire, for example).
Don't be a critic on the internet while eating and drinking at your computer.

Derek

  • Posts: 163
Okay, here's the Metal behavior (yes, I know the moon phases all have the same math for the offsets, I did that so it wouldn't freeze during a different moon phase).
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Did you change anything besides adding the other moon phases? It looks about the same. You'll want to add a "set attack was effective to false" block just under the "mouse was pressed" block. Then we'll have to add some code to the code block to set it to true inside each set of curly braces {}. Lastly, we just wrap the create, play, and kill blocks in a "if attack was effective block".

Derek

  • Posts: 163
I'll do that. Setting the offsets to match the appropriate direction of attack (based on moon phases) officially has me stumped since attempts at altering them just had go north but not fully complete the plow through targets in a line.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Positive X values go to the right, and positive Y values go down, just like with when you were creating regions. What are you setting your offsets and attack blocks to?

Derek

  • Posts: 163
I'm not sure, I keep using various small numbers in the spots but it keeps going in the same direction.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
One thing I did while debugging was to add print blocks inside the while loop to print out the xAttack and yAttack Attributes. Are they changing how you expect?

Post a screencap.

Hectate

  • *
  • Posts: 4643
I'm not sure, I keep using various small numbers in the spots but it keeps going in the same direction.
Have you restarted SW since then? I have an issue when my PC gets overloaded with too much time in SW it'll forget that I made changes and won't compile them into the new version. So I might fix a bug but think that it's still there because I'll be playing the new version. I've taken to version-tagging my print statements on occasion to identify if it's failed to compile an updated behavior.
Just saying...
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

Derek

  • Posts: 163
Okay, I tried using the print blocks with the offsets and position offenses under the while tab, but no matter where I put the whole thing, it just freezes up the entire game. I know what blocks to use, but I don't know where to put them.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
Can you screencap again? :)

Derek

  • Posts: 163
Don't mind if I do.
Don't be a critic on the internet while eating and drinking at your computer.

Joe

  • *
  • Posts: 2478
If you put the print blocks inside the while loop, it'll probably slow your game down while the while condition is true, since printing to the console repeatedly tends to do that. It shouldn't last for very long, though.

Regarding the direction, you're entering the same offset and attack values for each moon phase, so that's why it's moving the same direction. You have to make them unique.

Derek

  • Posts: 163
I already got that part, but how do I get it so that the current offset value is displayed in text?
Don't be a critic on the internet while eating and drinking at your computer.