New answers tagged

0

Well, I am explaining a general projectile movement through programming as discussed. The basic parametric equation of projectile is, x = v.t.Cos(theta) y = v.t.Sin(theta) - ½ . g . t . t This is the standard parametric equation of projectile. Now you can simulate this equation through t i.e. time. Now consider some values for variables with keeping in ...


0

FBX is a common interchange format, so ideally just need to find a library or framework on Android that supports loading them. Alternatively, convert the FBX files to some other format that your Android framework or libraries can load. If you don't current have any investment into a particular API on Android, and you want to just load the FBX files ...


0

One way of doing this that's quite easy is to let there be a single class that extends Game, that launches the first Screen (this is pretty much what you have). What you also need to do though is to pass a reference to that Game to all your Screens so that they can call setScreen themselves when they want to go to another screen. In a somewhat simplified ...


0

If the rectangle is only going to rotate 90 degrees at a time, then the simplest possible way of determining whether a ball is colliding with a black side or not is to have a rotational state of the rectangle, for example, a simple integer: int rotation_state = 0; // 0, 1, 2, 3 defines four rotational states, 0 is up Let's say a ball's spawn position ...


0

LibGDX has an AndroidLauncher file that's located in the Android java folder that opens up the game file in the core folder but you have to add it to the android manifest for it to work


2

Cursory answer: "it might be". If you are doing "carpet testing" for collision detection, no offence, but you are doing it wrong (unless you have very few elements to test): pair checking of any kind is a O(n^2) operation, and will start to eat at your cpu time very fast as the number of objects you have in the game increases, so you might want to improve ...


1

Yes. You were able to see the sprites when Angry Birds Chrome was available to play and they looked like this:


2

You generally need three things, basically, to accomplish this. First, you need a system in your game that can hot-reload assets or other data in response to some notification that the asset has changed. When a texture changes, you'll want to upload the new pixels to the GPU. When a monster description changes, you'll want to swap out the monster's old ...


1

Create the menu in one Activity, and let that Activity be a "normal" Android activity, then have that Activity launch the libGDX game Activity. That sort of approach would allow you to use Android layouts for the menu but libGDX for the actual game.


1

you can publish different versions of your APK targeting different CPU architectures, with the same package name: Build an ARMv7 only package and an x86 only package with different version codes. The versionCode of the x86 package has to be higher than the one of the ARM package. When publishing, send both of your APKs to the developer console. Note that ...


0

You are 2 steps away from solution. 1- Select Canvas and change UI Scale Mode in Canvas Scaler to Scale With Screen Size in inspector. 2- Set screen size from Free Aspect to any other size in Game tab. Now adjust your UI, it will remain same as in Unity Editor.


1

Signing each game with a different key allows you to sell the rights to the game to another party. When all your games are signed with the same key, you need to give them your one private key, allowing them technically to impersonate you and release updates for your other games. Contractual obligations can be used to prevent that, but it's still not very ...


1

The best thing is to sign with the same key in most instances. You could in theory transfer data from one app to another. It also makes it easier to remember which key you are using. If someone wanted to buy the rights to one game, then yes, you might have an issue. But that same issue would be faced with your account. Bottom line, I'd recommend using the ...


0

You can get the effective pointer index of moving finger by checking which pointer changed: private final int MAX_POINTER = 5; // 5 different touch pointers supported on most devices private float mLastTouchPositionX[]; private float mLastTouchPositionY[]; @Override public boolean onTouchEvent(MotionEvent aEvent) int tActionIndex = aEvent.getActionIndex(); ...


0

