Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (511)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
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]
1  Game Development / Newbie & Debugging Questions / Re: Invisible Map [LibGDX] on: 2013-04-08 15:40:42
yes because you use the player to control the camera, in this code i just put the camera on the middle screen.
i have an idea, someone can put or send me at Eternal.Celes@gmail.com , some packfile and map(.tmx) created by himself?
i don't really think that i can thought the solution like this, but why not
2  Game Development / Newbie & Debugging Questions / Re: Invisible Map [LibGDX] on: 2013-04-08 09:20:38
^^
So anyone can help me? =/
3  Game Development / Newbie & Debugging Questions / Re: Invisible Map [LibGDX] on: 2013-04-07 10:31:31
Yes it will be done, but for now i just need camera for the map
But why did you tell that?
4  Game Development / Newbie & Debugging Questions / Re: Invisible Map [LibGDX] on: 2013-04-05 13:52:45
oh yeah i forget this.
but no it do nothing ^^ but i  think that  if a map can render but not an other then the problem isn't the code
5  Game Development / Newbie & Debugging Questions / Invisible Map [LibGDX] on: 2013-04-04 17:48:57
Hello,

Sorry to ask you that, but this problem make me crazy xD
Because all that i did is useless if ... my map can't appear..

I don't think that the code is the problem, because it works with a downloaded map.
But i show it :

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  
package Module;

import Base.Tile.TileType;
import Launcher.FurtherShade;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.tiled.TileAtlas;
import com.badlogic.gdx.graphics.g2d.tiled.TileMapRenderer;
import com.badlogic.gdx.graphics.g2d.tiled.TiledLoader;
import com.badlogic.gdx.graphics.g2d.tiled.TiledMap;

/**
 *
 * @author Celes Eternal
 *
 */


public class Map {

   /*
    * Data
    *
    */

   
   //Block size
   static final int BLOCK_WIDTH = 32;
   static final int BLOCK_HEIGHT = 32;
   
   //class data
   private TileMapRenderer tileMapRenderer;
    private TiledMap map;
    private TileAtlas atlas;
    private OrthographicCamera cam;
   private SpriteBatch batch;
 

    public Map(){
       // Load the tmx file into map
       map = TiledLoader.createMap(Gdx.files.internal("maps/tutoMap.tmx"));

       // Load the tiles into atlas
       atlas = new TileAtlas(map, Gdx.files.internal("tileSets/"));
       
       // Create the renderer
       tileMapRenderer = new TileMapRenderer(map, atlas, 10, 10, 32, 32);
       
       //initialize
       
       cam = new OrthographicCamera(Gdx.graphics.getWidth() ,
            Gdx.graphics.getHeight() );
      cam.translate(Gdx.graphics.getWidth()/2,Gdx.graphics.getHeight()/2);
     
      batch = new SpriteBatch();
      this.initVirtualMap();
       
    }
   
    public void initVirtualMap(){
       
   
       TileType [][] virtualMap = new TileType[map.width][map.height];
       
       
       for (int x = 0; x < map.width; x++)
       {
             for (int y = 0; y < map.height; y++)
             {
                   for (int l = 0; l < map.layers.size() ; l++)
                   {
                       int id = map.layers.get(l).tiles[y][x];                      
                     
                       if(id!=0){
                       String b = map.getTileProperty(id, "Type");
                      Gdx.app.log(FurtherShade.LOG, b);
                         if (b!=null)
                             virtualMap[x][y] = TileType.Wall;
                   }
                   }}}
       }
       
       
       
   
   
   public void render() {
     
      cam.zoom = 0.5f;
     
      cam.update();
     
      tileMapRenderer.render(cam);
   }
}


I tried some differents zooms but it did nothing.

So i think that the problem result from my files.

