Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
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: Image flickering when moved (slick2d) on: 2014-09-28 20:20:40
I remembered when I used Slick2D(you should really switch to LibGDX as you are wasting your time with that buggy crap). Rendering large images was glitchy.
It was solved by using the BigImage class.
2  Game Development / Newbie & Debugging Questions / Re: Image flickering when moved (slick2d) on: 2014-09-28 18:13:37
Do you have this problem with small images to?
3  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Looking for methods equivalent to the following on: 2014-09-28 08:06:11
That almost gave me accurate results. Probably because mul can not be used for both transform and transformNormal.

Applying a transform to a coordinate with a given matrix can probably be found on somewhere on the net. But what is transformNormal?
4  Game Development / Newbie & Debugging Questions / [LibGDX]Looking for methods equivalent to the following on: 2014-09-28 06:05:33
I am translating a XNA code and is looking for something that is equivalent to these two(preferably in the LibGDX library since I am working with their matrix classes):

1  
            Vector2 v1= Vector2.TransformNormal(Vector2, Matrix);


1  
            Vector2 v2 = Vector2.Transform(Vector2, Matrix);


Their documentation:
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.vector2.transformnormal(v=xnagamestudio.40).aspx
http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.vector2.transform(v=xnagamestudio.40).aspx
5  Game Development / Newbie & Debugging Questions / Re: Get bounding box of rotated rectangle. on: 2014-09-27 18:10:09
What are the vertices? I don't think I have them.
6  Game Development / Newbie & Debugging Questions / Get bounding box of rotated rectangle. on: 2014-09-27 16:38:02
So, I have a rectangle with a known x, y, width and height.



The top left corner is the x:y coordinate where x is increasing while moving right and y while moving down.

I then rotate it with a known value(the rectangle is rotated around its center point):



I want to calculate the position of the red dot as well as the new width and height.
7  Game Development / Newbie & Debugging Questions / [LibGDX] Updated LibGDX, crashes when creating SpriteBatch. on: 2014-09-24 17:46:36
It was a while ago since I updated LibGDX. So when I did I first got some compile time errors with the stage class.

I changed the constructor from (int width, int height, boolean something) to (ScreenViewport()).
That solved those.

I tried to run my game and it crashed as I tried to initiate a sprite batch.

The code that crashed:
1  
batch = new SpriteBatch();


The exception:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
LwjglGraphics: created OpenGL 3.2+ core profile context. This is experimental!
Exception in thread "LWJGL Application" java.lang.IllegalArgumentException: Error compiling shader: Vertex shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors.  No code generated

Fragment shader failed to compile with the following errors:
ERROR: error(#272) Implicit version number 110 not supported by GL3 forward compatible context
ERROR: error(#273) 1 compilation errors.  No code generated


   at com.badlogic.gdx.graphics.g2d.SpriteBatch.createDefaultShader(SpriteBatch.java:152)
   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:115)
   at com.badlogic.gdx.graphics.g2d.SpriteBatch.<init>(SpriteBatch.java:72)
   at ui.screens.Splash.show(Splash.java:41)
   at com.badlogic.gdx.Game.setScreen(Game.java:61)
   at ui.screens.ScreenManager.create(ScreenManager.java:33)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)


How do I resolve this?
8  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-22 14:21:13
Can you give an example on how to use AffineTransform with this issue?
9  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-21 21:50:29
Thanks all. Solved it like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
    /**
    * Rotates this entity and returns the updated {@code x} and {@code y} coordinates.
    * @param x The relative x position we want after a rotation.
    * @param y The relative y position we want after a rotation.
    * @param rotation The angle in degrees.
    * @return The point that contains the absolute coordinates.
    */

   public Point2D.Float getRotatedPoint(float x, float y, int rotation)
   {
      if(width != height)
         throw new IllegalArgumentException("Width and height mismatch. The GameObject must use a square image!");
     
      final double rot = Math.toRadians(rotation);
      final float halfWidth = getWidth() / 2;
     
      y -= x;
      x -= x;
     
      y = -y;
     
      float rotX = (float) (x * Math.cos(rot) - y * Math.sin(rot));
      float rotY = (float) (y * Math.cos(rot) + x * Math.sin(rot));
     
      rotY = -rotY;
     
      rotX += halfWidth;
      rotY += halfWidth;
     
      return new Point2D.Float(rotX + currX, rotY + currY);
   }


