android - score increase the chance of apperance -
hello i'm developing game each time user blows block users 1 point , point added overall score while game running.
the game consists of 4 standard views want done more chance increase more background appear on views.
in way higher score more chance of background bind view when user reach's 50 starts bind background , when user reach's 200 chance of binding becomes 100%
this.bcolor=random.nextint(4 - 1 + 1) + 1; // generate random color between 1 , 3 if(fallanimationactivity.score % 100 == 0) { // here want apply chance alogrithm. fallanimationactivity.showcolorbuttons(); switch (bcolor) { case 1: this.setbackgroundcolor(color.blue); break; case 2: this.setbackgroundcolor(color.red); break; case 3: this.setbackgroundcolor(color.green); break; case 4: this.setbackgroundcolor(color.black); break; } } else{ this.setbcolor(0); }
fallanimationactivity.score user score keeps increasing while pops blocks appears.
thank you.
you can use algorithm generates number between 1 , 200. if number smaller score, return true, otherwise, return false.
Comments
Post a Comment