Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (769)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (855)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 5
1  Game Development / Newbie & Debugging Questions / Re: [LibGDX] How to viewport? on: 2015-05-10 03:44:48
SpriteBatch will use its' default camera with a width and height set to the window size when you do not set the projection matrix. The reason the texture shows up in the center when you do set the projection matrix to your camera, however, is because by default an OrthographicCamera has (0, 0) set to the center of the screen. If you instead do this:

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(false, 800, 600);

The camera will have a width and height of 800x600 and a position of (0, 0) in the bottom left corner. The first parameter species whether you want the y-values increasing up or down the screen. False for up, true for down. This should give you the results you want. Cheesy
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-12-17 20:30:25
Those would make lovely wallpapers. Could you render the second to last one in 1080p? Cheesy
3  Games Center / Contests / Re: Ludum Dare 31: "Entire Game on One Screen" on: 2014-12-06 02:09:14
Wow, what a lousy theme. I was really hoping ☃ would win, but w/e. I can't participate anyways because of homework and such... hopefully I'll be free in April and the theme will be better.
4  Discussions / Miscellaneous Topics / Re: [news] Windows 10 (9) on: 2014-10-05 14:37:13
Windows is slow and freezes a ton. Not to mention it's expensive and so inflexible. I switched to Ubuntu recently and I can't tell you how much I love the terminal and all of its mighty power, something you'll never find on Windows.
10 is what 8 should have been.

In my experience, Windows has never been slow and rarely freezes. The last time Windows froze was on my older laptop which had a defective motherboard and SSD. Yeah, Windows could be better (which Windows 10 is doing), but it's not a piece of junk. Windows works perfectly fine for a lot of people, and most get it for free when buying a new computer. Also, most Windows users are not developers. They don't need the terminal (or even know what it is).

Assuming Windows 10 is a success, this follows Microsoft's release schedule. Windows XP was great, Vista was horrible. Seven was awesome, Eight is debatable. Just like Windows 7 was what Windows Vista should have been, Windows 10 is what Windows 8 should have been. Cheesy

Saying that, I would gladly switch to using Ubuntu, however Toshiba refuses to make drivers for its Dynadocks. Sad
5  Game Development / Newbie & Debugging Questions / Re: Trouble rendering using BufferedImage, pixels and for loops. on: 2014-08-29 06:59:43
Use the libraries however you like. I'm sure there's quite a few paid Android and iOS apps made with libGDX and even more desktop games use LWJGL (such as Minecraft).
6  Discussions / General Discussions / Re: Performance Test for the Voxel Thing on: 2014-08-28 14:24:15
58-59 FPS

Intel Core i5-3317 @ 1.7GHz
Intel HD Graphics 4000 w/ 128MB dedicated video memory

I thought my laptop would crash and burn when running this as it usually does with games, but it didn't.
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-08-20 08:03:41
I made some origami! It's a fawn and a five intersecting tetrahedra. Cheesy
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-08-15 07:14:39
Drew the art for the next update to City Jumper, and I'm really proud of it. Cheesy Right now it's just a mock-up but today I'm going to implement it in code.

Also made a new pixel person: Cheesy
Click to Play
9  Game Development / Game Mechanics / Re: Assistance with Simple Euler Physics Integration on: 2014-07-29 08:26:42
Gah, I accidentally hit appreciate on your comment, Roquen. No harm done. Cheesy

Anyways, I have time to spare so I'll explain this as best as I can.

Adding to what Roquen said, you only calculate the delta time once when you instantiate your Player class. Delta time is the time between the last frame and the current frame, so saving the value is useless. In your isRunning() method, add store the current delta time and use that. Also you can shorten your if statements. Instead of
if(statement == true)
, you could simply write
. Last thing, avoid creating new objects in methods called repeatedly. libGDX's Vector2 class has a method called
set(float x, float y)
so it's better to call that method than create a new Vector each time. Now onto the actual physics. Cheesy

If I understand correctly, you want the player to accelerate to a maximum speed, and 'drift' to a stop. Here's my usual approach:

Lets define some values first. Suppose our object accelerates at 20 pixels per second. And our maximum speed (otherwise known as terminal velocity) for both the x and y axis is 200 pixels per second.

Check which movement keys are pressed. If up is pressed, set acceleration.y to our acceleration value. If up is not pressed, set acceleration.y to zero. For down, set acceleration.y to the negative of our acceleration value or zero if not pressed. Repeat for left and right, but on the x-axis instead.

After the acceleration vector has the correct components, multiply it by deltaTime. This will normalize the acceleration values based on the time elapsed so the player moves at the same rate regardless of frame rate.

Then, add the acceleration to the velocity. Now, we need to cap the velocity in case it exceeds our maximum speed (otherwise known as terminal velocity). Add a couple if statements to check if the x and y axis of the velocity exceed our maximum speed, and cap them if they do. Viola, our player moves smoothly! But how do we stop?

When a key is released, it's acceleration component is set to zero. Newton's first law of physics states objects move with a constant velocity (or stay at rest) until acted upon by an outside force. To stop our object, we have to simulate friction (the outside force). Don't worry, this is really simple.

Before, when we checked if each key was pressed, we set it's respective acceleration value to zero if it was released. So if up was released, acceleration.y would be set to zero. This means our object should start slowing down on the y axis. Use a simple if statement to check if acceleration.y == 0, then multiply velocity.y by some friction or damping value. The higher the value the more gradually an object will slow down. I usually use 0.95, but you can play around with different values to find what you like.

Lastly, add our velocity to our position and reset our acceleration back to normal by multiplying it by the inverse of delta (1 / delta). This is important, otherwise you'll keep multiplying the acceleration by delta until it reaches zero.

Now we're done! Cheesy Your object will accelerate to a maximum speed and slow down when you let go of the movement keys. Here's some really basic pseudo code you can use:

// I should probably have used pastebin for this... I didn't realize how long it'd be.

// Our constant values
final float ACCELERATION = 20F;
final float MAX_SPEED = 200F;
final float DAMP = 0.95F;
float deltaTime = 0;

Vector2 acceleration, velocity, position;

public void update() {
   // I usually pass the delta time as a parameter to the update() method,
   // but you can do whatever you want.
   deltaTime =;

   // Step one: Check each key.
   if(up.isPressed()) acceleration.y = ACCELERATION;
   else acceleration.y = 0;

   if(down.isPressed()) acceleration.y = -ACCELERATION;
   else acceleration.y = 0;

   if(left.isPressed()) acceleration.x = -ACCELERATION;
   else acceleration.x = 0;

   if(right.isPressed()) acceleration.x = ACCELERATION;
   else acceleration.x = 0;

   acceleration.scl(deltaTime); // normalize the acceleration.

   velocity.add(acceleration); // Add the acceleration to the velocity.

   // Check if the velocity is greater than the maximum speed
   // By using the absolute value, we can avoid two clauses as we will not
   // need to check if the velocity is less than the negative maximum speed
   // since absolute value returns the distance a number is from zero.
   // Signum returns 1 if the value passed in is positive, zero if it's zero, or -1 if it's negative.
   // This preserves the direction of the velocity.
   if(Math.abs(velocity.x) > MAX_SPEED) velocity.x = MAX_SPEED * Math.signum(velocity.x);
   if(Math.abs(velocity.y) > MAX_SPEED) velocity.y = MAX_SPEED * Math.signum(velocity.y);

   // Dampen our velocity to drift to a stop.
   if(acceleration.x == 0) velocity.x *= DAMP;
   if(acceleration.y == 0) velocity.y *= DAMP;


   acceleration.scl(1 / delta);

   // Tada! We're done. :D

Also, welcome to the forum! Wink
10  Discussions / Miscellaneous Topics / Re: Game art for programmers with non-existent budgets on: 2014-07-26 07:45:02
Instead of making your own art, you could use the many free assets available around the internet. Sites such as offer lots of assets which you can use even in commercial games by doing as little as adding the authors' name in your credits. There's things like this 16x16 fantasy tileset and Kenny's incredible public domain assets.

A google search for public domain pixel art pops up a lot of great results. Good pixel art is reeeally hard to make. Luckily, this world has some nice people who give away their work for free. Cheesy
11  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-23 14:23:52
Made some progress on my Space Game: Gfycat link
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-20 21:49:24
That's really neat! Is it rendered in 3D or 2D? I'm guessing 3D by the shadows but I'm not sure. Also, are you using a noise function for that?
13  Game Development / Newbie & Debugging Questions / Re: Having a Problem with ArrayLists and Objects on: 2014-07-20 08:42:21
Instead of storing the objects' index for later, you could loop backwards from your fluidObjects array and remove the objects right then and there.

for(int i = 0; i < worldObjects.size(); i++) {
    for(int j = fluidObjects.size() - 1; j >= 0; j--) {
        if(shouldRemove) {

I'm not sure why your code creates thousands of objects. Maybe worldObjects contains a ton of fluidObjects arrays for some reason?

I'd also avoid confusing variable names such as naming an ArrayList i because it's easier to forget the objects' purpose. Cheesy
14  Games Center / WIP games, tools & toy projects / Re: Project NAH - A sandbox survival platformer. on: 2014-07-15 20:46:51
Perhaps simply have the camera stop following the player once they reach an edge. Really nice project, by the way! One thing though, falling and jumping look very linear. I would suggest adding acceleration so the player jumps following a smooth parabola and gains velocity while falling down.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-10 20:12:55
Creating a falling meteor space-type game and this is what I have so far:
Click to Play

Random polygon generation, lots of trig, and keeping my code clean for once took up most of the time spent making this project. However, I'll have to replace the polygons with proper textures and the turrets will end up being spaceships so all that math was for nothing. Oh well, at least I learned something. Cheesy
16  Games Center / WIP games, tools & toy projects / Re: Jumproom on: 2014-07-05 20:21:57
Okay, first, reeeally like the graphics. They're so well done and fit perfectly! I've noticed the background is rather static and boring however, simply making the clouds move with some paralax would really add some sense of dimension to the game.

I completed all levels and one warp level with three stars except for level 8 and had tons of fun! I'm not sure it's possible to get the second star in level 8 without falling off the map unless you move it down a block. Also, there's a two second delay before the restart and main menu options appear when you fall down the map which quickly gets annoying. I could also jump across spikes by repeatedly clicking as Bearded Cow mentioned.

How many warp levels are there? I only found one and cannot find the rest.

Good game, nice job! Cheesy
17  Discussions / Suggestions / Re: Pre-WIP section on: 2014-07-01 17:19:42
In addition to a pre-WIP, I think we also need a pre-pre-WIP to document game ideas and get input on them before starting to code them. Cheesy

Seriously though, you don't need to post on this forum if you want to document your progress. There's personal blogs such as Wordpress or Tumblr for that. Cheesy Not yet playable is still WIP; for example, Rayvolution's Retro-Pixel Castles doesn't have any gameplay, but I'd definitely consider it a WIP over a pre-WIP.
18  Java Game APIs & Engines / Engines, Libraries and Tools / Re: libGdx setting a trajektory for a object to move on: 2014-07-01 10:21:51
You could use the four basic equations of kinematics to determine the x and y position of an object relative to its velocity and the amount of time elapsed, but really, it's much easier to just apply gravity to your objects. You simply need three vectors;
Vector2 position
Vector2 velocity
, and
Vector2 acceleration
. Set the y component of the acceleration vector to your gravity value (I usually use -10) and the x component to 0. Then set the x and y components of the velocity vector to the speed of your object. In your update method or loop, add the acceleration to the velocity, then add the velocity to the position, ex;

If you have an angle instead of x and y components for your velocity, you could get the normalized x and y components of the angle with some trig then multiply them by how fast you want your object to move:
x = cos(angle) * xSpeed
y = sin(angle) * ySpeed

With this bit of simple physics, your object will move on a parabolic curve. Hope this helps!
19  Game Development / Performance Tuning / Re: Yet another voxel engine on: 2014-06-22 19:58:37
Intel Core i5 1.7 GHz
Intel HD Graphics 4000
Windows 8

Solid 2000 FPS. Really surprised it's that fast. Shocked
20  Games Center / Archived Projects / Re: Flubber Space on: 2014-06-21 17:49:05
It's more worth your time to use libGDX, as Slick2D is basically dead.

Btw, I would really recommend GifCam.
21  Discussions / Miscellaneous Topics / Re: Longest program you have written? on: 2014-06-18 01:00:32
You'd end up with something similar to FizzBuzzEnterpriseEdition. Cheesy
22  Discussions / Miscellaneous Topics / Re: Interesting Profile pictures on: 2014-06-17 18:41:56
I'm not sure what that could be besides a hat. Tongue

I made my current avatar last summer and uhm... there's really nothing special about it. Sky blue is my favorite color, and I'd love to fly hence the wings. That's about it. Smiley
23  Discussions / Miscellaneous Topics / Re: Code-style: Cringe pics on: 2014-06-05 20:00:57
I can't resist the urge to edit your code, Rayvolution:
public void setAccentMode(boolean on) { accentMode = on; }

I found this:
int length= 0;
for(int i = 0; i < array.length; i++){
System.out.println("Array has " + length + " elements.");

Going through some old code, I found this:
if(someCondition) {
   if(anotherCondition) {
      if(yetAnotherCondition) {
         SomeObject object = aParameter;
         if(ANOTHERcondition) {
            if(lastCondition) {
               AnotherObject object2 = getOtherObject();
               if(object2 != null) {

I removed the conditions and changed object names to remove confusion, my code wasn't THAT terrible. But six nested if statements, anyone?
24  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > Now on Steam! < on: 2014-06-03 19:15:08
If you do put a box around the logo, also include the blurbs. They're hard to read when over lava or stone.
25  Discussions / Miscellaneous Topics / Re: Random syntax tweaks! on: 2014-06-01 21:35:59
Dart has really nice constructors and methods with default values:

String method(String foo, {String bar:'default value', String ball:'bat'})

var variable, number, name;
SomeObject(this.variable, this.number,;
26  Discussions / Miscellaneous Topics / Re: Setting up a website for a complete noobie on: 2014-05-29 20:20:20
If you have $4 a year, you could go with I'm planning to use them in the future, because 000webhost sometimes pops up ads on your site when it loads which can deter some visitors.
27  Discussions / General Discussions / Re: New feature: topic labels [solved] on: 2014-05-06 20:12:50
I like this update, looks great! Could you get the labels to also show up in the "Recent Posts" section on the homepage?
28  Discussions / General Discussions / Re: The Differences between Java and JavaScript. on: 2014-04-27 21:03:06
Java to Javascript is like ham to hamster.
29  Game Development / Newbie & Debugging Questions / Re: New vector from known angle on: 2014-04-14 16:46:36
You don't need to calculate a new vector from the angle of reflection. You can just invert the y component of vector A to get vector B.
30  Game Development / Newbie & Debugging Questions / Re: Is this book good for libgdx beginners ? "Beginning Android Games" on: 2014-03-26 19:26:32
Beginning Android Games was written by the author of libGDX. Smiley Throughout the book, you put together a sort of "mini libGDX" while learning the Android API and using it to make 2D and 3D games. I recommend it, it's a really great book.
Pages: [1] 2 3 ... 5
EgonOlsen (1569 views)
2018-06-10 19:43:48

EgonOlsen (1541 views)
2018-06-10 19:43:44

EgonOlsen (1141 views)
2018-06-10 19:43:20

DesertCoockie (1568 views)
2018-05-13 18:23:11

nelsongames (1172 views)
2018-04-24 18:15:36

nelsongames (1549 views)
2018-04-24 18:14:32

ivj94 (2306 views)
2018-03-24 14:47:39

ivj94 (1515 views)
2018-03-24 14:46:31

ivj94 (2602 views)
2018-03-24 14:43:53

Solater (879 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!