Experience bar
I wrote a correct logic that I'm sure will work, but I'm wondering if it will hurt performance since Experience point are in the thousands and later in the game in the tens and hundreds of thousands.
Will this logic be reliable once a player reaches high levels or will I have to use a different approach?
Spacing of replicate = 188 (width of full bar) / MaxExperience
Self.positionX is constrained to 474 (current X-position of bar) + 188 (width of full bar) / (2*MaxExperience) so the small replicated bar will be relocated at the far right edge of the screen
Self.Sizewidth is constrained to 188/MaxExpereince (MaxExperience is the required experience to level up)
The green 1 pixel line here is the Experience bar, it's supposed to move from right to left
As you can see MaxExperience here is 500 and this is only level 1!!
I'm not sure if this approach is feasible at high levels.
Comments
Eventually at very high levels there will be tens of thousands of 1 pixel replicas.
That's what I'm worried about.
Just use a single actor and have its width change as needed.
I agree with socks. I would just change self.width to some ratio to experience. You can constrain its X position.
Would this help?
The higher the level the more XP you need to fill the bar.
This is the most efficient method.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS