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 (567)
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
1  Discussions / General Discussions / Slide-Switch? on: 2013-07-18 10:40:29
Hi,

I downloaded this Library:

http://code.google.com/p/android-slide-switch/

There are 3 subfolders:

ImageData
Sample
SlideSwitch

I copied "Sample" and "SlideSwitch" in the workspace folder (eclipse).

Then in Eclipse I tried this: File > Import > General > Existing Projects into Workspace. Then I selected the SlideSwitch folder. Then I get an error message:

Errors occurred during the build.
Errors running builder 'Android Resource Manager' on project 'SlideSwitch'.
java.lang.NullPointerException

How can I use this example? How should I import the Library? Do I need ImageData folder?

Has someone an Idea?

Thanks!
2  Game Development / Newbie & Debugging Questions / Re: Works the new Google Play Services SDK with LibGDX? on: 2013-07-01 06:41:08
Thank you. Good for the start.
3  Game Development / Newbie & Debugging Questions / Works the new Google Play Services SDK with LibGDX? on: 2013-06-30 10:43:01
Hi,

before I start with the new Google Play Services SDK I wanted to know if it works without problems with LibGDX?

Or must I wait until interfaces are written for it?

Has someone already tried it out. Does it work?
4  Game Development / Newbie & Debugging Questions / Re: LibGDX - Items and itembox? on: 2013-06-28 12:21:28
Thank You! That helped me  Smiley
5  Game Development / Newbie & Debugging Questions / LibGDX - Items and itembox? on: 2013-06-27 10:41:51
Hi,



In the first picture you can see 5 images (crown, book, key, sword, heart) and a red circle (the red circle shows the touch on the screen).

I show the 5 images with SpriteBatch on the Screen.



Picture 2: Now, when I touch on the crown and swipe the finger on the screen, I want to move the crown. How can I do this? What's the keyword for that?

And when my finger is in the near of the itembox, it automatically shows a transparent image of the selected Item.



Picture 3: And now, when I move my finger to the right, the book item moved to the left automatically.



Picture 4: Now when I release my finger (look picture 3 for the position), the crown item snaps in the item box. How can I do this? Where can I find snap algorithms. What are they called?

Are there good tutorials or open source code snippets for that?

Thanks!
6  Game Development / Newbie & Debugging Questions / Re: LibGDX - Particle Effect with stars? on: 2013-06-20 13:03:37
OK.. Now I found something. You can add an Image in Particle Editor. LOL.

There is a scrollbar. I scrolled to the top, and there it is... an option to add an image.
7  Game Development / Newbie & Debugging Questions / LibGDX - Particle Effect with stars? on: 2013-06-20 10:27:29
Hi,

I just tried the Particle Editor:
1  
libgdx-master\extensions\gdx-tools\src\com\badlogic\gdx\tools\particleeditor\ParticleEditor.java


I want make a particle effect with different little stars (stars are *.png files). I don't find an option, where
can I add e.g. four images (stars) to the particle effect.

There is an example in LibGDX "GDX Tests", it's called "ParticleEmitterTest". How can I now add Star images to this example?

Is that possible or should I search on the web for other particle effect codes?

Thanks!
8  Game Development / Newbie & Debugging Questions / Re: LibGDX - Camera movement - Camera looks 3d object? on: 2013-05-27 14:27:55
Hi,

I know this example. It's
1  
gdx-tests/src/com/badlogic/gdx/tests/g3d/Basic3DTest.java


But I don't know, how to use this code for my orbital movement?
9  Game Development / Newbie & Debugging Questions / LibGDX - Camera movement - Camera looks 3d object? on: 2013-05-27 11:20:34
Hi,

I'm now trying the Orbiting camera around a object.

I tried this code here:
1  
2  
3  
4  
float deltaY=1;
...
Vector3 vec = new Vector3( 2f, 3f, 0f);
camera.rotateAround(vec, Vector3.Z, deltaY);


The camera movement works, but it rotates about its own axis.

How can I now to add a distance between the object and camera and then rotate the camera around the 3D object.

I tried so many variations without success.

Thanks!
10  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 20:27:48
Thank You!
11  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 14:52:30
OK. I will try to use Universal Tween Engine.

I tried that before. But I was not happy of that engine. No great tutorials etc.

Now... after many hours trying.. it's ok.
12  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 13:10:49
I always look at the license.

