Java is both a popular object-oriented programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

learn more… | top users | synonyms

2
votes
2answers
41 views

How can I automatically fit elements in libGDX layouts?

Recently I wanted to use libGDX's Table to show four buttons. But my table doesn't fit on the stage: Here is the code I used: table.add(new GameButton("1")); table.add(new GameButton("2")); ...
0
votes
0answers
9 views

What is vector<E> how to use in android java [duplicate]

I making game i want use vector into velocity,position and rotation. But i don't know how to wark vector so please help. Thank you
3
votes
1answer
106 views

VBO rendering crashed with glDrawArrays

I'm playing around in LWJGL3 and I'm experiencing an issue regarding glDrawArrays. At glDrawArrays the JVM crashes. I'm using modern OpenGL and therefore I have my own shaders and matrix ...
2
votes
0answers
50 views

Fixed timestep periodical “lags”

I have fixed timestep code in my main thread, it looks like this: float oldTimeSinceStart = 0; float accumulatedTime = 0; float maxDeltaTime = 0.1f; // 10 FPS float fixedTime = 0.016f; // 60 FPS ...
1
vote
1answer
148 views

Java Reversi/Othello - Checking if Valid move

I've written a gameBoard class for a Reversi/Othello which is the following: import java.io.Serializable; public class GameBoard implements Serializable { private static final long ...
2
votes
1answer
43 views

Call function via ContactListener

I've been creating a game on my own in LIBGDX, BOX2D and there' s a problem I can' t solve. When two World bodies collide, method "beginContact" is called in MyContactListener class that implements ...
0
votes
0answers
52 views

Rendering BOX2D shapes with LIBGDX

I have been creating a game on my own and I need a little help to begin with graphics. I haven' t found much in the internet about this topic, so I came here. Right now I've got a chainshape that i'm ...
0
votes
0answers
97 views

Marching Square Generated 2d Terrain: Dealing with more than 2 tile types

I need some help with my random map generator. First, I use a noise generator (something like Perlin noise) to create my tile array. For now i'm using three tiles: water (0), beach (1), and grass ...
3
votes
0answers
37 views

When I add in Java transformationMatrix I can't see images? [closed]

When I add in Java transformationMatrix I can't see images moving but when I remove it I can see why and how to fix it? Any ideas how to fix it? My Renderer class: public class Renderer { ...
1
vote
1answer
56 views

Minecraft Forge 1.8 referencing mod problem

I'm trying to make a Minecraft Forge mod. I've done this before, but I've never worked with entities. So I was trying to add an entity to the EntityRegistry, but I can't seem to reference the mod file ...
0
votes
0answers
29 views

Creating tunnel of points in LIBGDX

I have been wandering in the Internet lately to find the best possible solution for creating a 2d tunnel/cave in my game in LIBGDX. My game in short: One player can control a shape in tunnel, the ...
0
votes
0answers
35 views

LibGDX: drag and drop in a vertical group

I need to mode with a drag and drop a cell/row in a vertical group and change its position, before or after another cell/row. Is there something that can help me to implement this? Thankyou
-5
votes
3answers
196 views

Making game totally from scratch [closed]

I'm used to make my games in Java. Java is an awesome language but to launch .jar files you need a good updated JRE. So I thought: "I'm just going to make my games in C# or C++!" Unfortunely, I can't ...
0
votes
1answer
68 views

Libgdx crash on dispose()?

