Tag Info

New answers tagged

1

Don't subclass SurfaceView. Use composition, not inheritance. There's no value in subclassing it, and many basic mistakes (like overriding onDraw() when your goal is to draw on the Surface) are impossible if you don't. The View-based UI is rendered on a separate layer from the SurfaceView's surface. (The SurfaceView has a View as well, but generally ...


0

For the instanciation inside update method problem i suggest you to use the Pool class for every object in your game that must be instantiated a lot of times. You can follow this guide in particular (in the guide the object is a bullet). The guide also contains suggestions for other memory and lag problems. As for the way you calculate and execute the jump, ...


1

Presumably you hit "Build and Run"; that will cause Unity to first generate the APK, and then attempt to automatically install that on the connected device. Personally I recommend "Build" to just generate the APK and save it somewhere; then you can install it yourself after the APK is generated.


2

There are a couple spots that could be relevant. First off, you can set the Min API Level in Player Settings (click the Player Settings button on the bottom of that screenshot). But besides that, you can manually provide your own manifest file; it looks like right now you are simply using the manifest that Unity automatically generates if you don't provide ...


0

Use R.drawable.myprite. Android will choose the correct size image from those available in the drawable-XXX drawers.


0

first of all please load the sound you wanna play like this: local testSound = audio.loadSound( "sample.wav" ) audio.play( testSound ) then make sure your coordinates on those buttons are correct. maybe buttons are off the screen. I don't have much to say because I have nothing from your code. please upload your code


0

I figured out the solution. The problem was that Listeners would work only after we set a bound to our Actor. I hadn't set any bounds, so it was not taking the touches. Now I set the bounds in the draw() method(so that it will get updated each time the actor moves) and it is working like a charm. @Override public void draw(Batch batch, float parentAlpha) { ...


0

Answer by OFE in StackOverFlow: You will need to perform transformations to the texture co-ordinates yourself, you could do this in one of four places: -Apply the transformation to your raw model data. -Apply the transformation in the CPU (not recommended unless you have good reason as this is what vertex shaders are for). -Apply the transformation in ...


1

The issue was the drawing order. If I draw the money and then the ship it respect the alpha.


0

You could remedy to this by adding another bool canJump : public void Jump () { if(canJump) { if (grounded) rigidbody2D.velocity = jumpVelocity * Vector2.up; canJump = false; } } So when you are clicking, the Jump() method will run the jumping loop one time.After this code, you will need to set the canJump ...


2

System.currentTimeMillis() should be changed to System.nanoTime() / 1000000; currentTimeMillis has an issue in it that sometimes comes back with a weird number and in games causes twitching in animations and graphics


0

If you want a rounded corner like the true cube I would use a texture map with a black border and transparent area which you wish your base colour to be visible through. There is also newer methods of drawing shapes using paths but I haven't looked at these so I cannot advise how you could do those. Hope it helps.


0

Audio I find that for audio playback it's faster, smaller and more reliable to have two versions of the same audio and select different filetypes for iOS and Android. m4a for iOS and ogg for Android seem to work consistently. If you are just building for Android then use .ogg files. If you're building for both iOS and Android you could use this module to ...


0

A good solution is rendering the face black, then render the face with your selected color with less height and width. Also, render it a bit outwards, for eviting z-fighting.


0

There is a tutorial HERE that will help you using Tiled Map to create collisions as you are using this technology. Basically, if you are using Tiled Map you will mostly do Pathfinding, when you calculate the closest path to move to X,Y position, you need to check if this path contains some "collider" tiles, using a method like: -(BOOL) ...


2

Bug reported: Unity does not appear to generate UI elements upon Start. User input, or possibly some arbitrary amount of time in necessary until the application/game will generate the UI elements. I made my app wait to generate the buttons until I hit a button and it worked as intended. I suspect generating the UI from the Update() func would work ...


1

I think you want eyeY = -10, upX = 0, and upZ = 1. The other values can stay. Your given and desired points suggest you want to rotate the camera position and its up vector about an axis parallel to (1, 0, 1) by angle PI. Doing that would yield the values I listed above. Can you explain why this is happening? It looks like you are getting ...


0

The most security aproach is to store the players balance in a DB on a server side , and process the information about the payments in the servers side, you can use A SSL conection so your data will be safe In terms of work , you can simply add a md5 or SHA-512 with a secret key in both sides(client and server) but they still can get your secret key and ...


0

First, you need to know the screen bounds: int screenHeight = getScreenHeight(); int screenWidth = getScreenWidth(); Then, you have to initialize the velocity vector for your bouncing square. In this example it'll be <1,1>: BouncingSquare bouncingSquare = new BouncingSquare(); bouncingSquare.velocity.x = 1; bouncingSquare.velocity.y = 1; Also, for ...


0

Had the same problem with the following code: private void restart() { setScreen(new FooScreen); } Solved it simply by wrapping it in private void restart() { Gdx.app.postRunnable(() -> { setScreen(screen); }); } Hopefully that will help you.


0

Use ShapeRenderer http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/graphics/glutils/ShapeRenderer.html. Note that it's pretty slow and you'd better just use triangle sprite for that.


1

You can try calculating the surface normal using central finite differencing, and then colliding with a locally linear plane at the collision point. Vector2 GetNormal(Grid grid, int x, int y) { float dx = grid[x + 1, y] - grid[x - 1, y]; float dy = grid[x, y + 1] - grid[x, y - 1]; return Vector2(dx * 0.5f, dy * 0.5f); } When your grid is ...


0

Create an arrays for each direction of running index. So, if there is one direction the player can move, all the player can do is either run or not run. You have a single array. Say the that your animation requires 3 poses: both feet down, left leg up, right leg up. You place them in an array as indexes 0,1,2 respectively. Then your run_annimation array ...


1

Here is an official Spine 2D example where they load Spineboy into a game. https://github.com/EsotericSoftware/spine-superspineboy The following 3 lines are used to read a texture atlas and skeleton data as well as making some animation state data. TextureAtlas playerAtlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas")); SkeletonJson ...


0

i have done like this to supprot multiple resolution............. my AppMacro.h #ifndef __APPMACROS_H__ #define __APPMACROS_H__ #include "cocos2d.h" #define DESIGN_RESOLUTION_480X320 0 #define DESIGN_RESOLUTION_480X320 1 #define DESIGN_RESOLUTION_1024X768 2 #define DESIGN_RESOLUTION_1280X800 3 #define DESIGN_RESOLUTION_2048X1536 4 /* If you ...


2

You can see what's in an apk file by renaming it with a .zip extension and using the usual tools to look inside it. That way, you can see the size of everything included in your build.


1

It's slow because you're sending a drawcall for every polygon. And each drawcall means communication with the drivers and the GPU, which is slow (I don't know exactly how it is the OpenGL ES. But on Desktops your target is to minimize the amount of drawcalls). And that is, where vbo's come in. A Vbo stores all the vertices of an object in a buffer. If you ...


1

It sounds like you are talking about what is required to deploy to test devices. Luckily, it is significantly easier on Android than it is on iOS. Your tester will have to enable the installation of non-market on their Android device, after which they can just click on a link for an APK and download/install it through their phone's browser. To enable ...


1

Well, here is the minimum you need: You have to install android sdk and set path to it in Unity preferences You have to switch target platform to android and set settings you need in Player Settings (like supported android versions etc.) Click "build" in Build Settings - if everything is fine you'll get an .apk file that you can send to your friend But ...



Top 50 recent answers are included