tutoMap.tmx:

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  
<?xml version="1.0" encoding="UTF-8" standalone="no"?><map height="25" orientation="orthogonal" tileheight="32" tilewidth="32" version="1.0" width="50"><properties><property name="blended tiles" value="242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,369,370,371,372,373,374,375,376,377,379,380,381,382,383,384,385,390,391,392,393,395,399,400,401,402,403,404,405,406,407,408,411,412,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,473,474,475,476,477,478,479,480,484,485,486,487,488,489,490,491,492,493,494,495,496,505,506,507,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,530,531,532,533,534,537,538,539,540,541,542,543,544,545,546,547,548,549,550,551,553,554,555,556,557,558,559,560,561,562,563,564,565,566,568,571,572,573,574,575,576,577,578,579,580,581,582,583,584,589,590,591,592,593,597,598,600,603,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,621,622,623,624"/></properties>
 <tileset firstgid="1" name="Dungeon_A4" tileheight="32" tilewidth="32">
  <image height="480" source="../tileSets/Dungeon_A4.png" width="512"/>
 </tileset>
 <tileset firstgid="241" name="Dungeon_A5" tileheight="32" tilewidth="32">
  <image height="512" source="../tileSets/Dungeon_A5.png" width="256"/>
 </tileset>
 <tileset firstgid="369" name="Inside_B" tileheight="32" tilewidth="32">
  <image height="512" source="../tileSets/Inside_B.png" width="512"/>
 </tileset>
 <layer height="25" name="Background" width="50">
  <data compression="gzip" encoding="base64">
   H4sIAAAAAAAAC+3Ruw2AMBAD0LBE9gF2oOfT8Nm/xpGoIpAShIjhXDxda/t85ZwXERER87pD6RxPdSmd4e8bW8b+x5xszF1Yc+Vuybzxm7t/aYM7f5ZzI0zRfuH2MBDkS7XCFnUIZlgI8qWqobnQEuSz0mMHywpx0ogTAAA=
  </data>
 </layer>
 <layer height="25" name="Wall" width="50">
  <data compression="gzip" encoding="base64">
   H4sIAAAAAAAAC+1YwQ2EMAzrttwGsAG3AYxLP/1UimKbNHAcliJ/itPENFI7lVI+NaYf57nG8gBu9aw1vgCj69W+ovvo87R6tho7wOh6ta/oPqw8KFr96DqWWajfo3WrfrB4/fgvP9S5x/o02g917rE+qX6o/vew+mf55+mwfni6KKx+WP55Omx/PV0U6nyydKL02HxR/+fZeXc2X/Q5i/bXAnt+UUT3xdNhzy+KbD9GIduPUXiKH6PmXzb6e62Hq98R0HcGtO67MjrH2ft/NqNznL3/Z/MBvpVIfogTAAA=
  </data>
 </layer>
 <layer height="25" name="Decor (visuel)" width="50">
  <data compression="gzip" encoding="base64">
   H4sIAAAAAAAAC+3W3Q2AIAxGUXQvfxZAHckRHFl5bTB+hqQBcs9zKRa0NgTUbBu1uNnELeK6L+eg5VrF/WwudV2p66ljd9oLQJnUz2Lme7V9LhdTI/ucb329lXpUuTrVf9ofk9O5edzP0dk7gHal+czOaF4zGwAAvbsBSjgXcYgTAAA=
  </data>
 </layer>
 <layer height="25" name="Decor (like wall)" width="50">
  <data compression="gzip" encoding="base64">
   H4sIAAAAAAAAC+3VsQ0AIAhEUcJauoFu4Aju3yu9iYk2iP+VVEBxJwKPkopk3c+8K3PfqvsZAJx6MRtXyMY7LcjvepA7EAs5ix9Yj0ToEusRugTwbQAnAYbxiBMAAA==
  </data>
 </layer>
 <layer height="25" name="Decor (vision)" width="50">
  <data compression="gzip" encoding="base64">
   H4sIAAAAAAAAC+3OMQqAQBAEwWEfevoCz/9HbrqJoSBUQcOEkwC8W5Uc3Vlz/83Vn3d319wAAADwhQc5g2PbiBMAAA==
  </data>
 </layer>
</map>


