I have a global variable called health, that I am trying to show via a text object called health. my code to start was:
Do = 100 to global variable health
txt Do = “Health : “+ToString(Variable(health))+” %”
However I am thinking that the “health” in the ToString part of the action, is refering to a scene variable because it always shows 0 no matter what I set the initial value to. Is there a way to let it know in the text object action that health is a global variable?
Did you try GlobalVariable(health)?
No Duh!!! I started to but figured no that won’t work it can’t be that easy, so I didn’t try that Thanks!!!
Also while you are here, I changed my main character to something else from the character in the tutorial. How do I get my platformer to swap animations on direction changes. I have the animation in for him facing left or right, but when I press the left arrow he just still faces right and moves to the left. Of course this is with the default controls. How hard would it be to uncheck default controls and check for key pressed and do the same thing as the default controls?
That’s offtopic, you should open a new topic to get faster answers. Anyway, it should be as easy as unchecking the default control and add events such:
[code]Conditions: Left key is pressed
Actions: Simulate left key for Player
Flip Player horizontally: yes
Conditions: Right key is pressed
Actions: Simulate right key for Player
Flip Player horizontally: no
Conditions: Space key is pressed
Actions: Simulate jump key for Player[/code]