What's the deal with Deno? We talk with a major contributor to find out. Listen now.
22

This answer relies heavily on Android's official documentation (the quoted parts, specifically). How to setup Multidex Support for Unity Project What is Multidex: Android application (APK) files contain executable bytecode files in the form of Dalvik Executable (DEX) files, which contain the compiled code used to run your app. The Dalvik Executable ...


9

It won't hurt performance. It might in fact be (very, very negligible) faster because you save the overhead of passing these objects to the game objects. The reason static classes are often frowned upon is that their static properties are global variables and globals cause all kinds of problems architecture-wise. For example, when you ever decide you might ...


5

Don't keep newing up TextureRegions, try re-using one and just change the parameters of that. private TextureRegion bgRegion; public void create() { bgRegion= new TextureRegion(bgTexture, -1 * (int)bgObj.getX(),0,256,240); //bgObj is a scrollable object where in each update changes X value of position(Vector2): moves left. } public void draw() { //...


4

To me, your basic idea of checking overlapping rectangle is workable; you only miss a small part: For each of your obstacles, have a two-state flag: untouched overlapping When you create the obstacle, have the flag set to 'untouched'. When the player jumps over it, detect if there is an overlap between the two rectangles. If there is, first, check if the ...


4

I would suggest that you keep track of the position of the obstacle until you have passed it and added a point. I would also suggest against trying to make a perfect size object for a collision, this is because frame rate can vary a lot so for you it might be perfect but for somebody with higher frame rate it can still cause unwanted behaviour. If you still ...


3

If you're definitely only ever going to have one instance of these objects, and presumably you are, then this would be a better way to go. However, maybe a better solution would be to use the Singleton pattern, and (for example) create a static GetScreen() method in the Screen class that any other class can call to obtain the single instance of the Screen ...


3

If your corner sprites are as simple as you show here, you can avoid collisions by changing how you generate the random positions. E.g. for the top, you currently generate a random int between 0 and width (well, ignoring that you seem to have transposed width and height in some spots). So suppose you have yellowWidth, the width of the yellow object at the ...


2

It very much looks like your boundingRect is incorrectly calculated. From your log you've got 5 boundingRects (I've re-ordered them here, right-to-left); -3.0893557, 96.0, 19.0, 5.0 -4.4350085, 96.0, 19.0, 5.0 -5.779882, 96.0, 19.0, 5.0 -7.042242, 96.0, 19.0, 5.0 -8.372085, 96.0, 19.0, 5.0 This would mean that all of these 19x5 rectangles are located at ...


2

This is very dependent on the app. Unity is not only useful for games, but it should still be something game-like (eg. an architectural walkthrough). For a typical mobile UI app, I would recommend something more like Xamarin


2

Of course! You can make multiplayer game with Android Studio, you can utilize Firebase too if you don't have any online server to manage peer connection. If you prefer using Java Socket Library, you will need to manage the server too or just play it locally like how ShareIt works.. Here are some reference for making a game with Android Studio: 1. LibGDX wiki ...


2

(from chat) You should not be restarting your entire program when you wish to restart your game. Instead reset the variables that control your game to their original state. Take this game as an example: In this example I reset the player's health (top left), the level (top right), and the abilities (bottom right) whenever the player pushes my 'reset' ...


2

There are no definitive "bad" or "good" value, but in general fewer calls are better since you spend less time doing what you're doing (e.g. drawing to the screen). The only way to know if your numbers are good or bad is to experiment. Those numbers are not there to give you definitive answers to what's going wrong they're there to help you and to point you ...


1

An EnemyAnimation is an actor in itself, you do not need to create an actor from the list of EnemyAnimation as the title of your post suggests. EnemyAnimate is NOT an actor, it is a List of actors, so the line stageNinja.addActor(enemyAnimate); should be replaced by stageNinja.addActor(enemyAnimate.get(i)); // where i is an iterator you need to set to ...


1

This is actually pretty straight forward. Instead of loading up an image from a static path, you would want to store up (the implementation depends on how you store your levels) a path to the correct background for the level along the other level data. As you are loading and creating your game objects, you would load the path to the background image and set ...


1

You missuse the animation class. you need to do the following: currentframe = animation.getKeyFrame(Gdx.graphics.getDeltaTime(), true); Currently you use an increasing time for your time passed. which is wrong, the animation class handles the passed time by itself. Easier explained: Imagine a cake. If you eat constantly 3 percent you'll see it fade ...


1

The nice thing about the Factory pattern is that the base class can be abstract and you can have different derived Factory classes. That means you can have an ExplosionFactory, a BulletFactory, an EnemyFactory and so on, which all inherit from the basic class GameObjectFactory. Any code which is common to all objects would be in the GameObjectFactory while ...


1

This questions is a bit overly broad, but the simplest answer is use the best tool for the job. If you don't think Unity can best suit your application, use the technology that will.


1

Are you using the AssetManager? You can load/unload only when a texture is needed and in the end discard all at once. Furthermore, there should never exist more than 1 instance for every unique texture (atlas). Share a pointer with all your entities. https://libgdx.badlogicgames.com/nightlies/docs/api/


1

Maybe you have local variable and you create those objects with those variables. Textures in libgdx doesn't have garbage collector. You must free the memory yourself with the method dispose().


1

I have found the answer to my own question, I have separated both class to a different stage and this solution works. I know that there is a better way of doing this and I am open for any edits or future answers. This is the code for using more than one stage : InputMultiplexer inputMultiplexer = new InputMultiplexer(); inputMultiplexer....


1

I think the problem is because you are calling this.act(delta) in your ArrowClass' draw method. When you call Stage#act(), it will call the act method on all of its actors for you. Since you're calling it once when you draw and again when you update the stage, it's moving at twice the normal speed and that could be causing it to reach its destination ...


1

I wrote a Ninja class for you. You can test it cause I don't have GDX on this PC here: public class Ninja extends Actor { private Animation wLeftAnimation, wRightAnimation; private static final int FRAME_COLS_WALK = 3; private static final int FRAME_ROWS_WALK= 2; private float stateTime = 0f; public enum Direction{ LEFT, ...


1

In LevelOneScreen, make your update method call update on WalkAnimate: @Override public void render(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); walkAnimate.update(deltaTime); update(delta); } Then, in WalkAnimate, make sure you select the correct keyframe in the update method: public void ...


1

Did you make sure to set the file path to ".../android/assets/" in the configuration settings? Your error message is exact same as one I had and I remember that was my problem anyway


1

You have to set the working folder in the Run Configurations. Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others then browse to yourproject-android/assets/ and click Apply => Run


1

The reason why the player continues to shoot is once you press the button downPress=true. It will stay true until you release the button. You could just call the shoot method from the touchDown event. @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { downPressed = true; ...


1

Your "long thin line" object is basically a funny shaped coin. Make the "long thin line" object wider (to avoid missing it), and simply delete it after it's collected rather than needing it to be as small as possible.


1

Every activity is an individual application screen, so you are correct in thinking they could be used for, as you put it, individual game scenes. The activity lifecycle is set up the way it is to facilitate memory management. Most Android devices have a small amount of RAM available (1 or 2 GB), which is often shared between the OS and several other ...


1

You need to create another "UI" Stage and call its act and draw methods in the render method. You also need to use a InputMultiplexer to process the input of both Stages. The "UI" Stage should use a ScreenViewport as well, to support multiple screen sizes and densities. More info about Viewports here:


Only top voted, non community-wiki answers of a minimum length are eligible