How do I make an Angry Bird Level select menu?
http_gamesalad
Member Posts: 1,340
You know when you beat a level you get stars depending on the amount you scored on a level .. how would I achieve this?
http://www.syamey.com/wp-content/uploads/2011/01/Angry-Birds-3.jpg
Comments
What - specifically - do you want the stars to represent ?
@socks the amount of points you get. For example I want my game to be set up like this 0-1000 = 0 stars , 1100-1500 = 1 star , 1600-2000 stars = 2 stars , 2100 - 3000 = 3 stars
Is the player able to score - for example - 1,560, or does the score only increment in 100s ?
this looked kind'a fun, and i never did anything like this so i gave it a shot.
Here in the example there are 3 levels.
You can select to enter a level and then inside the level you can hit random score until you're happy with your score and then end level.
And the level select screen will show stars according to each level's score.
Warning: because of the way you specified your ranges (they're not continuous if you get a score in between these ranges for example 1550, you'll get 0 stars
Oh yeah, and the Set Level 1 score to random(0,3000) should say Level 1, Level 2 and Level 3 respectively for each level, I just made copies of Level 1 and change the Welcome message but forgot to change that text to say the correct level.
@socks increments of 100
@tintran thank you ! I'll take a look at it first thing in morning! I've been coding all day hahaha! Thank you very much
@tintran I just tried it out & the boxes didn't show
@socks & @tintran I'm using tables to save my highscore , I have 50 levels
that's weird. I tried downloading the Windows one and it worked out fine for me.
anyways there's only one thing worth mentioning in that project is the use replicate and expression instead of many different rules to show the stars.
I just added a single star/block for each icon level.
and tell it to replicate and in the expression for "times" i used the expression
((game.level1score >= 1100) and (game.level1score <= 1500)) and 1 or
((game.level1score >= 1600) and (game.level1score <= 2000)) and 2 or
((game.level1score >= 2100) and (game.level1score <= 3000)) and 3 or
0
that way it'll replicate the number of stars when the conditions before the and are all true and the or 0 at the end is if none of the conditions are true it's 0 stars.
I guess if you're using saving your scores to tables, you'll have to pull out the appropriate tableCellValue instead of my game.level1score.
EDIT: but then i realize you can reduce the above expression down to a much shorter form but in reverse order
(game.level1score >= 2100) and 3 or
(game.level1score >= 1600) and 2 or
(game.level1score >= 1100) and 1 or
0
@tintran I'll try this out !
@tintran the problem with this is that my game is set up on tables not game.levels
@socks & @tintran is it possible to set up something like
Rule
TableCelValue (HighscoreTB,1,1) => 1000
Do: 1 star
Rule
TableCelValue (HighscoreTB,1,1) => 1600
Do: 2 stars
Rule
TableCelValue (HighscoreTB,1,1) => 2100
Do: 3 stars
& so on for the rest of the 49 levels
I noticed that it won't let me use the function table .. but I was wondering if you guys know a way to implement something like this in the game .. I tried to give you an idea of what I'm trying to achieve
you can put this expression inside replicate of your star actor
(TableCelValue (HighscoreTB,1,1) >= 2100) and 3 or
(TableCelValue (HighscoreTB,1,1) >= 1600) and 2 or
(TableCelValue (HighscoreTB,1,1) >= 1100) and 1 or
0
@tintran thank you ! But is it possible to do this with a change image behavior instead? I understand what the replicate behavior does & I know it'll save more space but the images I'm using can't really be replicated because it'll look pretty bad lol
yeah if you have different images for stars like for example
0star.png
1star.png
2stars.png
3stars.png
you can use change attribute self.image to expression below
(TableCelValue (HighscoreTB,1,1) >= 2100) and "3stars" or
(TableCelValue (HighscoreTB,1,1) >= 1600) and "2stars" or
(TableCelValue (HighscoreTB,1,1) >= 1100) and "1star" or
"0star"
I've included a simple project that uses this similar expression to determine which image to show based on Touch1.x position. click just less then half screen width to see one star, click just more than half screen width to see 2 stars, click just more than 3/4 screen width to see 3 stars, click less than 1/4 screen width to see 0 stars.
Almost anything is possible. Just give it a try instead of asking, it's usually faster!