New answers tagged

1

The Chartboost TOS says, in part: You will not, and will not allow any third party to... directly or indirectly generate queries, or impressions of or clicks on ads, including without limitation Online Services Ads, through any automated, deceptive, fraudulent or other invalid means (including, but not limited to, click spam, robots, macro Online ...


0

Calling invalidate(); inside the DoteView.delete method which tells the view to redraw itself does what I want. Public void delete(){ mPaint.setColor(Color.TRANSPARENT); invalidate(); }


0

Your stack error comes from the fact that 'AdView' is a type, not an instance. For example, let's say you have the following class: package simulator; import java.awt.Color; public class Dog { public Color coatColor; public static boolean mans_best_friend; } because all dogs are man's best friend, the statement Dog.mans_best_friend = true; is a ...


0

€dit because my previous answer was not the correct one: First guess: the region is too small, or whatever he can't process the image. I would debug into the draw method and look, if the table actually has a background in the draw method, because if no background is there, the method just draws nothing.


0

Your question is pretty unclear. If you want to use your Android device to control the game, you can set up a connection with Unity and your device through USB, using the Unity Remote app: https://play.google.com/store/apps/details?id=com.unity3d.genericremote&hl=bg That way you don't have to wait for it to build and push to your device for every small ...


1

The best way to load in music and sound effects resources is through LibGDX's audio methods: Music music = Gdx.audio.newMusic(Gdx.files.internal(path_to_music_file)); Sound sound = Gdx.audio.newSound(Gdx.files.internal(path_to_sound_file)); To play the music: music.setVolume(1f); music.play(); To play the sound effect: long id = sound.play(); sound....


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

I'm giving you how I did this in java before I switched to Unity. Perhaps you can use it in c# with small modifications: So lately I did it this way: screenWidth = getResources().getDisplayMetrics().widthPixels; screenHeight = getResources().getDisplayMetrics().heightPixels; But I used to do it this way too (probably deprecated): Display display = ...


0

The problem is that your update function is only fixing the position of the balloons to the Box2D body. Since the Box2D body is created and added to the world on creation, the body will still be moving even though it is not drawn. You can disable the balloon's bodies until they are ready to be drawn, like so: Balloons.java public void defineCollector(...


3

Libgdx is a free game library that supports java and can be deployed to Android and iOS. You will definitely be able to use a lot of your existing code and, depending on how you implemented your Android game, you may even be able to convert many of your draw calls to the Android canvas directly to draw calls in Libgdx. Libgdx definitely has a steeper ...


1

in your update method you should add the below code. if (Gdx.input.isKeyPressed(Keys.BACK)) { game.setScreen(new MenuScreen(game)); } // and in your game Screen classes show method Add this code Gdx.input.setCatchBackKey(true);


0

texture = new Texture( Gdx.files.internal("Menubckgrnd/MenuScreen.png")); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); // here 2048 and 1238 is the actul width and height of the image . so replace these values with your images height and width TextureRegion region = new TextureRegion(texture, 0, 0, 2048, 1238); ...


1

It is a little bit difficult understanding your question, but I think your problem is caused by the fact that you update all ballons in the update (float dt) method even though you're not drawing them. This means that when 200 iterations has passed and you draw ballons and ballons2 for the first time, they have already moved some distance.


0

You can solve it easy by making additional rectangle above the rectangle attached with it, and respond differently for each rectangle, by this way you can control the collision


2

More code would be helpful, but you likely need to put this in your show method. public void show() { Gdx.input.setInputProcessor(yourInputProcessor); // This should keep it from exiting. Gdx.input.setCatchBackKey(true); ... }


0

Turns out the answer has to do with alpha channels and the way they were being processed. I removed transparent pixels from the edges and it works as intended now.


0

This may be the same problem as this question on SO (haven't used TextureAtlas before so not entirely sure)


0

You probably need to ask a lawyer to be sure; I am not a lawyer, so take what I say with a grain of salt. You can almost certainly find a lawyer to advise you on this matter for less than $16,000, so that seems like a good investment to me. For reference, this is the COPPA law and these are the FTC's FAQs on compliance. This is the source of most of my ...


0

The docs for setRenderer() say: This method should be called once and only once in the life-cycle of a GLSurfaceView. If you look at the source code, you'll find that they actually meant "must" rather than "should". The setRenderer() method checks to see if a render thread is running. If not, it creates one and starts it. If the thread already ...


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 ...


3

There is no simple way to convert your java code into Unity, unfortunately. You are going to have to convert the entire code base into either C# or Javascript. Even the way you do your scenes are going to have to be updated. There is no easy way around it, sorry to say.


0

I was stuck at this for hours, but I came up with a solution. In case anyone's still stuck at this, here it is: Unity on Android, or Android itself doesn't seem to like URL's without the protocol. The fix is to add the protocol before the URL, for example your www.google.com would probably become http://www.google.com or https://www.google.com. The error ...


0

Unity has a separate function for touch screen devices. Here' the code. Note that functions MoveLeft() and MoveRight() are exaggerated, so you need to replace them with your own. C# Code: function Update () { for (int i = 0; i < Input.touchCount; i++) { Touch touch = Input.GetTouch(i); if (touch.phase == ...


0

Disclaimer: so far my experience with motion control in Unity has been with devices not supported by the Input class, so I've always rolled my own sensor fusion as you describe. The description below is based on the docs - I'd welcome corrections or further details from anyone with hands-on experience. Unity provides a few ways to access the motion of the ...


2

Touchscreen devices do not have keys, so you need to think about another input method. A quick and dirty solution to adapt a game designed to be controlled with directional keys to a touch device is to use a "virtual keypad". Use the Unity UI system to create four buttons on the screen the player can tab on, and bind each to an appropriate function which ...



Top 50 recent answers are included