I'm searching for codes that are written and all can use it in the game.

I do not know how to say this.

E.g. when somebody wants to make a website, he looks for written Layouts. And of course to the license.
And then the programmer downloads or copy & pastes that layout in the file.

And that's, what I'm searching for. Written tweens. (Why reinvent the wheel)
13  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 11:12:00
@Danny02 Yes, that's correct but I wanted to speed up my programming. I mean, copy & paste and use the function.

Of course I can look at the code. But this takes time.
14  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 09:36:37
Yes, I know that.

But I'm searching only for the algorithm or functions.

15  Game Development / Newbie & Debugging Questions / Re: Tween functions? on: 2013-05-16 08:21:54
LibGDX

16  Game Development / Newbie & Debugging Questions / Tween functions? on: 2013-05-16 07:28:36
Hi,

I want to make tween animations in a game.

E.g. when the player gets a coin, I want to show on the position of the coin the score
and then the score is moving up and is going transparent. (Floating score)

I know, there are tween libraries. But I'm searching only for the algorithm.
Not only for the floating score.

All the functions the are useful for games.

Another example: The text "Game over" is coming from up to the center of the screen and waiting for
3 seconds and then is moving to the bottom screen.

I can make tween animations myself. But it takes time.
17  Game Development / Newbie & Debugging Questions / Re: LibGDX - StillModel mesh - dispose? on: 2013-05-15 14:24:29
Thank you! That helped me.
18  Game Development / Newbie & Debugging Questions / LibGDX - StillModel mesh - dispose? on: 2013-05-14 07:05:55
Hi,

I have 16 Levels. In each level, I have a different 3d environment (mountains, buildings, volcano etc.).

Now When I go to Level 2, I don't need anymore the environment of Level 1.

How can I now free the memory of this meshes?
For example:
1  
2  
   StillModel mountain;   
   StillModel buildings;  
19  Game Development / Newbie & Debugging Questions / Re: LibGDX - Gradient looks weird? on: 2013-04-27 06:45:56
Thanks!
20  Game Development / Newbie & Debugging Questions / Re: LibGDX - Gradient looks weird? on: 2013-04-26 06:09:52
Yes. I added the RGBA8888 to the texture. Not working.
21  Game Development / Newbie & Debugging Questions / LibGDX - Gradient looks weird? on: 2013-04-25 15:55:03
Hi,

I added a 3D cube. On this 3D cube is a gradient texture. When I start my app,
the gradient looks like this here:

(second image)
http://stackoverflow.com/questions/13478116/android-gradient-weirdness

I added this code to my main activity. Code is not working!
1  
2  
3  
4  
5  
6  
7  
8  
9  
        AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
        cfg.useGL20 = false;

        cfg.r = 8;
        cfg.g = 8;
        cfg.b = 8;
        cfg.a = 8;

        initialize(new Game(), cfg);
22  Game Development / Newbie & Debugging Questions / Re: Time based movement / deltaTime / Event Timing ? on: 2013-04-13 11:16:55
I solved it now. Thanks to everybody.

This two lines solved my problem:
1  
2  
      float addDelta = 100*Gdx.graphics.getDeltaTime();
      speed = addDelta;


I tried that before. But without success.

Now it's working. It's unbelievable. Smiley
23  Game Development / Newbie & Debugging Questions / Re: Time based movement / deltaTime / Event Timing ? on: 2013-04-12 14:32:07
Here is an example.

In my app, there is a red box. It's moving from left to right. The app starts, when you touch the screen.
Now, I installed this on my big and small smartphone. I touch the both devices at the same time.
And now I see, that the red box on my smaller smartphone touches the right side of the screen first.

In my app, there is a ease function from Robert Penner and I added Aspect ratio.

So, first the images:
(This is my libgdx.png file)


(this is, where the red box starts)


(and this is, where the red box touches the right side)


And this is the code:
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  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
package com.me.mygdxgame;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;

public class MyGdxGame implements ApplicationListener {
   
    private static final int VIRTUAL_WIDTH = 800;
    private static final int VIRTUAL_HEIGHT = 480;
    private static final float ASPECT_RATIO = (float)VIRTUAL_WIDTH/(float)VIRTUAL_HEIGHT;
   
    private Rectangle viewport;
   
