Questions tagged [java]

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.

Filter by
Sorted by
Tagged with
0
votes
0answers
18 views

Looking for tips on how to optimize/debug Java/Eclipse

I made a raycasting engine with wall textures. Before adding the texture the engine was silky smooth. With textures it has small lags (or stutters) when i move around and i would like to know why. My ...
0
votes
0answers
12 views

Flex Build error Error of java

...
0
votes
1answer
26 views

Class Not Found Exception on Class.forName()

Edit: Solved, for some reason my For each loop was getting out of bounds for the Starfish class, so I did a little null check and it worked out fine. I am having this exception on title. I have been ...
1
vote
1answer
25 views

Drawing object lines in the Tiled map editor

Suppose I have this picture: I have a map like this created in Tiled already. I would like to draw collision lines (the green ones in the picture) without having to make it a polygon. As far as I ...
-4
votes
0answers
27 views

How to capture game's screen with 60 fps in java?

How to capture game's screen with 60 fps in java? I want to capture the game's screen in programmatically with java. I am using awt.Robot method to capture the game's screen. But, The fps of the ...
0
votes
0answers
17 views

Dynamic spawn system

What are good approaches or patterns to structure a dynamic spawn system ? It should be able to "create" entities by their type-ID based on a set of rules which are able to change dynamic during ...
0
votes
0answers
10 views
0
votes
0answers
29 views

Is using sprite sheets and drawing specific part the way to go?

I'm programming in Java. I have more than 200 MB of images used in my games, something like 100000 40x40ish images. I initially wanted to load them all during app initialization but it took like 2 ...
1
vote
1answer
37 views

Function to draw an image inside a rectangle

How can I draw an image inside a rectangle? I am introducing myself in the manipulation of images for games, I have a window and inside there is a rectangle that deforms. I would like to fill the ...
0
votes
0answers
27 views

Simple Checkers Game between two users

I am having issues with being able to have a click that occurs in one class interact with another class. I have a CheckerPiece class, where a ...
-1
votes
0answers
33 views

Libgdx, size of the button on phone really small

I making a game, so I created main menu with scene2d,on PC my menu looks good (big buttons on the center of the screen), on my phone it looks very small, what should I change? If you see any code I ...
1
vote
1answer
48 views

How to choose what to use in Java: Enums or Objects?

I'm in a dilemma over using Enum Types or using class objects in that particular part of my java project. Let's suppose I have an array where I constantly add and remove things from it, but I also ...
0
votes
0answers
15 views

Sliding against a wall is “sticky”

I try to implement a ball sliding mechanism in my game. When the ball collides with a wall, it gets bounced. When it's close enough though (after many bounces) it will start to slide against it. But ...
0
votes
0answers
23 views

What design choice should I follow for client-server communication?

My game server currently launches a thread for each connected client, and handles all data exchange through that socket in a server-blocks-until-client-requests fashion. The problem derives from the ...
1
vote
1answer
53 views

Java - set resolution of game

Hi everybody I am making small game using pure Java 8 and rednering it by Java AWT Graphics2D method . My question is how to make that user can change the quality ...
0
votes
0answers
19 views

empty screen in my game

Below are 5 activities that form my simple app; I still can't figure out why it doesn't show anything(only a black empty screen): I have another question: Is there any issue with using time in ...
0
votes
1answer
25 views

Box2d: crash on createBody in beginContact callback

I am getting this error on creating body in contactListener ...
0
votes
1answer
38 views

What is the most efficient way to load all the textures?

I am developing a game (in Java) that is going to have a lot of textures and images in it. What is the most efficient way to load all the textures? I was thinking on pre-loading all the images ...
0
votes
0answers
8 views

adding video to jrame

I am using java to build a game and I want to do something like that example: I am pressing some pre-detmired button that causes a video to start. I want to do something like a cutscene that will ...
0
votes
0answers
28 views

best method to draw in android studio games

After several tries to draw my player, enemy object in my game, I often face a problem rendering either because the method cannot be resolved or because I have a player and enemy classes both extend ...
0
votes
0answers
10 views

LibGDX - Java — How do I determine the alpha value of a pixel programmatically?

My goals are to generate hit boxes and click boxes using alpha values (so that parts of my textures that are invisible remain uninteractable) I have code already for determining if the mouse is ...
0
votes
0answers
35 views

Skybox textures is black

My skybox is displayed, but does not display the textures that I load from the image. Instead, it shows the transparent color if i set glTexImage2D how ...
0
votes
0answers
10 views

LibGDX Scene2D a different way of implementing a GUI scale setting other than multiplying everything by a constant?

I have a bunch of UI elements for my game. I have an inventory, HUD, hotbar, in-game menu etc. Now I want to scale these based on a setting. I import the settings from a file and basically put it in a ...
0
votes
0answers
13 views

moving player according to swipes

In my Player.java class, I want to incorporate a function that moves my player according to the left or right swipes. I also used time in seconds in order to vary the movement in an cyclic way: <...
0
votes
0answers
17 views

Libgdx storing rendered frames quickly to use them later

I have implemented a gif-button for my libgdx game that allows the player to store the last few seconds of gameplay as a gif. It works by storing frames in memory, and encoding them into a gif if the ...
0
votes
0answers
8 views

Problem of activities [duplicate]

My game consists of a player that hopes between ropes. For now, I created the player and the rope classes. Each one contains details about the object and its movement patterns. What is the next step ...
0
votes
0answers
14 views

How to fix “stretched” textures in LibGDX?

I'm drawing textures using SpriteBatch and all textures are stretched. Previously I was using Stage and StretchViewport and back then everything was fine. My code: ...
0
votes
1answer
24 views

