Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Need help with mummy kill method!
Old
Disembodied Loaf
Guest
 
Status:
Posts: n/a
Default Need help with mummy kill method! - 08-17-2010, 05:56 PM

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.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 08-17-2010, 06:14 PM

Well, Alice does not have the capability to detect "is touching" but there is an "is within". Any questions?


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
DensetsuNoKaboom
Senior Member
 
DensetsuNoKaboom's Avatar
 
Status: Offline
Posts: 1,188
Join Date: May 2010
Location: e4eaf2
Default 08-23-2010, 08:11 AM

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.


Thank you for taking the time to read this signature. This signature loves you.
   
Reply With Quote
Old
labtek9
Senior Member
 
labtek9's Avatar
 
Status: Offline
Posts: 122
Join Date: Aug 2009
Location: Pluto
Default 08-25-2010, 10:00 PM

I don't know about you guys but the if statement dosen't like me too much, it never works so I use while.


Roar Face! >:O

Circle Buddy!
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 08-27-2010, 10:30 AM

Hmm. Are you using it wrong?


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
labtek9
Senior Member
 
labtek9's Avatar
 
Status: Offline
Posts: 122
Join Date: Aug 2009
Location: Pluto
Default 08-30-2010, 03:07 PM

probably


Roar Face! >:O

Circle Buddy!
   
Reply With Quote
Old
DensetsuNoKaboom
Senior Member
 
DensetsuNoKaboom's Avatar
 
Status: Offline
Posts: 1,188
Join Date: May 2010
Location: e4eaf2
Default 08-30-2010, 08:03 PM

If I can have a look at your code, I can probably help.


Thank you for taking the time to read this signature. This signature loves you.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2021, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.