Alice Community  

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

Reply
 
Thread Tools Display Modes
On "if"s
Old
Matchewawa
Member
 
Status: Offline
Posts: 32
Join Date: Feb 2011
Default On "if"s - 04-04-2011, 11:04 PM

I wonder, is there a way to establish an amount of times that a function happens before the "then" happens in an "if, then". In other words, lets say that you are attacking an enemy. When you attack him, the "if" sees that you attacked him and runs the method for his immediate death, but could you set the function in the if so that if that happens so and so times (let's say three), then the death sequence happens? I've tried many things over the time that I've been using Alice. I did find one way, but it's tedious and inefficient for multiple enemies.

I'm trying to establish hitpoints for enemies so that they don't just die the first time you hit them.

Last edited by Matchewawa; 04-04-2011 at 11:22 PM.
   
Reply With Quote
Old
TheWhiteGuy
Guest
 
Status:
Posts: n/a
Default 04-05-2011, 11:23 AM

I guess what you can do is create a health bar that can or cant be seen.
   
Reply With Quote
Old
nickster654
Senior Member
 
Status: Offline
Posts: 180
Join Date: Feb 2011
Location: nickster12345678@gmail.com
Default 04-05-2011, 03:09 PM

Quote:
Originally Posted by Matchewawa View Post
I wonder, is there a way to establish an amount of times that a function happens before the "then" happens in an "if, then". In other words, lets say that you are attacking an enemy. When you attack him, the "if" sees that you attacked him and runs the method for his immediate death, but could you set the function in the if so that if that happens so and so times (let's say three), then the death sequence happens? I've tried many things over the time that I've been using Alice. I did find one way, but it's tedious and inefficient for multiple enemies.

I'm trying to establish hitpoints for enemies so that they don't just die the first time you hit them.
you could say if object is clicked on (or shot or whatever) increment number variable by 1

if number variable = 3
Object dies (or whatever)
   
Reply With Quote
What??
Old
Matchewawa
Member
 
Status: Offline
Posts: 32
Join Date: Feb 2011
Default What?? - 04-05-2011, 03:16 PM

I'm not sure I get that. Could you elaborate?
   
Reply With Quote
Old
Lordelwood
Senior Member
 
Lordelwood's Avatar
 
Status: Offline
Posts: 43
Join Date: Oct 2010
Default 04-05-2011, 03:30 PM

what hes saying is give each enemy a variable, then set the number to 3, 5 hoe ever many times you want them to be hit before they die, then in your code that hits them, have an if else statement saying, if zombie [health variable]>0, decrease health value by 1, else zombie dies...
does that help any?
   
Reply With Quote
Never Mind
Old
Matchewawa
Member
 
Status: Offline
Posts: 32
Join Date: Feb 2011
Default Never Mind - 04-05-2011, 03:34 PM

Never mind, I get it. I was just reading it wrong. Working on it now. Thanks.
   
Reply With Quote
Old
Lordelwood
Senior Member
 
Lordelwood's Avatar
 
Status: Offline
Posts: 43
Join Date: Oct 2010
Default 04-05-2011, 03:56 PM

no problem, good luck
   
Reply With Quote
Old
Matchewawa
Member
 
Status: Offline
Posts: 32
Join Date: Feb 2011
Default 04-05-2011, 08:54 PM

I made the variable for the enemy's damage, set it to increment by one when you hit him, and then I set a seperate if saying that if the variable equals 3, then I set his visibility to false. (And thanks to something in his AI method, he will stop following me and get out of the way of the level) This makes perfect sense to me, but it's just NOT WORKING. I don't know why, but I've arranged it in like 10000 different ways and nothing seems to work. It seems that the "if KnightDamage == 3" is not reading the KnightDamage variable's value.
   
Reply With Quote
Old
Lordelwood
Senior Member
 
Lordelwood's Avatar
 
Status: Offline
Posts: 43
Join Date: Oct 2010
Default 04-05-2011, 09:05 PM

Quote:
Originally Posted by Matchewawa View Post
I made the variable for the enemy's damage, set it to increment by one when you hit him, and then I set a seperate if saying that if the variable equals 3, then I set his visibility to false. (And thanks to something in his AI method, he will stop following me and get out of the way of the level) This makes perfect sense to me, but it's just NOT WORKING. I don't know why, but I've arranged it in like 10000 different ways and nothing seems to work. It seems that the "if KnightDamage == 3" is not reading the KnightDamage variable's value.
try the damage is >= 3
that way if the value goes over it will still register
umm, its really hard to say what the problem is without seeing it, if you wouldn't mind could you post it? so we can see where the issue is... i dont know if thats a fair question
   
Reply With Quote
Reply


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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.