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

0
votes
1answer
43 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
39 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
31 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
41 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
98 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
39 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
60 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 ...
3
votes
2answers
72 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
117 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
37 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
53 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
126 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
66 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
47 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
44 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
171 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
65 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
36 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
77 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
25 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
133 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
28 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
67 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
24 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
56 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
78 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
82 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
56 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
236 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
130 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
41 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
74 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 ...
1
vote
0answers
32 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
56 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 ...
3
votes
1answer
76 views

How do I stop my timer when I close my game?

Background: I have a background service with a timer. It opens up a new activity when 20 seconds are over. Currently, my app is using componentCallbacks2 to detect when the user has pressed the home ...
0
votes
2answers
97 views

Connect phone to computer? [closed]

In order to test out my game, I need to use my real life device. The problem is, android studio isn't recognizing my device plugged in: The problem: My device isn't getting detected in android studio ...
2
votes
1answer
80 views

Calculate average velocity of the object before the game start

I have a game object (player), and with device screen width and average FPS, I'm able to calculate exact velocity for the player to reach whole screen from left to right in a specified time (fx. for 1 ...
1
vote
0answers
43 views

How can I detect sprite collisions out of screen?

I am creating an Android game using andEngine library. I have enemies coming from out of the screen into the screen. I already know how to detect collisions, but is there any method I can use to ...
1
vote
2answers
99 views

OpenGL — Better to switch out material or shader for changing object colors?

I'm fairly new to shaders and OpenGL so bare with me please, I just want to make sure I'm doing it correctly! Now I'm using LibGDX in order to create a simple 3d diagram for my company. I have a few ...
1
vote
1answer
44 views

Calculating delta time

I'm trying to calculate deltaTime, but it's not correct. What's wrong in my code? //declared outside private long timeSinceStart = System.nanoTime() / 1000; private long oldTimeSinceStart = 0; ...
0
votes
0answers
13 views

Is it possible to draw outlines of images in Slick2d?

Im making a game and I've woundered if there is a way to draw an outline to an image with the slick drawing API, because Im using pixelart so it's kindof nasty to draw the outline within the sprite ...
1
vote
0answers
49 views

how to get rid of blurred and overlaping 3d shapes in javafx

I actually wanted to build a 2x2 rubiks cube. As the Box class in javafx doesn't provide the feature of building a cube with different colours on different faces, I chose to build the cubes using ...
0
votes
1answer
67 views

Game speed on different devices isn't same

I have an app, in which I have constant int speed = 5; On each update, the game object (player) is moving 5px ahead. Problem is, that I can't handle that on different devices - older devices is having ...
0
votes
1answer
56 views

LibGDX hexagonal tilemap getting adjacent tiles

How do I get all adjacent tiles to a hexagonal tile, my tile map is using a staggered co ordinate system with an odd stagger index and I am using libgdx java. if (x % 2 == 0) { hexAdj[0] ...
1
vote
1answer
27 views

How can I move the camera directly under a certain plane?

I am attempting to render a "reflection" of a scene for water: To create this illusion, I need to render the scene from below, and then ignore all geometry below the water line. As such, I need ...
-1
votes
1answer
57 views

Java map creation

So Im making a topdown 2d rpg in slick2d and lwjgl 2, and I wanna make a map, but not just random map, something like this: The blue stuff is water and rivers, the gray in the middle is "the ...
0
votes
1answer
37 views

Java Slick2d image depth/layering

Im making a topdown 2d game, and I've made a decent entity system so far. But I want to do the following with it: I want to have drawing depth, so if a , for instance, tree is above another tree then ...