Need help with mummy kill method!
I'm trying to create a method in which a knight swings his sword and it kills a mummy. I've got the swinging part and the "die" method down, but I can't get the "if the sword touches the mummy, call the die method" part down.
What I did at the end of my swing method was an if statement. That's what I can't figure out. It needs to be: if sword touches mummy: mummy.Die(). I tried: if (sword.isCloseTo(0 meters, mummy)) { mummy.Die(); } It didn't work. |
Well, Alice does not have the capability to detect "is touching" but there is an "is within". Any questions?
|
You want the sword to detect collision if it's within, say, 1 meter of the enemy, rather than 0, because 0 means that at that exact moment, the sword's center must be in the same exact place as the enemy's. Experiment with that "within" distance, and see what works.
You might also want to put that same If/Else statement all throughout the method, rather than at the very end. |
I don't know about you guys but the if statement dosen't like me too much, it never works so I use while.
|
Hmm. Are you using it wrong?
|
probably
|
If I can have a look at your code, I can probably help.
|
All times are GMT -5. The time now is 03:42 AM. |
Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.