Short answer: public void update() { if (Gdx.input.justTouched()) { //Touched left side of screen if (Gdx.input.getX() > Gdx.graphics.getWidth() / 2) { //give actor upforce and and a bit of force to the left someActor.setVelocity(new Vector2(-25, 100)); } //touched right side of ...


2

Scene2d would probably be good to use for a visual novel, it's not limited to UI, you could design a whole game with it if you wanted to. You could make a scene2d stage and then add back and forward buttons to it. You could have several buttons that you change label on and use for selecting what your characters says/does. If you find something scene2d can't ...


1

If you're not in need of a very fancy way to deal with this problem you could just brute-force it by doing these steps: Randomize the circle coordinates. Check if the distance vs all other circles that you have drawn. If it is greater than the sum of the radius of the two circles (40, in your case) you can go ahead and draw the circle. If it is equal to or ...


3

You seem to lack some insight on your issue. A couple of things to consider: Is your true maximum frame rate on your PC really 60 or is it more? NVida drivers limit the frame rate to the maximum draw rate of the monitor, typically 60 Hz; this is due to the fact that there is no need to ask to draw faster than what the monitor is able to process. By ...


0

I finally found how you can change width or height with modifiers of andengine. Don't think you need it now. But it can be helpful for others. entity.registerEntityModifier(new SingleValueSpanEntityModifier(duration, fromHeight, toHeight) { protected void onSetInitialValue(IEntity pItem, float pValue) {} @Override protected void ...


3

You did not specify whether you will have many circles or just a few. However, by the measures you mentioned I assumed it's just a few (by the way, if the measures you are thinking of are correct, only 4 circles will fit perfectly into the rectangle...). So, if you have just a few circles, you can opt for a very naive solution: save each new valid circle in ...


1

I would say there is no such standard, because there are no WiFi game controllers. All the wireless game controllers I checked use either Bluetooth or some proprietary wireless data transmission. This makes sense as WiFi typically uses more power than Bluetooth and is harder to set up. A wireless network might not even be available on location. That ...


0

My answer is based on Lolums' answer. His logic is good, especially if you are making a simulation of something with realism. But Philipp points out something important as well: correct physics do not typically translate well to platform games. The take-away is that you should apply the idea of gravity velocity_y -= gravity * delta_time but you should not ...


1

Unity Remote 4 allows the Unity editor to send a video stream of the editor's Game tab to your Android device, and responds to touch input like it was the real thing, which is a convenient way to test your touch input. More details here. But if you want to test the APK properly (like if you're testing Google Play API integration or something), you'll have ...


0

Solved. You need to download "Google Repository" from Android SDK.


2

Physics student here. Firstly, separate your velocity into two components. Character { float velocity_x; float velocity_y; } Now, when they jump, you add an initial velocity to their velocity_y and every frame, you do something like loc.x += velocity_x * delta_time (and the same for y). Every frame, you also do velocity_y -= gravity * delta_time ...


0

The issue is due to memory usage, wasted memory bandwidth and/or the time it takes to rescale it to the proper size at load time. In the case of Android using the 2D UI the image will be scaled once to the proper size at load time but this takes a bit of time and the larger original will be kept in memory if a reference to it is kept. In the case of direct ...


1

Don't get caught up in the exact numbers used in the example. Those are not the main point. It's how they are relative to each other. You see that xhdpi 200x200 is twice as big as mdpi 100x100. Notice the if in the example. List of densities: xxhdpi: 3.0 xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75 Sample example but with different numbers: ...


0

Create a callback interface that the JoystickView fires when it sees an event, then make the GameView implement that interface and register itself as a listener to the JoystickView. A simple approach could look something like this; public interface JoystickListener { boolean onJoystickEvent(MotionEvent e); } public class JoystickView extends View { ...


0

deleting plugins / android / google-play-services_lib / res / values / common_attrs removed this error.. source: http://forum.unity3d.com/threads/failed-to-re-package-resources-help.345837/


0

Looks like putting images in asset folder and loading them using BitmapFactory.decodeStream(ins) would increase loading speed a lot. See this post for details


0

I am not sure what you mean with Sensor Listener, but In case you mean accelerometer and other mobile phone sensonrs. You can disable them with this code: AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useAccelerometer=false; config.useCompass=false; initialize(new yourGame(), config); More information on the LibGDX ...


2

You shouldn't call dispose directly on a Texture loaded by an AssetManager, they are disposed the the AssetManager is cleared or disposed or if you call unload on the AssetManager and pass the Texture. The reason you shouldn't dispose assets from an AssetManager is that they can be shared between many other assets (two fonts may use the same texture for ...


-1

This is a very broad question. I'm assuming you have seen the answer from Kieran Chandler about platform abstraction. You've mentioned the SDL Library that you want to use. I've used it myself for such a OpenGL cross-platform project. The library provides most of the platform abstraction. Use its functions for all input and output, like accessing files, ...


-1

It doesn't sound like you are ready to take on a large task like this. You need to learn about the underlying concepts and make some smaller projects before you can really move on to making a cross-platform game. The main point to make about cross-platform games is that you need to have a "Platform Abstraction Layer" which will allow your game to perform ...


3

The texture regions inside don't need to be powers of two. But texture compression cells are often 4x4 so you have to be careful when using compressed textures that the edges of two texture regions don't share the same cell or they'll be compressed together which will degrade the quality if they have different colors. You should leave a N pixel border ...


0

I will presume you are using InputListener class. Because Input class don't have a touchUp method. You didn't mention this part in your question. I'll assure you touchUp funciton will not be called twice. You are using an emulator, and in this case touch up function will be triggered by the mouse button. So as long as there is not a second mouse pointer(?), ...


0

After experimenting long time, I come to conclusion, it is not possible to catch isKeyJustPressed method without implementing input processor. So i have used isKeyPressed method only, without implementing InputProcessor in my Screens. I have used a boolean flag to get to know, if back button is continuously pressed pressed from last screen, so that I won't ...


2

I'm not sure if its a good solution but i use to add x, y and z (gonna call this XYZ from now) and store it in a linked list with an object identifier and the average side size (we gonna asume that, in this example the object is a cube of 20x20x20 so 20*3/3 = 20). //PSEUDOCODE MYOBJECT ob(/*id*/ 1, /*size*/ 20, /*x*/ 30, /*y*/ 12, /*z*/ 4); ...


0

Disclaimer: This answer is 100% subjective, it is related to code design personal preferences and might not be the best answer. I would delete InteractionsManager class. The idea of having 2 lists (arrays) and checking for collision in a loop is nice, but you can do that on your Screen class. (just create a checkCollisions() method and call it on ...



Top 50 recent answers are included