   private OrthographicCamera camera;
   private SpriteBatch batch;
   private Texture texture;
   private Sprite sprite;
   
   private float x = 0f;
   private float y = 0f;  
   
   private boolean start = false;
   
    private float diff = 200f;

    private float minTime = 0;
    private float maxTime = 770f;
   
    private float iEaseOut = 0;
    private float zTime = 0;
       
   @Override
   public void create() {      

      camera = new OrthographicCamera(VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
      batch = new SpriteBatch();
     
      texture = new Texture(Gdx.files.internal("data/libgdx.png"));
      texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
     
      TextureRegion region = new TextureRegion(texture, 2, 2, 32, 32);
     
      sprite = new Sprite(region);
   }

   @Override
   public void dispose() {
      batch.dispose();
      texture.dispose();
   }

   @Override
   public void render() {      
     
      float deltaTime = Gdx.graphics.getDeltaTime();
     
      if (Gdx.input.isTouched()) {
         start = true;
      }      
     
      if (start) {

         if (iEaseOut < diff) {
            zTime = expoEaseOut(iEaseOut, minTime, maxTime, diff);

            float deltaAdd = zTime*deltaTime;            
            zTime += deltaAdd;              
           
            x = zTime;        

            iEaseOut++;      
         } else {
            start = false;
         }
         
      }
     
      System.out.println(Gdx.graphics.getDeltaTime());
     
     
      Gdx.gl.glClearColor(1, 1, 1, 1);
      Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
     
      camera.update();
     
        Gdx.gl.glViewport((int) viewport.x, (int) viewport.y, (int) viewport.width, (int) viewport.height);  
     
      batch.setProjectionMatrix(camera.combined);
      batch.begin();
      sprite.setPosition(x-VIRTUAL_WIDTH/2, y);
      sprite.draw(batch);
      batch.end();
   }
     
   public static float expoEaseOut(float t,float b , float c, float d) {
      return (t==d) ? b+c : c * (-(float)Math.pow(2, -10 * t/d) + 1) + b;  
   }

   @Override
   public void resize(int width, int height) {
       // calculate new viewport
       float aspectRatio = (float)width/(float)height;
        float scale = 1f;
        Vector2 crop = new Vector2(0f, 0f);
       
        if(aspectRatio > ASPECT_RATIO)
        {
            scale = (float)height/(float)VIRTUAL_HEIGHT;
            crop.x = (width - VIRTUAL_WIDTH*scale)/2f;
        }
        else if(aspectRatio < ASPECT_RATIO)
        {
            scale = (float)width/(float)VIRTUAL_WIDTH;
            crop.y = (height - VIRTUAL_HEIGHT*scale)/2f;
        }
        else
        {
            scale = (float)width/(float)VIRTUAL_WIDTH;
        }

        float w = (float)VIRTUAL_WIDTH*scale;
        float h = (float)VIRTUAL_HEIGHT*scale;
        viewport = new Rectangle(crop.x, crop.y, w, h);
   }

   @Override
   public void pause() {
   }

   @Override
   public void resume() {
   }
}
24  Game Development / Newbie & Debugging Questions / Re: Time based movement / deltaTime / Event Timing ? on: 2013-04-12 13:27:32
I'm not calculating deltaTime. I generated a standard LibGDX Project. I get it from LibDX.

When I output deltatime on my bigger smartphone I get this:
0.016456..., or 0.152546... etc.

On my smaller smartphone I get this:
0.011254..., or 0.102546... etc.

25  Game Development / Newbie & Debugging Questions / Time based movement / deltaTime / Event Timing ? on: 2013-04-12 07:14:39
Hi,

I'm really confused. The app is faster or slower on some devices. I had some small problems with libgdx. BUT this is the biggest problem that I've had.

First I thought I understood deltaTime. But that is not so.

Why is that so hard. I made a small program, where is a 3d cube is moving from left to right.
And then the 3d cube is moving backwards.

I've tried so many things. NOTHING WORKS.
I also added the deltaTime (test += steps*deltaTime) to the movement. Nothing helps. On my smaller smartphone the movement is faster.

I don't know what to do. On my bigger smartphone is it slower.

I have read all of this. (some things I did not understand):
http://gafferongames.com/game-physics/fix-your-timestep/

http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=1845&p=10046&hilit=step+deltatime#p10046

http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=4185&p=20139&hilit=deltaTime#p20139

Has somebody not a great solution for this. How can I do it, that the render() renders at the same speed on all devices?

I read about accumulate or something like that. Is this the answer?

Info: I'm not using box2d.

Has anybody solved this problem. It would be great, when somebody can post a working example code.

My program looks a little bit 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  
31  
32  
33  
34  
35  
public class ObjectScreen implements Screen {
   Game game;


