Do a star system?
rozsa.jatekfejlesztes
Member, PRO Posts: 45
I want if my actor collide with finish within 10 sec get 3star, if within 15sec get 2star, and if 20sec get one star.
When collide with finish change scence to "end scence" where is the time, stars, and ect...
I can do this how i create for every level "end scence" and there i set up the stars, with an atributte ( game.time <= 10 do change images)
But it's lot time for each level do this.
There a easier way for this? Maybe with table?
Thanks for answer
Comments
Is the reward times the same for all levels? You can build a prototype actor that can be the same for all levels. Just set the change scene to next scene or use the index ability to set it to the scene number based on a game level attribute.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Thanks your answer, but the reward times different for all levels. Sorry i missed it from the post.
This is how you could write the rules reading a table:
If (game.time <= tableCellValue(game.Level Times, game.level, 2)) then give 3 stars
If (game.time > tableCellValue(game.Level Times, game.level, 2) and game.time <= tableCellValue(game.Level Times, game.level, 3)) then give 2 stars
If (game.time > tableCellValue(game.Level Times, game.level, 3)) then give 3 stars
The Level Times table would need to have at least these columns
Level,3 Stars Time,2 Stars Time, 1 Stars Time
The rows might look like this:
Level,3 Stars Time,2 Stars Time, 1 Stars Time
1,20,30,40
2,25,50,70
3,25,40,60
The second parameter in the tableCellValue code above is the level number the player is playing so replace game.level with whatever attribute you have this data in
Edit: I noticed I had the columns wrong in my code above. I can also see I didn't actually need the 4th column in the table but I think you get the idea. Another way to write it would be:
set stars = 0
If (game.time <= tableCellValue(game.Level Times, game.level, 4)) then stars++
If (game.time <= tableCellValue(game.Level Times, game.level, 3)) then stars++
If (game.time <= tableCellValue(game.Level Times, game.level, 2)) then stars++