Whenever I try to manually call the dispose method in one of my screen my game just crashes. My dispose looks something like this @Override public void dispose() { battletheme.dispose(); ...
0
votes
1answer
190 views

Libgdx switching between screens without losing Information

I've been having issues with Screens, as I want to switch between the main game screen, the battle screen and the ingame menu screen (JRPG). The problem is that I have initialised all the information ...
0
votes
1answer
40 views

Speed from delta time not correct

My game object isn't moving in correct speed calculated from deltaTime bellow. It should reach half of the screen in one second, on any device. Devices: tablet A7600-F - deltaTime = 0.03355443; ...
-1
votes
1answer
45 views

Movement calculation from delta time

I'm trying to calculate object speed from delta time, to get object reaching the same distance in same time on all devices. What I did: while(running) float timeSinceStart = System.nanoTime(); ...
0
votes
0answers
10 views

Adding nodes to group

I add some nodes to a Group object(say ob1) and apply transformation to the group object. After that if I the same nodes to a new Group object(say ob2) are the nodes placed at new position after the ...
5
votes
1answer
131 views

How do I avoid floating point indeterminism when implementing lockstep?

I am working on a multiplayer RTS game in Java. It uses lockstep for networking, which requires that both computers can deterministically. These are the 2 closest/more viable approaches I could come ...
0
votes
1answer
40 views

Using deltaTime

I got deltaTime calculated as 2.7855414E8 on my tablet. How do I get speed for specific device, calibred by deltaTime? For example, if I need object with moving speed, which is about reaching half ...
0
votes
0answers
76 views

Applying animations to 2x2 Rubik's cube

I built a 2x2 Rubik's cube with javafx and my next goal is to apply animations to it. For that I need to keep track of the individual cubes. But I could not find one. Then I simply set up four Group ...
4
votes
2answers
160 views

How do I induce collision events in LibGDX 3D?

In the code below I've put an example of something I want to do. I have the camera and I want it to stop moving whenever it hits one of the boxes, how do I do this? public class Main extends ...
1
vote
3answers
246 views

libGDX best way to do Game States

I'm making a JRPG in libGDX, and I'm working with Screens. I have a main Screen called GameScreen, a screen for battles called BattleScreen and I want to make a screen for managing party members and ...
1
vote
0answers
42 views

The new android studio? [closed]

I got the new android studio, and I noticed one thing when creating a new activity. The layout that corresponds with the java for the activity is made twice, once as a content: This new layout ...
0
votes
1answer
58 views

Java 2d topdown collision

Im making a game and Im working on the collision. First Ill tell you what I want (Ill put in pictures), then Ill leave the code. What I want: I want the player to stop exactly before its collision ...
3
votes
2answers
203 views

How do I test for intersection between a ray and a cone?

I decided that writing a ray-tracer in my game was a brilliant idea, and so now I am looking for code to use for ray to primitive intersection tests. I have based my effort on this very nimble yet ...
1
vote
1answer
88 views

How to replace tiles in Tiled in AndEngine?

in my Game I Create object layers and interpret the shapes in the engine as collision objects...now I want when Player collide with object, after a few seconds object falls...this works properly but ...
1
vote
1answer
67 views

Different screen sizes? (landscape)

I want to make a separate landscape layout for each size of my original layout I have activity_main.xml. I have adapted it to be able to fit multiple screen sizes: Now, I want to create a ...
1
vote
1answer
52 views

Calculate speed of object for specific device

I have an object - player - which is moving X px ahead each update (updates based on device FPS). From my results, to get average same player speed on all devices, is to do calculation screenWidth / ...
0
votes
2answers
197 views

RPG Damage Calculation Logartihm in Java

I'm trying to make a damage calculation formula for my RPG game, there are 12 levels for both the Player and the Enemy, I've come as far as making a Reverse Exponential formula, but I want the damage ...
0
votes
1answer
80 views

Map coordinates to camera coordinates

I have a tiled map which is 3 times higher than camera. When I press on a tile, I want an actor on that tile to show up. This works if camera is not moved. If I move camera a little bit up, so the ...
2
votes
0answers
51 views

Sprite animation in Android view

I'm looking for a way to have different sprite animations in individual Android views. I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation. ...
1
vote
1answer
103 views

Different screen sizes?

I have looked through all of the android docs and many stack overflow questions, and I have a question on supporting multiple screen sizes. If I have some drawables, I know I need to put them in ...
0
votes
0answers
39 views

Proper method of writing XML File data into a class array?

So I have 3 objects, The Main world class that is meant to hold all global data and do some mild file manipulation, the biome class that is meant to be syntax for creating biomes, and the XML file ...
2
votes
1answer
139 views

How would i go about implementing portals into my game?

I don't mean to ask a broad question, so let me explain. I'm creating a 2D top-down design game and I'd like to implement "portals" to be able to switch between worlds. Each world is a level class, ...
1
vote
1answer
38 views

Binding tiles with Rect

I'm having trouble binding tiles with Rect. I've successfully bound other objects (such as the player, trees etc) in my game with rectangles but I'm unable to do the same with the tiles and I don't ...
-2
votes
1answer
76 views

How do I get into 3D Java game development? [closed]

I have learned how to make a 2D game in Java using Eclipse and processing but I am not sure how to do 3D game development. I have tried looking up examples of how to do this but I have not found any ...
0
votes
0answers
25 views

Layout is different?

I know that layouts can look different on different screen sizes, but I didn't take that into account when I made this layout. So, it is designed for normal screen size, by default, and my phone ...
2
votes
1answer
79 views

Comparing the images

I have a drawable, which I want to compare to. I created a drawable object with it, and when I log it with toString, I get: android.graphics.drawable.BitmapDrawable@41f95548 I am randomly selecting ...
-1
votes
1answer
79 views

Repeat a bit of code? [closed]

I want to complete a task, which assigns the variable randomButton a value. At the end, I want to check the value of randomButton If it is something I don't like, I want to re do the task where I ...
3
votes
1answer
132 views

Creation of a tiled map editor polyline in box2d is not working correctly

I'm currently trying to create a box2d polyline object in my libgdx game, but it's not working as expected. To get a better picture of my subject, have a look at how it should look like, and how it ...
1
vote
0answers
59 views

Game is responding very slowly?

I have a very simple app which removes buttons and re-adds buttons to certain layouts when a button is clicked. The problem is, this process is taking a very long time. My question is: How can I make ...
1
vote
1answer
27 views

Device model detection and comparation doesn't work

I need to detect device model, and if it is Galaxy Ace GT-S5830i, print it out. But it never print's it (it doesn't get through condition). My code: public String mDeviceModel = ...
2
votes
2answers
265 views