and a tileSet:
Dungeon_A4 packfile

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  
Dungeon_A4.png
format: RGBA8888
filter: Nearest,Nearest
repeat: none
Dungeon
  rotate: false
  xy: 2, 2
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 239
Dungeon
  rotate: false
  xy: 36, 2
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 238
Dungeon
  rotate: false
  xy: 70, 2
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 237
.......
.......
.......
Dungeon
  rotate: false
  xy: 444, 512
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 1
Dungeon
  rotate: false
  xy: 478, 512
  size: 32, 32
  orig: 32, 32
  offset: 0, 0
  index: 0


And one last thing, when i make the packfile, my tileSet was blended... It's possible to make a pake file with my current image?

Sorry to bore you,
See you
6  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Tiled Map and ID on: 2013-04-04 17:30:11
Sorry , i'm really late ^^
Yeah i haven't noticed that we can set properties on tiles .
That was my problem ^^
Thank you for your answer
7  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Camera on: 2013-03-27 21:27:22
Sorry i'm late,
my problem was just that the origin's camera is in the middle of graphics, i was thinking that it was the same but a friend give me this idea and he was right!

But yes use render(cam) is one of solution's parts
Thanks
8  Game Development / Newbie & Debugging Questions / [LibGDX] Tiled Map and ID on: 2013-03-27 21:01:19
Hello,

I can't get my tiles properties, i have search on internet but 0 informations TT
Maybe someone here will be able to understand my problem.

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  
 public void initVirtualMap(){
       
   
       boolean [][] blocked = new boolean[map.width][map.height];
       
       for (int x = 0; x < map.width; x++)
       {
             for (int y = 0; y < map.height; y++)
             {
                   for (int l = 0; l < 3; l++)
                   {
                       int id = map.layers.get(l).tiles[y][x];
                      Gdx.app.log("Test",String.valueOf(id));
                       
                       
                       String b = map.getTileProperty(id, "test");
                      Gdx.app.log("Test",b);
                         if (b!=null)
                            if(b.equals("true")) {blocked[x][y] = true;
                         Gdx.app.log("Test","Reussi");}
                            else
                               Gdx.app.log("Test","echec");}
                   }
              }
       }


The map used have 3 layers ( 2 with the property test, and 1 with nothing)

The console said me :
first layer = always id = 1
others = always id = 0
b = alaways null

I don't understand this =/

Thanks
9  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Camera on: 2013-03-27 14:03:20
I'have tried some combinations but nothing work.

Why?

For me :
1  
2  
3  
4  
cam = new OrthographicCamera(Gdx.graphics.getWidth() ,
            Gdx.graphics.getHeight() );
 
      cam.position.set(0, 0, 0);


Make a camera who start at 0,0,0 and do my all screen , that isn't?

And :
1  
2  
3  
4  
5  
6  
7  
8  
tileMapRenderer.getProjectionMatrix().set(cam.combined);
     
      Vector3 tmp = new Vector3();
      tmp.set(0, 0, 0);
      cam.unproject(tmp);
     
      tileMapRenderer.render( tmp.x, tmp.y,
            Gdx.graphics.getWidth(), Gdx.graphics.getHeight());


Make me a MapRenderer which take the whole screen too, no?
10  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Camera on: 2013-03-27 11:54:27
I replied for said thanks ^^
Fo the zoom, i know, it's just because i wanted to put off this without  //
I'll try it after class, thanks
11  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Camera LibGDX on: 2013-03-27 11:40:55
Not, i tried without zoom
I post a new subgect in the right section sorry

If someone can delete this ^^
12  Game Development / Newbie & Debugging Questions / [LibGDX] Camera on: 2013-03-27 11:39:00
Hello,

Can someone tell me why my map is not rendering in the full camera view?

My 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  
package Module;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.assets.loaders.TileAtlasLoader;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.tiled.TileAtlas;
import com.badlogic.gdx.graphics.g2d.tiled.TileMapRenderer;
import com.badlogic.gdx.graphics.g2d.tiled.TiledLoader;
import com.badlogic.gdx.graphics.g2d.tiled.TiledMap;
import com.badlogic.gdx.math.Vector3;

