Well I would like to explain properly but as English is not my first language please try to understand what I say, so I am trying to learn godot and game development in general but as I'm new to this I'm facing many issues every now and then so for now I wanted to make my touch screen control stay on the screen on the same place,which was working fine until I added camera2d node to my player which started following my player(which is good) but my controls are moving with it, please help me with this. -thamks
Make your touch screen control node a child of player. (i.e. attached to the same parent as your Camera2D).
You could probably use a CanvasLayerNode and put your touch screen controls as children of that canvaslayernode
Here is how I have set the controls and player
Hey thanks 'hay' your method fixed my problem thanks alot but I want to ask a question, will this approach be good enough for making my game, I mean in further making progress in my game I won't need to change it right?
Shonda As long as you want the camera to always stay centered on the player, this will work. If you ever need the camera to be somewhere else, you would need to do something more complicated to manage the camera. e.g. some side-scroller games will have the camera lag behind the player by a second or so.
It might be better to make the UI touch controls a child of the camera, rather than the player. Then the ui will stay in sync with the camera, even if you move the camera off the player.
© 2022 - 2024 — McMap. All rights reserved.