RTS combat system

I am developing a small-scale TB/RT Strategy hybrid, not unlike the Total War series. It's in the classic medieval setting, with only melee infantry combat currently implemented for testing. Units are ...
2
votes
1answer
144 views

How can I optimize block rendering in an OpenGL game?

I am working on a game with blocky graphics -- similar to Minecraft. My world generation algorithm is similar to the Diamond-Square algorithm. The terrain was initially too rough and uneven, so I ...
0
votes
1answer
51 views

Prevent button layout changing after one is removed?

I have a layout with four buttons in it. I end up removing one of the buttons using: View v = (View) findViewById(R.id.ViewId); ((ViewManager) v.getParent()).removeView(v); The ...
1
vote
2answers
114 views

Swap buttons in layout

Say I have 4 buttons. I want to have button 2 always swap out with another button, randomly. So, when the user taps button 2, it should swap with another button (randomly). Now, button 2 is at the ...
1
vote
0answers
39 views

How can I move my button?

I am new to animations in android. I was wondering, is there a way to keep a button moving around the screen, bouncing off the walls, until it gets clicked? I was thinking to do something like this: ...
2
votes
1answer
69 views

How can I fix my audio? (prioritize)

When two audio's are played at the same time... the sound is cancelling out. How do I fix this weird phenomenon? I have some code where there is audio on button click and audio in ten second ...
0
votes
0answers
38 views

Two sounds played simultaneously cancel out? [duplicate]

When two audio's are played at the same time...the sound is canceling out. How do I fix this weird phenomenon? I have some code where there is audio on button click and audio in ten second intervals ...