Hello, I need help on how to make UI because my character moves and the camera follows him, that means that if I just leave a UI element in a position it would just go off camera if I move outside of the field of view.
3 Likes
You use the code the Vcam used for following the character and copy and alter it into the Vcam object itself. This will obviously allow whatever UI object you mentioned to follow the Vcam’s position.
//inside the Vcam object, assuming that 'this' is referring to the Vcam...
UI_Obj.x = this.x;
UI_Obj.y = this.y;
You should get something at least similar to this:
This object IS a UI, so we didn’t want it in the center of our camera: So we can offset its position by adding or subtracting from the Vcam’s position.
//still inside the Vcam object, assuming that 'this' is referring to the Vcam...
UI_Obj.x = this.x + 50;
UI_Obj.y = this.y + 50;
Which results in this:
I hope that is clear enough to understand.
2 Likes
Thanks so much it worked I just put it in my characters update tab and it works
2 Likes