Can probably be improved to work with rectangular shapes and not just squares.
10  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-21 18:44:50
That didnt work either. But I do not get it. What do you mean rotate around (0,0)?  How am I suppose to calculate the position of the rotated point if I rotate around 0,0 instead of the entity┬┤s position?
11  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Get points of rotated rectangle? on: 2014-09-21 18:16:24
My code is not working. Can someone look at it? Btw using LibGDX.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
   private Point2D.Float getSpawnPos(int rotation)
   {
      /*
       * 0 degrees is facing west in my engine. Increasing this value is rotating clockwise.
       */

      final double rot = Math.toRadians(rotation);
      final float midX = getCenterX(); //The center position of the entity in the world
     final float midY = getCenterY(); //The center position of the entity in the world
     final float sin = (float)Math.sin(rot);
      final float cos = (float)Math.cos(rot);

      //currX respective currY is the absolute position of the entity in the world(top-left corner of the entity)
     float x = currX - midX;
      float y = currY - midY;
     
      float rotatedX = x * cos - y * sin;
      float rotatedY = x * sin + y * cos;
     
      rotatedX += midX;
      rotatedY += midY;
     
      return new Point2D.Float(rotatedX, rotatedY);
   }


The returned point contains absurd values.
12  Game Development / Newbie & Debugging Questions / Re: Get points of rotated rectangle? on: 2014-09-19 23:14:37
float rotatedX = x * cos - y * sin;
float rotatedY = x * sin + y * cos;
how do I apply that to my coordinate system?
13  Game Development / Newbie & Debugging Questions / [LibGDX]Get points of rotated rectangle? on: 2014-09-19 16:20:13
I have a rectangle like this:



I then rotate it  by 45 degrees and want to calculate the coordinates of the four white points.

The x/y position of an entity is the top left corner, where x is increasing moving rightwards and y downwards.
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Render an electric beam? on: 2014-09-15 15:23:29
Alright, I used this:
http://www.java-gaming.org/?action=pastebin&id=1025

And I got it to work. Its draws a jagged line between the two given points.

The problem is, it doesnt look good ingame. It looks so dull, color wise.

The image used is 7x7 white image. If I forexample use a black image, the beam is not visible. If its yellow, the beam appear green or something else ingame.
Totally weird.
15  Java Game APIs & Engines / Engines, Libraries and Tools / [LibGDX]Render an electric beam? on: 2014-09-11 22:30:16
I want to create an method that renders electricity.

1  
2  
3  
4  
public void renderTeslaBeam(Point startPos, Point endPos, Color boltColor, float boltThinkness)
{
      .....
}


I want the beam to look something like this:
http://www.youtube.com/watch?v=beZHpaLo7e8&t=1m7s

16  Game Development / Newbie & Debugging Questions / Re: Make the camera follow multiple characters on: 2014-08-21 20:50:36
Time to implement this.

Seiya02: Do you know how to use your code with OrthogonalCamera(LibGDX)?
Also, to add support for an Y axis, just copy the code and change the x variables with y?
17  Game Development / Newbie & Debugging Questions / Re: Private fields, not really private? on: 2014-08-20 18:29:55
I mean, you can change the String that a String Object holds, and if you can do that, then pretty much all bets are off.
Aint that a big security risk?

It seems like reflection is "to strong".
18  Game Development / Newbie & Debugging Questions / Private fields, not really private? on: 2014-08-20 18:05:35
Since we can access private fields(and probably methods as well, havent checked) with reflection, they are not really private.

