java - Lib gdx and custom actors in scene2d -


I'm new to libgdx and I'm learning that this is providing me.

Currently creating some custom actors (who expand the cast category) and taking them around the screen.

My question is, when the actors move forward by using set (set), setY (), then how do I properly pass the float delta in this method with a parameter in the method method Is provided as?

Example,

  @Override Public Zero Act (Float Delta) {if (Touched) {SET (getY () - .5f); }}  

How can I scale the movement with Delta properly? Is there any function for this built in libgdx Actor class?

There is no built-in function. I do not know what your update looks like, so I do not know if was touched every frame is correct, on which the finger comes.

But if you want to move one object at a certain speed, while the finger is placed below, then you first need the desired speed. It can be static

  Personal Static Last Float SPEED_WHEN_TOUCHED = 5.0f; // Viewport units can be per second in the  

or some variables that change over time, but in any way, it should be in the viewport (world) units per second.

Then when you want to move something at that speed, you want to increase the speed of the delta time (which is in seconds) to get the amount of speed.

  @ Override Public Zero Act (Float Delta) {if (it was compromised) {y + = SPEED_WHEN_TOUCHED * Delta; PositionChanged (); }}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -