Tag Info

New answers tagged

0

Move this after the for loop: dispose(); ((Game) Gdx.app.getApplicationListener()).setScreen(new GameOver()); You create/set a new GameOver Screen each iteration, that causes probably the freeze and problems.


0

According to the answers to this question, referencing the assets folder using the file:///android_assets/ URI is only for WebViews. You need to use assets:// instead. You should also be using the AssetManager to load your files. EDIT: Poking around a bit further, you can bypass all of this by using the getAssets() method of your Context. Store a ...


1

The problem was a body from the previous level seemed to be left behind for some reason in that spot in the screenshot from level two. To correctly and definitely remove the bodies, I now do this: // Loop through all of the current bodies in the world. for(int bodyNumber = 0; bodyNumber < world.getBodyCount(); bodyNumber++) { // If the body still ...


1

Possible? Obviously. http://www.android.com/tv/ showcases a few games that are available. I assume that they are using the same channels that they would use to make a game for a phone or a tablet, based on the pictures and a little familiarity with the SDK. Although I don't use libGDX that much, I assume that because it rides on the Android SDK, it ...


3

I have faced similar problem before. I am pretty sure that co routines won't help you reduce the lag. Multi threading will be a proper solution instead of co routines. But apparently I didn't use either of them. My game had finite predefined pool objects. So instead of instantiating them, in the editor I made a parent game object named Pool and made all the ...


0

Currently developing a mobile game myself, using Box2D, I have no libgdx experience but for touch input on Android you can acquire a tap, a persistent touch, and a release! public void gameControls(final RelativeLayout gameBackground) { // Touch input. // Set up the touch listener for touch input on the screen. // Use the ...


0

Well for one this is in the touchUp method, which is called once when the screen is no longer being touched. A good way to do it would be to create a boolean "touchDown" that is accessible to the whole class and turn it to true in the touchDown method, and false in the touchUp method. Then you would apply the force to your jet ski while touchDown is true.


2

I've never tried to get this to work myself, but it seems like you would just need to increase the upward force applied to the jet ski's body as a function of the depth of the jet ski below the "surface" of the water object. The easiest way to get the distance below the surface might be to make a constant variable that describes the height of the water's ...


0

Allright I found the solutions. My phone was only capable of processing pictures with a size up to 4096*4096px and my Sprite was over 5000px...


0

This issue may be caused by other problems also. 1) Try loading the scene with Application.LoadLevel(Application.loadedLevel); some times the loaded level name gives problem if the build is a split binary. 2) Make sure your adb log cat limit is set to over 100k (My mobile OS shoots lot of internal logs due to which unity logs just disappear form the list) ...


0

You will need to do it manually for best effect. Unless you want a less polished looking deflection.


0

If you are going to just paint the grid, you can check out GridLayout provided by android UI. I have tried for 3X3 grid and used ImageView to set some images. To understand gridLayout , http://developer.android.com/reference/android/widget/GridLayout.html


-2

1, Libgdx It's Java, and Google's ingress use this game engine. 2, cocos2d-x Very good for 2d game, but coding language is c++ or Lua. 3, Unity3D Good for 3d, and language is C#.


0

For a grid system, I haven't yet implemented this code in anything other than an engine, but I'd imagine it would be similar. I implemented the Tetris clone in Unity 5, using this website: http://noobtuts.com/unity/2d-tetris-game The grid section of this webpage might be of some use to you. I will try my best to convert it into java code, and make it ...


0

Look at the classes in Rect, specifically .intersects(Rect a, Rect b) is boolean and saves having to do all the math yourself.


2

I know this question is a little old but Android has changed some in the past 3 years so I think it's worth posting this answer. Starting in Android 4.4, there's native screen recording. You can use ADB from a computer the phone is connected to or there are at least a dozen or so apps to help you do it (some with root, some without). Without root, you'll ...


0

This has been brought up but if you are serious about recording videos of your game, one of the most time and quality efficient paths is to get a 60$ hdmi recorder and an hdmi output cable. You get both sound and video in your devices native quality and you save a bunch of time. Another cheaper option is sending a demo of your game to someone who has an ...


0

If you use polling, use Gdx.input.justTouched() rather than Gdx.input.isTouched().


0