http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Field.html#get(java.lang.Object)
http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Field.html#set(java.lang.Object,%20java.lang.Object)

and

field.setAccessible(true);

Is there a way to make a field 100% private?
19  Game Development / Newbie & Debugging Questions / [LibGDX]Pixel perfect collision with flipped images on: 2014-08-20 16:33:27
I have a pixel perfect method that works fine except when one or more of the images are flipped(or rotated, but I wont fix that).

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
   public static boolean pixelPerfect(GameObject obj1, GameObject obj2)
   {  
      Image2D image1 = obj1.getImage();
      Image2D image2 = obj2.getImage();
     
      int top      = (int) Math.max(obj1.currY, obj2.currY);
      int bottom   = (int) Math.min(obj1.currY + obj1.height, obj2.currY + obj2.height);
      int left     = (int) Math.max(obj1.currX, obj2.currX);
      int right    = (int) Math.min(obj1.currX + obj1.width, obj2.currX + obj2.width);
     
      boolean flipped1 = image1.isFlipX();
      boolean flipped2 = image2.isFlipX();

      for (int y = top; y < bottom; y++)
      {
         for (int x = left; x < right; x++)
         {
            int colorA;
            int colorB;
           
            if(flipped1)
               colorA = //TODO
           else
               colorA = image1.getColor((int) (x - obj1.currX), (int) (y - obj1.currY));
            if(flipped2)
               colorB = //TODO
           else
               colorB = image2.getColor((int) (x - obj2.currX), (int) (y - obj2.currY));
           
            if (colorA != 0 && colorB != 0)
               return true;
         }
      }
      return false;
   }


How do I calculate the current pixel to check if the image is flipped horizontally?
20  Games Center / Showcase / Super Meat Boy alike game(Pojahns Game)(Open Source) on: 2014-06-14 21:27:54
Preview #1, Sandopolis:



Preview #2, Mountain Race:



Preview #3, Square Town:



Pojahns Game 2.0(beta) is a heavily inspired by Super Meat Boy and N+.

The game offers fun and difficult challenges for serious gamers and as well as easier stages for casual players.
This version contains 16 stages, all of them with their unique own music and theme.

There are some great features present in this game/engine. One of them is the replay function. Whether you win or loose, a replay file few kilobytes large is saved in the games replay directory.
This file can be used to view the replay and thanks to their small size be easily sent to other players.

A bit more about this project; it is a game built with my engine, called Pojahns Game Engine.
The goal is to make it easy to create Super Meat Boy-alike maps.

Downloads(205 MB):
Links updated 2014-06-16 to fix some crashes.
Google Drive mirror
Mediafire mirror
Speedy Share mirror

Requires Java 8.
Sadly, the game only runs on Windows.

Source code & bug reporting:
https://github.com/PojahnM/GameEngine
21  Java Game APIs & Engines / Engines, Libraries and Tools / Re: LibGDX on OS X? on: 2014-05-01 16:39:37
Thanks, really kind of you!

PMing you now.
22  Java Game APIs & Engines / Engines, Libraries and Tools / LibGDX on OS X? on: 2014-05-01 15:24:19
I am trying to test my LibGDX game in OS X which runs in Virtual Box.

The game crashes instantly with the following stack trace:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Unable to create OpenGL display.
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:223)
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.setupDisplay(LwjglGraphics.java:156)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:131)
   at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
Caused by: org.lwjgl.LWJGLException: Could not create pixel format
   at org.lwjgl.opengl.MacOSXPeerInfo.nChoosePixelFormat(Native Method)
   at org.lwjgl.opengl.MacOSXPeerInfo.choosePixelFormat(MacOSXPeerInfo.java:58)
   at org.lwjgl.opengl.MacOSXPeerInfo.<init>(MacOSXPeerInfo.java:53)
   at org.lwjgl.opengl.MacOSXCanvasPeerInfo.<init>(MacOSXCanvasPeerInfo.java:61)
   at org.lwjgl.opengl.MacOSXDisplayPeerInfo.<init>(MacOSXDisplayPeerInfo.java:48)
   at org.lwjgl.opengl.MacOSXDisplay.createPeerInfo(MacOSXDisplay.java:325)
   at org.lwjgl.opengl.DrawableGL.setPixelFormat(DrawableGL.java:61)
   at org.lwjgl.opengl.Display.create(Display.java:846)
   at org.lwjgl.opengl.Display.create(Display.java:757)
   at com.badlogic.gdx.backends.lwjgl.LwjglGraphics.createDisplayPixelFormat(LwjglGraphics.java:205)
   ... 3 more


