- Home /
Power Up Modifications!
Hey guys, so I'm having this problem... I'm new to all this still, but I have this code. what I want to do is make it so my "Power up" modifies my score for a certain number of seconds and then goes away and returns back to its normal score modification.
public void PowerUp(){
powerMod = 2;
multiplier = 2 + powerMod;
Invoke ("PowerDown",5.0f);
}
void PowerDown(){
multiplier = multiplier;
powerMod = 1;
}
//Combo-like system : 4 in a row = 2x points, 8 in a row = 4x points etc..
public void Multiplier (){
if (ballCount >= 4 && ballCount < 8) {
multiplier = 2;
score += ballValue*multiplier*powerMod;
}
if (ballCount >= 9 && ballCount < 12){
multiplier = 4;
score += ballValue*multiplier;
}
if (ballCount > 12 && ballCount < 16) {
multiplier = 6;
score += ballValue*multiplier;
}
if (ballCount >= 16) {
multiplier = 8;
score += ballValue*multiplier;
}
if (ballCount < 5){
multiplier = 1;
score += ballValue;
}
i'm not sure how to implement my powerup, and revert it back. please help! :) thanks in advance.
Comment
Answer by Inok · Dec 29, 2014 at 03:03 PM
Maybe you need
void PowerDown(){
multiplier = 1;
powerMod = 1;
}
instead of this: "multiplier = multiplier";