Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (592)
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: Slick2d - Rendering only a part of the map - need all of it on: 2011-11-28 00:03:47
lol k fixed. Extremely dumb error. Noticed I was using my camera to set a certain area to render. Changed the variables and fixed the problem.
2  Game Development / Newbie & Debugging Questions / Re: Slick2d - Rendering only a part of the map - need all of it on: 2011-11-27 22:29:18
If I take away the map.render(0,0) from the render method, this is what I get.



It still renders the entities in that section to the right and the collision blocks, but not for the rest of the map.


EDIT:

I changed my code around and still get the same thing

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  
/**
     * Loads and reads the tiledmap and adds the collision layer to the map
     * @param map
     */

    private void createCollisionMap(TiledMap map) {
        for (int x = 0; x < map.getWidth(); x++) {
            for (int y = 0; y < map.getHeight(); y++) {
                Image tImg = map.getTileImage(x, y, 0);
                if (tImg != null) {
                    CollisionEntity ce = new CollisionEntity(x * tImg.getWidth(), y * tImg.getHeight(), map.getTileWidth(), map.getTileHeight());
                    add(ce);
                    System.out.println("add collission");
                }
            }
        }
    }

    /**
     * Loads and reads the tiledmap and adds the entities layer to the map
     * @param map
     */

    private void addEntities(TiledMap map) {
        for (int x = 0; x < map.getWidth(); x++) {
            for (int y = 0; y < map.getHeight(); y++) {
                int tileId = map.getTileId(x, y, 1);
                String value = map.getTileProperty(tileId, "victim", null);
                if ("man".equalsIgnoreCase(value)) {
                    Man m = new Man(x * 16, y * 16, "man");
                    m.depth = 100;
                    add(m);
                }
            }
        }
    }


This time it loads the entire map but doesn't make it an image like last time, but the same thing happens like in the second picture. Everything renders on the map, but the entities do not appear.
3  Game Development / Newbie & Debugging Questions / Re: Slick2d - Rendering only a part of the map - need all of it on: 2011-11-27 19:37:02
The second picture I just moved across the map a little bit by using translate(x,y). The picture is bigger for some reason, but the window size is still the same.
4  Game Development / Newbie & Debugging Questions / Re: Slick2d - Rendering only a part of the map - need all of it on: 2011-11-27 19:01:22
I'm not resizing the window. I am using a camera to move around the map. The width of the map is 100. But what is happening is when I start the game you see what your suppose to see in the first picture. But when I start moving around to the other parts of the map it shows the map but the entities and the collision blocks arent there when they should be.
5  Games Center / 4K Game Competition - 2012 / Re: Drift Driver 4K on: 2011-11-27 16:54:50
Pretty fun! Got to level 5 and tried it about 3 times and gave up. Sad

I am always bad at driving games.
6  Game Development / Newbie & Debugging Questions / [Solved]Slick2d - Rendering only a part of the map - need all of it on: 2011-11-27 16:48:08
I posted the same thing on Slick forums - posting here as well because slick forums aren't very active.

So I created a map using Tiled. I loaded into my game world.

I went through each tile and layer and added the objects I needed such as the entities and the collision objects.

It renders them all correctly and all works dandy except when I move my camera around it doesn't do it anywhere else other than the width of the frame. It is missing 3/4s of the map.

