Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
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 / How to manage transitions and current screen manipulation? on: 2011-12-11 01:59:37
I'm trying to find the best way on how to alter the scenario the player is currently looking at, for example transitioning the map to grayscale slowly, motion blurring though i'm kinda stuck and need a push to get a better perspective on how to do it Sad my goals are to manipulate it and see if I can load the map in a form of animation, for example Zelda SNES way of slowly sliding the map as you pass to the next area

i thought of having the layers combined in a single image and returning that image(BufferedImage) would allow me to have the result I'm hoping for but sadly I got this:

http://dl.dropbox.com/u/37705/messyredraw.png

At the start the game looks fine just like the progress picture below, horror occurs when I start moving around everything starts to mess up

The normal method which is passing the Graphics2D to the map render looks fine:
http://dl.dropbox.com/u/37705/progress.png

Thanks in advance!
2  Game Development / Newbie & Debugging Questions / Guidance on tile loading on: 2011-07-13 00:00:29
1  
Sorry for the stupid question though it seems I'm not seeing the picture Sad

I'm using Tiled Map Editor to create my maps, wrote a tiny handler to get most of the needed data

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  
      
  TMXHandler test = new TMXHandler("DA");
            TMX_MapData data = test.getMapData();
            HashMap<Integer,BufferedImage> tiled = new HashMap<Integer, BufferedImage>();
            Graphics2D g2 = (Graphics2D) g;
            try {
            BufferedImage img = ImageIO.read(new File("src/com/prinnyware/resources/grasslandv6_0.png"));
           
            ArrayList<TMX_Layer> layers = data.getLayers();
            ArrayList<BufferedImage> mi = new ArrayList<BufferedImage>();
                for (Iterator<TMX_Layer> it = layers.iterator(); it.hasNext();) {
                    TMX_Layer layer = it.next();
                    System.out.println(layer.getLayerName());
                    ArrayList<Integer> tiles = layer.getTiles(); // tiles loaded in layer
                       int columns = (506 / data.getTileWidth());
                        int lines = (768 / data.getTileHeight());
                        int counter = 1;
                       
                        for (int incrlines = 0; incrlines < lines; incrlines++) {
                            for (int i = 0; i < columns; i++) {
                               
                               
                                   // System.out.println(i * incrlines);
                                 
                                           tiled.put(counter,img.getSubimage(i*32, incrlines*32, 32, 32));
                                           
                                           
                                            //g2.drawImage(img.getSubimage(i*32, incrlines*32, 32, 32), null, i*32, incrlines*32);
                                          counter++;
                                          // System.out.println(counter);
                                         
                            }
                        }


With that code I can output pretty much the tileset image and store it (to match the gid later on). But I got stuck! now I kinda don't know how to progress on how to load my tiles so I don't know if I'm doing it right with my current approach or if I should take another route.

Googling around I got some matches and saw some people wrote another tmx handler though I saw something different

some had this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
  drawClip: function(gid, scrollX, scrollY, offsetX, offsetY) {
        var gid = parseInt(gid);
        gid--; //tmx is 1-based, not 0-based.  We need to subtract 1 to get to a proper mapping.

        var tw = TILE_WIDTH;
        var th = TILE_HEIGHT;
       
        // # of tiles per row in tileset image
       var perRow = this._width / tw;

        // x and y in tileset image from where to copy
       var sx = (gid % perRow) * tw;
        var sy = Math.floor(gid / perRow) * th;
       
        // x and y in canvas to copy to.
       var dx = scrollX * tw + offsetX;
        var dy = scrollY * th + offsetY;
       
        // alert("sx: " + sx + " sy: " + sy + " dx: " + dx + " dy: " + dy);

        mapCtx.drawImage(this._img, sx, sy, tw, th, dx, dy, tw, th);
    }  


so I wondered where do I take scrollX/Y from?

Thanks
3  Game Development / Newbie & Debugging Questions / Question about swing components & canvas on: 2010-11-25 19:24:49
I got most of my stuff animated and working fine, I wanted to throw in some buttons like "new game"etc etc, to make the interface more "organized".

I used the template provided in this site, problem is when I add the button to the panel, the canvas won't let the buttons display or something like that... not really sure what's going on...

Another question, is it possible to add swing components to the canvas?

thanks
4  Game Development / Newbie & Debugging Questions / Re: Starting with which game? (newbie) on: 2010-11-15 00:03:27
Depends, most will create their own especially when not using Java2D.
Personally I like shmups, they're pretty easy to code and they cover most of the basics you'd need for general games programming.

it looks fun Smiley, is there any resources available (like ships, pew pew lasers lol, etc) ?

The only problem I'm having is this... I don't know how to answer it myself since I never programmed a game.

Moving forward,up etc, thats all normal, yet moving the whole background along... I load the background, paint it to the canvas. How should I "move" the background so it seems like I'm moving through space? my bad if it looks confusing, kinda hard to elaborate =/

5  Game Development / Newbie & Debugging Questions / Re: Starting with which game? (newbie) on: 2010-11-14 23:20:11
Basic Game seems to be a full templet, and not a panel.

Ah no, I didn't mean that, was just wondering about the java.awt.Canvas class and what I could do with it.
6  Game Development / Newbie & Debugging Questions / Starting with which game? (newbie) on: 2010-11-14 21:14:00
Hello, everyone!

Discovered this forum after reading parts of Killer Game Programming. Not sure where to start, making a game is so different from making a traditional application it kinda hits me how a game should flow when the program starts/pause/resume. Like I said, been reading that book for a while, then I helped myself to read a few topics here to glue together my requirements of what I need to know before starting but it's still not enough I guess.

About the Basic Game, is the Canvas is some sort of component too?, never seen the Canvas class before so I'm guessing it's sort of like a JPanel or something like that. (Still learning Java, slow but steady Smiley ).

The UI elements used in some games in the showcase, are they Swing buttons, or do they create their own customized UI for the game?


Anyway, besides those questions, most important one is which game should I try to program. I tried to do tetris but without any guidance it was mostly a hopeless attempt, couldn't do much.

Cheers,
David
P.S my bad if there are some grammar errors! Main lang is spanish
7  Games Center / Archived Projects / Re: Gunslinger 2 - sci-fi action top down shooter on: 2010-11-14 17:45:42
Hi all, I'm on windows vista, it stays in "Generating maps", here's what I got

After a minute or two the console stops outputting and well, the game just stays "generating map"

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  
n.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at java.lang.Class.newInstance0(Unknown Source)
   at java.lang.Class.newInstance(Unknown Source)
   at borb.engine.util.Util.newInstance(Util.java:160)
   at borb.gunslinger.generator.pass.placement.LivePlaceDescription.getLive(LivePlaceDescription.java:65)
   at borb.gunslinger.generator.pass.LivePlacePass.executePlacement(LivePlacePass.java:71)
   at borb.gunslinger.generator.pass.LivePlacePass.innerGenerate(LivePlacePass.java:60)
   at borb.gunslinger.generator.pass.DebugPass.generate(DebugPass.java:27)
   at borb.gunslinger.model.map.mapdesc.Map1Description.generate(Map1Description.java:141)
   at borb.gunslinger.model.map.mapdesc.MapDescription.generateMapSafe(MapDescription.java:47)
   at borb.gunslinger.model.Campaign.getNextMap(Campaign.java:334)
   at borb.gunslinger.screens.GeneratorScreen$1.run(GeneratorScreen.java:38)
   at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: paulscode.sound.SoundSystemException
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 19 more
Rooms done
Crawls done
Got hit!
Got hit!
Exits done
Map created
Doors done
Walls compiled
Sight compiled


Cheers
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.

Riven (9 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!