characters["Player"].target = characters["Enemy1"]
and when there is no target then .target is None.
Now when i use my interface i have made, when the game starts, you define all the elements on the interface (player name, player health, enemy name, enemy health etc.) and their positions and the interface module deals with drawing them and any updates and or button that may be on the interface.
My problem is that at the begging of the game when i have to define the interface elements for the enemy stats area i do this
stat = characters["Player"].target.health Interface.add_stat_bar(x, y, stat)
Problem is the player does not always have a target. so the above code fails because character["Player"].target == None.
I am not sure how to fix this, i already have a system in place that only draws the elements effected if the player has a target but i still need to store the variable location at the begging. is there any way to store a location but not actually look inside it until it is needed?
Thanks in advance, if i can get this working the rest of my game should fall into place fine.
Nekroze

New Topic/Question
Reply




MultiQuote





|