Level Stars issue.
Hey guys. This issue is bothering me all day. It is quite complicated to explain, i will try to do it somehow and i hope someone will be able to understand it and help me.
I have a level system like this one:
I am trying to make a stars system by spawning the number of stars the player had earned in the scene to the corresonding level box. My issue is that if i finish the 1st level with 1 star, it spawn 1 star to all the level boxes (because the level boxes are one actor, copied in more examples on the scene). If i go to 2nd Level and finish it with 3 stars, it changes the level box stars to 3 stars, including the one on the 1st level.
On that actor (level box) , i have an attribute self.mylevel, that is changed to each box so it can know which level it corresponds to (1,2,3,4....)
In the game, i have a rule: once the level is completed, if the player has 5 lives, it should spawn 3 stars to the level box actor. If 3-4, spawn 2 stars, if 1-2 lives, spawn 1 star.
In the levels i have an actor called level controller which determines the level number by a self attribute called "what level am i". In each level, this attribute is changed to its proper level number.
I am struggling to find a proper way to connect the Level 1 scene, with the level 1 Box, level 2 scene with level 2 box etc.
If the explanation above is unclear and confusing, i will try to provide more details and explain better.
Thanks in advance.
Best Answer
-
Tosanu Posts: 388
I encourage using tables. They actually are very simple, and are remarkably powerful. Me, I don't know a non table way to save that many assets without a load of booleans and about 50 Save Attributes. Maybe someone else can add more.
Answers
You are going to need a table. To make a star system, I had to create a check at the end of the level for how many stars the level was worth. If it was more than any current number of stars on the level, it would then save the star number to a table on the row "what level am I". Then the level box will check the table at the same row, assuming whatlevelami and MyLevel are equal, and the rule will tell it how many stars to spawn.
Did i miss anything?
I was trying to avoid tables. I saw a tutorial once with tables, it seemed to complicated. Do you think there is any other way that i can finish it the way i explained it in the question or i should quit it and try it with tables or remove the star system?
From my point of view it should be simple for experienced GS users (which i am not, obviously). Maybe i am very wrong.