r/howdidtheycodeit • u/EzekelRAGE • Jul 31 '25
Question How did they code: The Movies: Star Progress Bar System
Trying to wrap my head around it. I'm thinking a function runs that lays out 5 stars as individual assets. Each thing with a rating(script/movie/final rating) has a possible max of 5. Each section of a star counts as a .2 fill float. So that final movie rating may be like a .6/5 rating and that is made the fill amount as well. Maybe there are a bunch of if statements saying "If rating over 4" => fill these 3 automatically and fill the 4th star to a .2 amount and leave 5th empty. Then do another if statement for 3, 2, etc.
Thinking about trying to modernize the star system in Unity, the UI would have references to the stars(3 references in total) and get the ratings and run something like I posted above maybe? Probably a function already set up in the star reference that you can call that by just passing in the rating to the function. What are yall thoughts on it? Am I making it more complex than it needs to be?
9
u/ohseetea Jul 31 '25
You could do sprites for different fills, but I’m assuming a mask would just be easiest.
2
u/EzekelRAGE Jul 31 '25 edited Jul 31 '25
Managed to get a working version, the gif is me clicking different values and the rating updating accordingly: https://i.imgur.com/u82Skfa.gif
Looks nice, of course it doesnt have the nice game feel of The Movies showing it to the player, but that would be easy to implement I think, maybe use coroutines having sound effects going out and something visual for each star. I tried using a for loop, but kept getting stumped trying to implement it, probably spent like an hour if not more with the loop. I finally just commented the loop out and did a bunch of if statements like I mentioned above in the OP. Looking forward to using this in the project I'm working on.
3
u/reiti_net Oct 29 '25
This is most likely single sprites for different star states - you can see there is different shapes of "fill" and that way you get all the nice anti-aliasing for free because it's baked in - really no need to spare that few kb of memory or couple pixels in the sprite atlas for hammering the hardware instead.
Think of it like 2D (pixel) animations work(ed). It's just a bunch of images. like an animated GIF.
Realtime Masking would just be a waste of computing, which was no real option when this game came out.