I double click on the runnable jar file to run it.

Runs fine on Ubuntu and Windows 7.
23  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Draw laser beams(LaserFX) on: 2014-04-09 19:43:07
I am in process of writing my own laser drawing function. Does not looks as good as Laser FX, but performs better.

I have ran into a math problem and hope someone here can help me.

Have a look at the following image:



The laser is set to fire at a certain point(the top-left corner of the red guy), which it actually does. The top-left, or the bottom-left(not sure which one) corner of the laser beam is exactly at the target coordinate.

What I want to do is to have the lasers middle point at the target point, not the corner.

Here is my code, I am using the following method to draw the laser:

1  
SpriteBatch.draw(TextureRegion region, float x, float y, float originX, float originY, float width, float height, float scaleX, float scaleY, float rotation)


1  
2  
3  
float angle = MathStuff.getAngle(srcX, srcY, destX, destY); //Calculate the angle between the source and destination point.

batch.draw(beamImage, srcX, srcY, 0, 0, MathStuff.distance(srcX, srcY, destX, destY), beamImage.getHeight(), 1, 1, angle);

         
24  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Draw laser beams(LaserFX) on: 2014-04-02 20:59:07
First of all, the parameters.

region The AtlasRegion to use, I dont get this one. Is this a collection of all the laser images?

Then, what do I do with the returned float array?
25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Draw laser beams(LaserFX) on: 2014-04-02 15:54:40
No one knows? :/
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Draw laser beams(LaserFX) on: 2014-03-31 19:20:41
I use SpriteBatch in my game.
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Draw laser beams(LaserFX) on: 2014-03-31 19:04:48
I appreciate that you are trying to help, but that wasn't helpful at all.
28  Java Game APIs & Engines / Engines, Libraries and Tools / [LibGDX]Draw laser beams(LaserFX) on: 2014-03-31 18:47:07
I found a tutorial which explains how to draw cool looking laser effects in LibGDX:
http://codepoke.net/2011/12/27/opengl-libgdx-laser-fx/

However, I find the tutorial incomplete. There are no concrete coding examples on how to implement it.

Could someone explain in a better way?

For example, what to do with ending mesh?
29  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Particle Effects/emitter collection? on: 2014-03-20 14:02:16
hmmm...I really should get around to doing a "how to create good looking particle effects with libgdx's particle editor" as I think even the effects from TimelineFX and the such look half-assed. Best way to get great looking effects is to use something like fumeFX in 3dsmax or w/e then export to a sprite sheet for use as animated particles.

If you need some place hold stuff, here are some public domain animations

http://opengameart.org/content/more-explosions
http://opengameart.org/content/explosion-sheet


That tutorial would be appreciated Smiley
I personally don't think effects from TimeLineFX and such look "half-assed". I guess its from person to person.
I got a couple of thousands emitters for Particle Illusion and a couple of hundred for TimeLineFX. So I am all set.

FumeFX probably gives results the best results, but is also the most time consuming way. Plus, you must be a 3D artist, something you don't become over a few nights.
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX]Particle Effects/emitter collection? on: 2014-03-18 22:20:34
TimelineFX..... o_0

Holy shit those looks amazing. Very simple to use as well.

Thanks! Smiley
Pages: [1] 2 3 ... 5
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (47 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06

BurntPizza (55 views)
2014-09-19 03:14:18
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!