If you ask me it is not a good approach. Good news is you don't have to change too much stuff. Create an ads controller interface in your core module and implement it in your main Android class. So you can pass it to your game class and store it. Then whenever you want you can call adsController.hideBannerAd(); But you should first implement that method :D ...


1

Short answer: You need to create Unity Android plugin of Android project using Google Cloud Messaging. Details of how to create Android Unity plugin you can find Unity's official site. Here are some details: A) You have to start with google Android sample app, understand the push-related API methods ...


0

When you create an app with gdx-setup, simply select Android and iOS and de-select Desktop and Web options. If you have created them, just ignore them.


0

Just to add to some others' answers here, something that no-one has explicitly mentioned: If you do take the risk of running your game loop in a second thread and it becomes unresponsive, you risk the OS terminating your application. That's why it's recommended to use a separate thread. Hence (for example) the NDK's native_app_glue.c/.h spawns a separate ...


0

I guess you might need to apply some speed so that it works on the phone. Might be the Input.acceleration.x value is not high enough on phone, but works on the controller. Also it is advisable to use Time.deltaTime to keep the speed constant on all device, else it will change as per the device processing power. public float speed = 10.0f; void Update () ...


2

I spent a good while looking how to implement Box2D in Android studio, so for anyone else in the same boat, or just looking to implement Box2D - here goes. For implementing Box2D into your java code/framework, Box2D is tuned to work with numbers between 0.1 and 10 (it works in meters), quoting from the Box2D manual: http://box2d.org/manual.pdf Box2D ...


2

It should work if you change these parts in show(): viewport = new ScalingViewport(Scaling.fillY, GAMESCREEN_WIDTH, GAMESCREEN_HEIGHT, camera = new OrthographicCamera()); and add a resize method: @Override public void resize(int width, int height) { int SCREEN_WIDTH = width; int SCREEN_HEIGHT = height; viewport.setWorldSize(GAMESCREEN_WIDTH, ...


1

Which game specifically? What engine does it run on? Is the source available? If the source isn't available then you're SOL unless you REALLY like decompiling. Chances are good the code base is C or C++ (lets hope so). That means you have to compile with the Android NDK which isn't trivial. My experiences with it have been painful. You're right you have to ...


0

Unity preferences have Android preferences underlying it, and they are kept until the user manually uninstall the app.


0

If you store it in: Aplication.persistenDataPath you can be certain, that it won't be deleted after an update. (except the user uninstalls and then reinstalls the game manually)


0

What you can do is combine the Strategy pattern and Factory pattern. Use the Factory pattern to build a drawer class that implements a given drawing strategy. In this way, you use composition or inheritance to determine behaviour at run time, and your if-else statements would be concentrated in the factory, instead of being scattered everywhere. An ...


0

As mentioned by @alexandre, without specific examples it's hard to offer specific fixes... But! It sounds like your intuition is, reasonably, that by simplifying your code structure, you'll reduce the maintenance burden and reduce the chance of bugs. Another approach to help in this regard is unit tests. This aims to nail down the functionality ...


3

One way to avoid using a load of if/else/else if statements that always checks the same set of things is to use the state machine design pattern. You start by defining the different states that influence the behaviour, based on the player preferences. Then you extract the behaviour from where it is now, and add it to a method of a class that derives from ...


0

I have almost zero unity experience, but I have developed android games in other platforms, and I believe I know what is going on because I had a similar experience. Probably it is video memory. Many mid to low end Android devices use RAM to allocate video memory. Uncompressed textures take up a lot of space.


0

The answer to your question rather depends on what the bottleneck is in your renderer. If your system is bandwidth limited because of, say, many texture reads, then texture compression should help but, as you point out, ETC1 is opaque-only and so to emulate transparency, you need to set up a second texture with R=G=B*=A* and then copy one of the channels ...


1

You can download a plugin in asset store to regulate vibration. here's a link: https://www.assetstore.unity3d.com/en/#!/content/10982 or you can check this one it's FREE: https://www.assetstore.unity3d.com/en/#!/content/16648


4

One option is to use a wake lock. Example from the docs: PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "My Tag"); wl.acquire(); // screen and CPU will stay awake during this section wl.release(); I've got this answer from this stack overflow post. ...



Top 50 recent answers are included