I use map.render(0,0) and it renders the rest of the map, but the entities aren't there, no hit box, etc. Look below at images:







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  
for (int x = 0; x < tmap.getWidth(); x++) {
                    for (int y = 0; y < tmap.getHeight(); y++) {
                        //creats an image of the tile
                        Image tImg = tmap.getTileImage(x, y, layerIndex);
                        int tid = map.getTileId(x, y, layerIndex);
                        if (tImg != null) {
                            //load background as an image
                            if (property.equalsIgnoreCase("background")) {
                                StaticActor bg = new StaticActor(x * tImg.getWidth(), y * tImg.getHeight(), tImg.getWidth(), tImg.getHeight(), tImg);
                                bg.depth = -100;
                                add(bg);
                                //load the trees/benches etc as an image too
                            } else if (property.equalsIgnoreCase("entities")) {
                                StaticActor ents = new StaticActor(x * tImg.getWidth(), y * tImg.getHeight(), tImg.getWidth(), tImg.getHeight(), tImg);
                                ents.depth = -50;
                                add(ents);
                                //load all the victims/people
                            } else if (property.equalsIgnoreCase("victims")) {
                                //    String victim = map.getTileProperty(tid, "victim", null);

                                Man m = new Man(x * tImg.getWidth(), y * tImg.getHeight(), "man");
                                Man m2 = new Man(77, 79, "man"); //test man
                                add(m);
                                add(m2);
                                Log.debug("Man added");
                                //load the collision blocks
                            } else if (property.equalsIgnoreCase("collision")) {
                                CollisionEntity ce = new CollisionEntity(x * tImg.getWidth(), y * tImg.getHeight(), tmap.getTileWidth(), tmap.getTileHeight());
                                add(ce);
                            }
                        }
                    }
                }



Even if I don't add the background as an image and the trees and stuff as an image, and just use map.render(0,0) it does the same thing. If I use this code and not the map.render(0,0) does the same thing. Not sure what is wrong? Any way to get this working? Thanks
7  Games Center / 4K Game Competition - 2012 / Re: Snake on a Plane on: 2011-11-25 22:00:05
Just played through all the levels. It was actually pretty addicting. I Like the idea of the game. Enjoyed it a lot. Good job!
8  Discussions / General Discussions / Re: Go on, ask me anything. on: 2011-09-30 19:02:31
What did you use or do to get Java to work with Steam?
9  Games Center / Showcase / Re: ShapeTronic on: 2011-05-03 16:53:46
Really fun actually. It's very nice looking and runs well. Got to level three so far Cheesy
10  Games Center / Featured Games / Re: Legends of Yore on: 2011-03-31 12:54:52
No problem! Glad I could help!
11  Games Center / Featured Games / Re: Legends of Yore on: 2011-03-31 12:48:25
Exception in thread "Thread-12" java.lang.RuntimeException: Attempt to set location before actor is on map!
   at org.newdawn.touchquest.data.common.Actor.removeFromMap(Actor.java:451)
   at org.newdawn.touchquest.data.map.Map.removeActor(Map.java:442)
   at org.newdawn.touchquest.data.map.Map.checkForDeadActors(Map.java:715)
   at org.newdawn.touchquest.data.Model.update(Model.java:97)
   at org.newdawn.touchquest.game.DungeonTab.logic(DungeonTab.java:52)
   at org.newdawn.touchquest.game.TouchQuest.logic(TouchQuest.java:99)
   at org.newdawn.touchquest.game.TouchQuest.update(TouchQuest.java:87)
   at org.newdawn.touchapi.applet.TouchApplet.gameLoop(TouchApplet.java:134)
   at org.newdawn.touchapi.applet.TouchApplet.access$200(TouchApplet.java:38)
   at org.newdawn.touchapi.applet.TouchApplet$1.run(TouchApplet.java:74)
12  Games Center / Featured Games / Re: Legends of Yore on: 2011-03-31 12:43:21
Fun so far. Been playing it for a little. Game crashed after I was killed by a snake. Although I reloaded my saved game and it was fine than. I like the way you attack monster's. I really enjoy this game a lot actually.

Edit: Another thing I found out is if you enter a room with two monster's and you attack the monster in front of you when your in the door, it kill's the other monster next to it some how. Doesn't happen all the time though.
13  Games Center / Archived Projects / Re: Veggie Patch on: 2011-03-25 15:20:19
What engine or library did you use for this? Just curious looks really good.
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.

toopeicgaming1999 (58 views)
2014-11-26 15:22:04

toopeicgaming1999 (52 views)
2014-11-26 15:20:36

toopeicgaming1999 (10 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (27 views)
2014-11-25 11:26:43

Gibbo3771 (24 views)
2014-11-24 19:59:16

trollwarrior1 (37 views)
2014-11-22 12:13:56

xFryIx (76 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
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!