Positioning ropes equidistantly on a landscape display

I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display. How can I proceed? My screen is 1920*1080, at 420 dpi. Is there any way that I could link the ...
2
votes
1answer
46 views

Connecting Player and Rope classes in a rope-swinging game

I am trying to build this game where the player hops between a number of ropes. For now, in addition to my main activity that I kept empty, I built two additional classes: ...
0
votes
1answer
37 views

How to make controlled exchanges in an online-game?

There is an online game in which you can collect things of different values: ordinary, epic, legendary. The cheapest things are ordinary, the more expensive are epic, and the most expensive are ...
0
votes
0answers
23 views

Heuristic for Board Game AI Resulting in Tie

I'm developing a program for a Line of Action game (see specs here: http://www.boardspace.net/loa/english/index.html) For the AI, I've created a game tree, pretty similar to most game tree ...
0
votes
1answer
18 views

How do I make an actor move to the foreground temporarily in LibGDX scene2d?

I have an inventory UI which is a table in scene2d. Then the table had a bunch of Containers which are basically inventory slots. They have a transparant grey background color. Then in each container ...
1
vote
0answers
47 views

Hitboxes in a Java game without rectangles

I left this question on "normal" stackOverFlow but they recommended I asked you guys! I am new to making games in Java but I made some games using the paintComponent method, however I felt like I was ...
0
votes
0answers
40 views

Is using an anonymous inner class to determine game item behavior the right way?

I'm developing a little game that has a bunch of different items. I categorize the items in separate classes (consumables, armor, weapons) that all extend Item.class. Then I use one main Items class ...
1
vote
0answers
68 views

What design pattern would be most suitable for RPG skills?

I'm developing a small Java digital card game project. In my game, players can perform skills when using cards. Each skill does different things, like deal damage, heal etc.. I'm looking for a way to ...
1
vote
1answer
44 views

How do you draw a random irregular polygon in java? (Asteroids)

I am coding an Asteroids game in Java. In the real arcade game, asteroids are made of irregular shapes like this: When I code, I can only set asteroids to 1 or another specific shape, like this: ...
0
votes
0answers
23 views

Java clicking on tiles detection

I am making small isometric game, where I want to do something when user clicks a tile. I can simple do it by mouse location, but I want to be able for zooming and moving camera. It will be 2D game ...
0
votes
0answers
47 views

I need a custom launcher for my Minecraft server

I am creating my own Minecraft server for my friends and I (and then publish it). It uses Thermos for MC 1.7.10, with mods and plugins. My friends don't know how to install Minecraft Java Edition, ...
0
votes
1answer
28 views

Libgdx, button onclick event crashes

I'm trying to create an android game using libgdx with a Titlescreen, you just press start and your game startes. However I'm having difficulty trying to get these buttons to work. The titlescreen ...
0
votes
1answer
56 views

Json Libgdx serialize / de-serialize a Object Map of Object Maps

Any one have any ideas on how I can serialize / de-serialize an ObjectMap<Enum, ObjectMap<String, Object>>(); (Object is usually a String Integer ...
0
votes
1answer
87 views

Topdown Game Collision Detection

I am working on a simple game with topdown movement, but I am unable to get the collisions to work properly. I know the collision detection itself works, but the constraining of the player is where I ...
0
votes
0answers
30 views

Character shakes when using raycast avoidance (libgdx)

https://github.com/libgdx/gdx-ai/blob/master/tests/src/com/badlogic/gdx/ai/tests/steer/box2d/tests/Box2dRaycastObstacleAvoidanceTest.java Literally, I copied the core avoidance code. But substituted ...
1
vote
1answer
56 views

How can I capture only a part of my sprite sheet in my game for Java?

I have a University Project to create a simple game in Java. To challenge myself am trying to utilise sprite sheets. My issue is that the whole Sprite sheet is being shown rather than the section that ...
0
votes
1answer
42 views

How do you repeat 2D tiles in Java code when you go out of range?

I am looking up tutorials on how to make 2D games, and I can just copy and paste their code but I would rather know what it means and how to do it. Suppose you have a 2D game window that has a map ...
0
votes
1answer
114 views

What is the meaning of >> and & in this code context and what they are trying to accomplish?

I am following a tutorial on YouTube for making a 2D game. There is no clear explanation on what its actually doing. I get bit-shifting and & operator but I don't know what they mean in this ...
1
vote
2answers
33 views

Dividing coordinate into unit cube

I'm trying to write a Java class to generate Perlin Noise from a Cartesian coordinate. I'm trying to follow this tutorial but I am struggling to understand the theory. Specifically, how do you divide ...
1
vote
1answer
29 views

Implementing a movement and collision system with Vectors and Area

I've scoured gamedev for around 45 minutes, but I'm unable to find a detailed approach to implementing a movement and collision system for games - specifically, when to use which process, and what to ...
0
votes
1answer
60 views

Faster way to load VBOs in LWJGL

I'm currently working on a Minecraft clone for a university project and I'm having some trouble loading a lot of chunks at the same time without reducing performances. What I'm currently doing is: ...
0
votes
0answers
20 views

How to handling touchpad?

I have a touchpad. I tried touchpad.getKnobX> 0 and <0 (when swiping the knob left and right) the sprite still displayed but when I put touchpad.getKnobY> 0 and <0 (to swipe knob up and down) ...
0
votes
1answer
30 views

Close objects are only partially rendered - LWJGL [duplicate]

I'm working on a LWJGL project and I'm experiencing a weird problem: close objects stop being fully rendered as I move slightly away. I'm not very expert in OpenGL so I can't figure out what is ...

1
2 3 4 5
66