/**
 *
 * @author Celes Eternal
 *
 */


public class Map {

   /*
    * Data
    *
    */

   
   //Block size
   static final int BLOCK_WIDTH = 32;
   static final int BLOCK_HEIGHT = 32;
   
   //class data
   private TileMapRenderer tileMapRenderer;
    private TiledMap map;
    private TileAtlas atlas;
    private OrthographicCamera cam;
 

    public Map(){
       // Load the tmx file into map
       map = TiledLoader.createMap(Gdx.files.internal("data/testMap.tmx"));

       // Load the tiles into atlas
       atlas = new TileAtlas(map, Gdx.files.internal("data/"));

       // Create the renderer
       tileMapRenderer = new TileMapRenderer(map, atlas,32, 32, 5, 5);
       
       //initialize
       
       cam = new OrthographicCamera(Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
 
      cam.position.set(0, 0, 0);
      //cam.translate(Gdx.graphics.getWidth() / -2, Gdx.graphics.getHeight() / -2);
       
    }
   
    public void render() {
       cam.zoom = 1f;
       cam.update();
       
      tileMapRenderer.getProjectionMatrix().set(cam.combined);
     
      Vector3 tmp = new Vector3();
      tmp.set(0, 0, 0);
      cam.unproject(tmp);
     
      tileMapRenderer.render( tmp.x, tmp.y,
            Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }
}


Thanks

ps : sorry for my english
13  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Camera LibGDX on: 2013-03-26 23:33:27
My map has just completly disappeared ^^

I can't search more today sorry, i go to sleep !
Bye
14  Java Game APIs & Engines / Engines, Libraries and Tools / Camera LibGDX on: 2013-03-26 10:43:29
Hello,

Can someone tell me why my map is not rendering in the full camera view?

My 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  
private TileMapRenderer tileMapRenderer;
    private TiledMap map;
    private TileAtlas atlas;
    private OrthographicCamera cam;
 

    public Map(){
       // Load the tmx file into map
       map = TiledLoader.createMap(Gdx.files.internal("data/testMap.tmx"));

       // Load the tiles into atlas
       atlas = new TileAtlas(map, Gdx.files.internal("data/"));

       // Create the renderer
       tileMapRenderer = new TileMapRenderer(map, atlas,32, 32, 5, 5);
       
       //initialize
       
       cam = new OrthographicCamera(Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
 
      cam.position.set(0, 0, 0);
       
    }
   
    public void render() {
       cam.zoom = 0.3f;
       cam.update();
       
      tileMapRenderer.getProjectionMatrix().set(cam.combined);
 
      Vector3 tmp = new Vector3();
      tmp.set(0, 0, 0);
      cam.unproject(tmp);
     
      tileMapRenderer.render( tmp.x, tmp.y,
            Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
   }


Thanks

ps : sorry for my english
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2d display without used render? on: 2013-03-22 18:31:18
I can't because i use MVC model, with Observer pattern, so the graphic update must receive my obs.

I think that i have spend 6-7 hours at look the source code, i tried somethings that i thinking good, but it's never work.

But slick2d is really too specialized for me, slick is to help to use lwjgl right?

So just work with lwjgl, let me the same capacity? Graphic etc.. 
16  Java Game APIs & Engines / Engines, Libraries and Tools / Slick2d display without used render? on: 2013-03-22 09:07:19
Hello,

I just started to used slick2d and i have a big problem: i dunno how make a display without render function.
I really can't use render function, so if somebody can help me ^^

Thanks

ps: sorry for my english

edit: i used research but i think it was a bad idea, ths subject is on the main page TT, but if someone can explain me that more, it's not a problem ^^

i tried this :
1  
2  
3  
Graphics g = new Graphics (container.getWidth(),container.getHeight());
      g.drawImage(cursor, position.x, position.y);
      g.flush();


but no sucessfull
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (50 views)
2014-10-17 03:59:02

Norakomi (39 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (56 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (44 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!