   public ObjectScreen (Game game) {
      this.game = game;
     
      cam = new PerspectiveCamera(45, VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
      ...
   }
...

@Override
public void render (float delta) {
   update(delta);
   draw(delta);
}

public void update (float deltaTime) {
   // ...
}

public void draw (float deltaTime) {      

   GL10 gl = Gdx.graphics.getGL10();

   gl.glClearColor(0.0f, 0.0f, 0.0f, 1);

   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   ...
   
   // 3d Object moving
  ...
}
}



Thank You!
26  Game Development / Newbie & Debugging Questions / Re: LibGDX - deltatime? on: 2013-04-07 08:46:02
I understand deltaTime now better. Thanks.
27  Game Development / Newbie & Debugging Questions / Re: LibGDX - deltatime? on: 2013-04-06 18:45:05
Yes, I know this, but is it not possible to do this without to add the deltaTime to the movemet variable?

My project looks 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  
31  
32  
33  
34  
35  
36  
public class ObjectScreen implements Screen {
   Game game;


   public ObjectScreen (Game game) {
      this.game = game;
     
      cam = new PerspectiveCamera(45, VIRTUAL_WIDTH, VIRTUAL_HEIGHT);
      ...
   }
...

@Override
public void render (float delta) {
   update(delta);
   draw(delta);
}

public void update (float deltaTime) {
   // ...
}

public void draw (float deltaTime) {      
   if (deltaTime > 0.1f) deltaTime = 0.1f;

   GL10 gl = Gdx.graphics.getGL10();

   gl.glClearColor(0.0f, 0.0f, 0.0f, 1);

   gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
   ...
   
   // 3d Object moving
  ...
}
}
28  Game Development / Newbie & Debugging Questions / Re: Opengl - Light looks different? on: 2013-04-06 18:29:55
Oh... OK.

I also first thought the same but then I thought, maybe I programmed it wrong.
29  Game Development / Newbie & Debugging Questions / LibGDX - deltatime? on: 2013-04-06 18:28:27
3d Object moving on my second phone is faster.

I tried this here:

1  
    if (deltaTime > 0.1f) deltaTime = 0.1f;


But this don't works.

How can I do it, that the render() has the same speed on all phones?

I thought, that LibGDX regulates the deltatime self.

30  Game Development / Newbie & Debugging Questions / Opengl - Light looks different? on: 2013-04-06 13:31:06
Hi,

I'm programming with LibGDX.

I added this code:
1  
2  
3  
4  
       float lightColor1[] = {1.0f, 1.0f, 1.0f, 1.0f}; //Color (0.5, 0.2, 0.2)
      float lightPos1[] = {-1.0f, 0.5f, 0.5f, 0.0f};
       gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_DIFFUSE, lightColor1, 0);
       gl.glLightfv(GL10.GL_LIGHT1, GL10.GL_POSITION, lightPos1, 0);


I have two different smartphones. The Light looks different on this two smartphones. I don't know why?

On the first smartphone the light is weak and  on the second smartphone the light is bright.

EDIT:

OK. Now I programmed this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
      // Create light components
     float ambientLight[] = { 1f, 1f, 1f, 1.0f };
      float diffuseLight[] = { 1f, 1f, 1f, 1.0f };
      float specularLight[] = { 1f, 1f, 1f, 1.0f };
      float position[] = { 0f,0f, 5.0f, 1.0f };

      // Assign created components to GL_LIGHT0
     gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_AMBIENT, ambientLight, 0);
      gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_DIFFUSE, diffuseLight, 0);
      gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_SPECULAR, specularLight, 0);
      gl.glLightfv(GL10.GL_LIGHT0, GL10.GL_POSITION, position, 0);


It's now a little bit better, but on the small smartphone the texture looks brighter.
Pages: [1] 2
 

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 (36 views)
2014-09-24 16:13:29

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

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

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

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

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

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

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

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

BurntPizza (52 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!