Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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 ... 8
1  Game Development / Newbie & Debugging Questions / Re: How do you properly build a jar with libgdx? on: 2013-06-18 22:57:04
When I export my libgdx projects (and they work fine when I do) is right click the desktop project -> export -> select runnable jar file click next -> Select proper launch configuration and export destination. Also make sure packag required libraries into generated jar is selected. Then click finish. This seems to work great for me...

Just tried that, it didn't work. =/
2  Game Development / Newbie & Debugging Questions / Re: Making a little library on: 2013-06-17 16:46:38
Man that's a shame. I will have to make int and double version of everything  Sad
Thank you for your replies though. You illuminated me  Cheesy

It shouldn't be too tough to make a method for all of them. Just type one up and then CnP and adjust for each. =P
3  Game Development / Newbie & Debugging Questions / Re: How do you properly build a jar with libgdx? on: 2013-06-17 16:37:13
Eclipse, project properties, build path, export, check em all.

Have you tried fat jar? It is the easiest way to bundle jar and guaranteed to work.

I just tried both fat jar and checking everything but neither of those worked either. The assets folder is also never included in the jar so I've had to keep manually adding it after the jar is created. Prom is today so I probably won't get to reply again tonight; below is a link to download my project folder, maybe I'm just exporting this wrong?

http://www.mediafire.com/download/4quc57ud5pzakkq/Project_01.rar
4  Game Development / Newbie & Debugging Questions / Re: Tile Based RPG Resource Management and Loading on: 2013-06-17 16:18:55
Hm. I guess that'd be the most appropriate choice. Is that fast? Should I just load all the assets at the start of the game?

I doubt you'd even notice any difference in loading time as long as your text file isn't absurdly long (a few thousand lines). Load it whenever you want; if you're putting the keys on the map right away then load the text file right away.
5  Game Development / Newbie & Debugging Questions / Re: Tile Based RPG Resource Management and Loading on: 2013-06-17 02:30:47
I kinda-sorta get what you're saying. The way I'd do it, which is probably a bit too long, would be to have a text file that looks like this:

KeyID, DoorIDForDoorThatKeyOpens, WhereKeyIsOnMap
KeyID, DoorIDForDoorThatKeyOpens, WhereKeyIsOnMap
KeyID, DoorIDForDoorThatKeyOpens, WhereKeyIsOnMap
etc...

Just load and parse the text file for the information then do whatever you need to with that information. The WhereIsKeyOnMap decides where the key is on the map, DoorIDForDoorThatKeyOpens decides which door the key opens and the KeyID is for something that I forgot while typing this.

Hopefully this gives you some ideas for different approaches to solve your problem.
6  Game Development / Newbie & Debugging Questions / Re: My game is almost half a Gigabyte in size on: 2013-06-17 01:59:15
First, if you can, use something like MP3s instead of WAVs, that will save a ridiculous amount of space.
Might need to investigate a mp3 loader or library for it, but it would be worth the investment.

EDIT: Kinda ninja'd,  but yeah, WAV is totally uncompressed, and MP3 is pretty well compressed, and still sounds fine to most ppl down to about 192 Kbps or so

In regards to an mp3 loader, just use libgdx; it works quite well.
7  Game Development / Newbie & Debugging Questions / Re: My game is almost half a Gigabyte in size on: 2013-06-17 01:55:25
Look for a batch Wav to Mp3 converter. I'm not sure if Wav is very compressed compared to Mp3 but if it isn't then that should help quite a bit.
8  Game Development / Newbie & Debugging Questions / How do you properly build a jar with libgdx? on: 2013-06-16 22:19:53
Hey,

I finally finished making up a little test game while going through the libgdx tutorials and I want to build the jar file so I can show it to one of my friends. I've tried doing this a few different ways at this point but the jar never runs. I've tried exporting as a jar and as an executable jar with various different options selected, I've also tried running it with the required libgdx libraries within the jar, outside of the jar and with the assets folder within and outside of the jar but nothing works.

The game runs properly when running it from eclipse and I've made sure that there are no errors coming from any of the classes before building the jar so I'm not sure what's up.

Edit: BTW, I'm only using libgdx for desktop; I don't care about android, mac or whatever else there was.
9  Game Development / Newbie & Debugging Questions / Re: Auto-Generated Libgdx Code And One Other Thing on: 2013-06-16 18:27:29
If you only plan on targeting desktop (i.e. no desire to use Android/iOS), you can just follow these steps:
http://www.java-gaming.org/topics/libgdx-how-do-i-load-local-assets-without-an-android-project/29148/msg/266799/view.html#msg266799

Thanks, that worked. ^.^ Time to go figure out how to use libgdx now!
10  Game Development / Newbie & Debugging Questions / Re: Auto-Generated Libgdx Code And One Other Thing on: 2013-06-16 16:38:30
Erm, the setup ui doesnot generate this file at all.

Yep, it did. I created a new project following the steps on the libgdx site and this is what was inside of the main class that it generated.
11  Game Development / Newbie & Debugging Questions / Auto-Generated Libgdx Code And One Other Thing on: 2013-06-16 04:53:11
I just installed lbgdx or however the abbreviation goes and I have two questions. The first is, does lbgdx work like lwjgl and stuff like that where I just add them to the project and start using the classes right away? The second is, do I need to keep the code below that was auto-generated when I ran gdx-setup-ui.jar?

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  
/*******************************************************************************
 * Copyright 2011 See AUTHORS file.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/


package com.badlogic.gdx.utils;

import com.badlogic.gdx.jnigen.AntScriptGenerator;
import com.badlogic.gdx.jnigen.BuildConfig;
import com.badlogic.gdx.jnigen.BuildExecutor;
import com.badlogic.gdx.jnigen.BuildTarget;
import com.badlogic.gdx.jnigen.BuildTarget.TargetOs;
import com.badlogic.gdx.jnigen.NativeCodeGenerator;

/** Builds the JNI wrappers via gdx-jnigen.
 * @author mzechner */

public class GdxBuild {
   public static void main (String[] args) throws Exception {
      String JNI_DIR = "jni";
      String LIBS_DIR = "libs";

      // generate C/C++ code
     new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);

      // generate build scripts, for win32 only
     // custom target for testing purposes
     BuildTarget win32home = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
      win32home.compilerPrefix = "";
      win32home.buildFileName = "build-windows32home.xml";
      win32home.excludeFromMasterBuildFile = true;
      BuildTarget win32 = BuildTarget.newDefaultTarget(TargetOs.Windows, false);
      BuildTarget win64 = BuildTarget.newDefaultTarget(TargetOs.Windows, true);
      BuildTarget lin32 = BuildTarget.newDefaultTarget(TargetOs.Linux, false);
      BuildTarget lin64 = BuildTarget.newDefaultTarget(TargetOs.Linux, true);
      BuildTarget android = BuildTarget.newDefaultTarget(TargetOs.Android, false);
      BuildTarget mac = BuildTarget.newDefaultTarget(TargetOs.MacOsX, false);
      new AntScriptGenerator().generate(new BuildConfig("gdx", "../target/native", LIBS_DIR, JNI_DIR), mac, win32home, win32,
         win64, lin32, lin64, android);

      // build natives
     // BuildExecutor.executeAnt("jni/build-windows32home.xml", "-v");
     // BuildExecutor.executeAnt("jni/build.xml", "pack-natives -v");
  }
}


It gave me a compile error right off the bat so I was just about to get rid of it but then I thought to ask first. The error it gave is below if anyone was wondering.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
Exception in thread "main" java.lang.NoClassDefFoundError: com/badlogic/gdx/jnigen/NativeCodeGenerator
   at com.badlogic.gdx.utils.GdxBuild.main(GdxBuild.java:34)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.jnigen.NativeCodeGenerator
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   ... 1 more


PS: What's with these topic title restrictions? I had to change my topic title three different times just to post this, the title looks ridiculous now.
12  Discussions / Miscellaneous Topics / Re: Quadratic equations on: 2013-06-13 03:23:49
I'll second what Agro said about the quadratic formula. It's really easy, you just plug in the numbers and out comes the answer.
 (-b±√(b²-4ac)) / (2a)
As far as I remember you use this with a trinomial or something like that... I haven't used it in a while. =P
13  Game Development / Newbie & Debugging Questions / Eclipse Messing Up Packages on: 2013-06-13 00:21:24
Hey,

I just switched over to eclipse today after finding out that the Java course I'm taking next year in uni uses it instead of NetBeans. I'm making a little test project to figure out how to use eclipse but I can't get anywhere with what it keeps doing to my packages. I'm trying to make some nice, neatly organized packages within packages but it keeps deleting subpackages and renaming their parent packages.

What I'm doing to make subpackages, since I can't find any other way to do it, is creating a new package, then right click-> copy qualified name -> paste onto package that I want the new package to be a subpackage of. After this I move my one class from the parent package into the new subpackage and eclipse deletes my subpackage, renames the parent to parentPackageName.subpackageName and then moves the class under the newly renamed parent.

Does anyone know how to force eclipse to stop doing this?
14  Game Development / Newbie & Debugging Questions / Re: Tilemap editing based on RGB? on: 2013-06-09 16:22:49
I just glossed over a few posts before replying here but what you want to do is almost exactly the way that I'm loading my map. The way I have it set up will probably be a bit stupid to other people but here goes...

The first thing I do in my ResourceHandler class is to load the map-image and get the values for each and every pixel on the image. Below is a CnP of the code I use with a lot of it edited out, it's just to give you a basic idea:

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  
 public void loadImages()
    {
        currentMap = loadMap("Resources/Maps/Maps/TestMap.png");
    }

    //Load Map
   private int[][] loadMap(final String x) //Requires the map's file name. Don't include the extension.
   {
        try
        {
            final URL url = this.getClass().getClassLoader().getResource(x);
            final BufferedImage bufferedImage = ImageIO.read(url);
            final int mapWidth = bufferedImage.getWidth();
            final int mapHeight = bufferedImage.getHeight();
            final int[] pixels = new int[mapWidth * mapHeight];
            int[][] map;

            bufferedImage.getRGB(0, 0, mapWidth, mapHeight, pixels, 0, mapWidth);

            map = new int[mapWidth][mapHeight];
           
            for(int row = 0; row < mapHeight; row++)
            {
                for(int column = 0; column < mapWidth; column++)
                {
                    //This statement slows everything down, only use it to find the value of a pixel. System.out.println(pixels[row * mapWidth + column]);
                   map[column][row] = pixels[row * mapWidth + column];
                }
            }
           
            return map;
        } catch (IOException ex)
        {
            ex.printStackTrace();
        }
       
        //This should never be reached; from all the tests so-far it has never been reached so it can be assumed that it never will be unless under some unforseeable circumstance.
       return null;
    }


The next thing that I do is to use the code below in the rendering part of the game loop to draw the map to the screen.

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  
//Render Map
       for(int row = mapWhatToDraw[0]; row < mapWhatToDraw[2]; row++)
        {
            for(int column = mapWhatToDraw[1]; column < mapWhatToDraw[3]; column++)
            {
                switch(currentMap[column][row]) //Note: To increase the player's walking speed just times both the playerXPosition and playerYPosition by a speed multiplyer
               {
                    case -1237980: //Grass
                   {
                        g.drawImage(resource.getSprite(2, 0, 0), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }

                    case -3584: //Grass Flower 1
                   {
                        g.drawImage(resource.getSprite(2, 0, 1), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }

                    case -16735512: //Grass Flower 2
                   {
                        g.drawImage(resource.getSprite(2, 0, 2), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }

                    case -14503604: //Stone Path
                   {
                        g.drawImage(resource.getSprite(2, 0, 3), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14503860: //Stone Path
                   {
                        g.drawImage(resource.getSprite(2, 0, 4), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14504116: //Grass-Stone Path_1
                   {
                        g.drawImage(resource.getSprite(2, 0, 5), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14504372: //Grass-Stone Path_2
                   {
                        g.drawImage(resource.getSprite(2, 0, 6), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14504628: //Grass-Stone Path_3
                   {
                        g.drawImage(resource.getSprite(2, 0, 7), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14504884: //Grass-Stone Path_4
                   {
                        g.drawImage(resource.getSprite(2, 0, 8), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14505140: //Grass-Stone Path_5
                   {
                        g.drawImage(resource.getSprite(2, 0, 9), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14505396: //Grass-Stone Path_6
                   {
                        g.drawImage(resource.getSprite(2, 0, 10), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                       
                    case -14505652: //Grass-Stone Path_7
                   {
                        g.drawImage(resource.getSprite(2, 0, 11), column*40 - playerXLocation, row * 40 - playerYLocation, null);
                        break;
                    }
                }


Now you're definitely wondering what the heck all of those random numbers that mean absolutely nothing, as far as I know, mean. Well, as far as I know, they're just some nonsense given to you if you do "System.out.println(bufferedImage.getRGB(0, 0, mapWidth, mapHeight, pixels, 0, mapWidth));" up in the map-image loading code. It'll give you a unique number for every single color and that's the number that you use in the case statement above to decide which tile to draw. This way of loading the map can be a pain in the butt if you forget what to do but it works very well for me and that's why I use it. ^.^
15  Game Development / Newbie & Debugging Questions / Re: [RPG] How do you move all of these things? on: 2013-05-19 23:58:02
Thanks for the replies, I was actually had a similar idea floating around in my head. I'll give it a shot and see if it works out. ^.^  Smiley
16  Game Development / Newbie & Debugging Questions / [RPG] How do you move all of these things? on: 2013-05-19 04:58:07
Hey,

I've been thinking about this since I first managed to get player/map movement working a while back. How do you move the map, camera, npcs and the player's character? The way that I've been doing it seems really crude and it puts a lot of limitations on how I do things, I'd like to change the way I'm doing it atm but I'm not sure of any other ways to do this.

The way that I currently do everything is... The player's character is always centered on the screen, everything else is moved around the player to make it look as if the player is moving. By doing it this way I'm unable to allow the window to be resized because it'll throw off all of the math which I use to draw everything, the player's speed can only be slightly increased before it goes into super speed and looks terrible and I won't be able to do decent looking cutscenes with this setup.

So, how would you go about moving the player's character, camera, npcs, etc... in a 2D game? (Just theory, I'm not looking for any code.)
17  Game Development / Newbie & Debugging Questions / Re: Question about NetBeans and error.printStackTrace(); on: 2013-05-14 22:00:36
I'll take a look at slf4j then. If you leave code that prints to a console in production code, does anything bad happen?
18  Game Development / Newbie & Debugging Questions / Question about NetBeans and error.printStackTrace(); on: 2013-05-14 20:16:03
I've noticed for a while, but never paid any mind, that NetBeans always wants to replace:
1  
 error.printStackTrace();


with:
1  
 Logger.getLogger(ResourceHandler.class.getName()).log(Level.SEVERE, null, ex);


Why does NetBeans do this and what does Logger do that printStackTrace() doesn't? In the class I took we were always told to use error.printStackTrace(); and Logger was never once mentioned.
19  Games Center / WIP games, tools & toy projects / Re: Dreamscape on: 2013-05-14 18:44:58
No, I mean, you really should fix that...really no rpg doesn't allow diagonal movement, unless maybe if it's turn based.

Ah, well it's been on my to-do list for a while. I think that it can be fixed with a few more if-else statements and a few checks. If everything goes as planned it should be fixed right before I finish this next part of the NPC class.

Edit:
O.o I guess my code rewrites actually helped a lot! ^.^ It only took me 10 minutes to get diagonal movement working perfectly. I was more-or-less avoiding adding diagonal movement because the first time I tried adding it, there were problems everywhere; at least it's done now.
20  Games Center / WIP games, tools & toy projects / Re: Dreamscape on: 2013-05-14 02:08:33
There isn't any reason for your collision code not to be working with diagonal movement...

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
public boolean checkPointCollision(final int xPosition, final int yPosition)
    {
        final int[] temp = MiscellaniousCalculations.collisionDetection_GetXYPositionsOnMap(xPosition, yPosition);

        switch(currentMap[temp[0]][temp[1]])
        {
            case -16777216: //Black Map Border
           {
                return false;
            }
            case -14503604: //Stone Path
           {
                return false;
            }
            default:
            {
                return true;
            }
        }


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  
 //This while statement checks 4 different points around the player's sprite, if any of them return false then the player's position is changed until they all return true.
       while(collision.checkPointCollision(playerXLocation - 12, playerYLocation + 22) == false /*LowerLeftPoint*/ || collision.checkPointCollision(playerXLocation + 12, playerYLocation + 22) == false /*Lower Right Point*/ || collision.checkPointCollision(playerXLocation - 12, playerYLocation) == false /*Middle Left Point*/ || collision.checkPointCollision(playerXLocation + 12, playerYLocation) == false /*Middle Right Point*/)
        {
            switch(playerDirection)
            {
                case 0:
                {
                    player.setXLocation(1);
                    playerXLocation++;
                    break;
                }
               
                case 1:
                {
                    player.setYLocation(1);
                    playerYLocation++;
                    break;
                }
                   
                case 2:
                {
                    player.setXLocation(-1);
                    playerXLocation--;
                    break;
                }
                   
                case 3:
                {
                    player.setYLocation(-1);
                    playerYLocation--;
                    break;
                }
            }
        }


Walk into the top-middle of a block while using diagonal movement and it'll place you on one of the sides of the block; or walk into the side of a block walking down-left, up-left, down-right or up-right and it'll move you either downwards or upwards very quickly.
21  Games Center / WIP games, tools & toy projects / Re: Dreamscape on: 2013-05-14 00:16:04
The collision code doesn't work with diagonal movement so you're only allowed to use one key at a time for now. I'll see about a fix later on though.

1  
2  
3  
4  
 if((KeyboardListener.isKeyPressed(KeyEvent.VK_W) && KeyboardListener.isKeyPressed(KeyEvent.VK_S) || KeyboardListener.isKeyPressed(KeyEvent.VK_UP) && KeyboardListener.isKeyPressed(KeyEvent.VK_DOWN)) || (KeyboardListener.isKeyPressed(KeyEvent.VK_W) && KeyboardListener.isKeyPressed(KeyEvent.VK_A) || KeyboardListener.isKeyPressed(KeyEvent.VK_UP) && KeyboardListener.isKeyPressed(KeyEvent.VK_LEFT)) || (KeyboardListener.isKeyPressed(KeyEvent.VK_W) && KeyboardListener.isKeyPressed(KeyEvent.VK_D) || KeyboardListener.isKeyPressed(KeyEvent.VK_UP) && KeyboardListener.isKeyPressed(KeyEvent.VK_RIGHT)) || (KeyboardListener.isKeyPressed(KeyEvent.VK_S) && KeyboardListener.isKeyPressed(KeyEvent.VK_A) || KeyboardListener.isKeyPressed(KeyEvent.VK_DOWN) && KeyboardListener.isKeyPressed(KeyEvent.VK_LEFT)) || (KeyboardListener.isKeyPressed(KeyEvent.VK_S) && KeyboardListener.isKeyPressed(KeyEvent.VK_D) || KeyboardListener.isKeyPressed(KeyEvent.VK_DOWN) && KeyboardListener.isKeyPressed(KeyEvent.VK_RIGHT)) || (KeyboardListener.isKeyPressed(KeyEvent.VK_A) && KeyboardListener.isKeyPressed(KeyEvent.VK_D) || KeyboardListener.isKeyPressed(KeyEvent.VK_LEFT) && KeyboardListener.isKeyPressed(KeyEvent.VK_RIGHT)))
        {
            isWalking = false;
        }


That's what's stopping you for now =P
22  Game Development / Newbie & Debugging Questions / Re: Simple Parsing Question on: 2013-05-13 20:43:23
You're trying to call split() on an array!  You need to use a second loop through the tempTwo array.

Ah, that makes sense. ^.^ Here's the new code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
for(int i=0;i<npcValues.length;i++)
        {
            String[] temp;
            String[] tempTwo;
            temp = waypointValues[i].split(":");
            for(int j=0;j<temp.length;j++)
            {
                tempTwo = temp[j].split("|");
                for(int k=0;k<temp.length;k++)
                {
                    integerValues[i][1][k] = Integer.parseInt(tempTwo[k].toString().split(","));
                }
            }
            //Parse all info into it's respective array.
       }


I'm getting an error on the line "integerValues[1][k] = Integer.parseInt(tempTwo[k].toString().split(","));" It says that it can't parse a String[] so I added ".toString()" to turn it into a String instead but the error still shows.


Edit: Switched it to the below and there aren't any more errors... Time to test it!

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
for(int i=0;i<npcValues.length;i++)
        {
            String[] temp;
            String[] tempTwo;
            temp = waypointValues[i].split(":");
            for(int j=0;j<temp.length;j++)
            {
                tempTwo = temp[j].split("|");
                for(int k=0;k<temp.length;k++)
                {
                    integerValues[i][1][k] = Integer.valueOf(String.valueOf(tempTwo[k].split(",")));
                }
            }
            //Parse all info into it's respective array.
       }
23  Game Development / Newbie & Debugging Questions / Re: Will I get the exact amount of memory usage? on: 2013-05-13 19:16:45
I'm not sure if what you're asking and what I'm thinking are the same but this is how I get the amount of memory being used.

1  
"Total RAM Used: "+((runtime.totalMemory() - runtime.freeMemory()) / (1024*1024))+"mb"


This should, as far as I know, give you the total amount of RAM being used without counting the heap. Sorry if this isn't what you're asking for!
24  Game Development / Newbie & Debugging Questions / Simple Parsing Question on: 2013-05-13 19:13:49
I'm attempting to take this string "0:0,0|1,1|2,2" and then separate it so that I end up with "0" & "0,0|1,1|2,2" and then separate "0,0|1,1|2,2" into "0,0" "1,1" "2,2" and then separate each of those and place them, in order, into an array.

Here's what I've written so-far:
1  
2  
3  
4  
5  
6  
7  
8  
9  
for(int i=0;i<npcValues.length;i++)
        {
            String[] temp;
            String[] tempTwo;
            temp = waypointValues[i].split(":");
            tempTwo = temp[1].split("|");
            integerValues[i][1][] = tempTwo.split(","); //The waypoints are to be split up and placed, in order, into [i][1][waypointStuffHere] or something like that
           //Parse all info into it's respective array.
       }


The last statement "integerValues[1][] = tempTwo.split(",");" gives an illegal start of expression error and I'm pretty sure it's because the statement doesn't work in the way that I think it should be working. I'm not too sure if what I've written is going to do what I want as I can't test it without figuring out how to do the last split so I've decided to ask for some help on finishing it up =P
25  Games Center / WIP games, tools & toy projects / Re: Dreamscape on: 2013-05-13 17:14:34
Here's another small update:

  • Finally discovered the movement bug that was overriding certain keys and fixed it pretty easily.
  • Discovered and fixed another bug where the player's walking animation would still play when it shouldn't have.
  • Deleted the entire NPC class; it was a huge trainwreck and I just couldn't bare to work on it. I'll be rewriting NPC movement and that over the next little while.
  • Photoshopped up two images as an example of how to use an interface later on. They're just two black images being rendered to the screen.

Here is the latest version of the program. There's still nothing to do other than walk around and that but I'll start working on some features after I get NPCs working somewhat decently.

http://www.java-gaming.org/user-generated-content/members/151044/sword-v2.jar
(Hopefully that link works...)
26  Game Development / Newbie & Debugging Questions / Re: Trouble with Transparent Backgrounds on: 2013-05-07 17:31:59
Thanks for the link but I've checked out that page already and it didn't seem to be able to do what I'm trying to do.

Here's what I'm trying to do/what I've done...

I've disabled the toolbar and the border around the frame and implemented some code so that you can drag the frame around with the canvas instead of using the toolbar. The next step that I need to do is to be able to display an image that isn't see-through on a see-through canvas, an example of what I'm trying to do would be like this picture http://i.imgur.com/GGS92dx.jpg . Basically it'll just show up as an image on the desktop wherever you place it.

So, as far as I know, making the whole canvas transparent won't work because I need to be able to display a non-transparent image onto the transparent canvas.
27  Game Development / Newbie & Debugging Questions / Re: Trouble with Transparent Backgrounds on: 2013-05-07 00:01:09
Why would you think that making the image transparent would show the desktop?
You can use java.awt.Robot and createScreenCapture(), but your window would block it.
I don't know if this is possible with java, this seems too low level.

Someone said to try it in the comments section of one of the various pages I googled so I did. I'll check out awt.Robot now, I think that it might just work if it works the way I think...

Edit:
Well, I managed to get it kinda-sorta-almost working with this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
//Render the picture to the background and hope that this works...
       try
        {
            Robot robot = new Robot();
            Point point = canvas.getParent().getLocationOnScreen();
            System.out.println(point);
            Rectangle captureSize = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
            BufferedImage bufferedImage = robot.createScreenCapture(captureSize);
            g.drawImage(bufferedImage, point.x, point.y, point.x+720, point.y+492, point.x, point.y, point.x+720, point.y+492, null);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }


But it can't take pictures from behind the canvas. Looks like I'm back to square 1 again...
28  Game Development / Newbie & Debugging Questions / Trouble with Transparent Backgrounds on: 2013-05-06 22:36:52
Hey, I'm currently attempting to hack-together a widget for my desktop so I can get away from thinking about games and make something quick and fun. I've had good success so-far but now I've hit a small snag right before I'm about to finish most of the back-end code and move on to the fun parts.

I'm attempting to make the background of my canvas completely transparent so that only the images that I display will be shown and the rest will show whatever's behind the widget on the desktop. I've tried a few things such as setBackground(new Color(0, 0, 0, 255)), setBackground(new Color(0, 0, 0, 0)), setBackground(Color.TRANSPARENT); and my latest attempt was to create a transparent image the size of the screen in photoshop and then display it but that didn't work either. If anyone has any ideas on how to get this to work they'll help a lot. ^.^
29  Discussions / General Discussions / Re: Free To Play/In-App purchases on: 2013-04-24 23:07:20
My opinion is that, as long as the things that you can buy are purely cosmetic items or items that don't have much of an effect on gameplay, then they're perfectly fine.
30  Game Development / Newbie & Debugging Questions / Re: Game starting help ! on: 2013-04-24 19:19:46
offtopic I know english is not your native language, (it's not mine either) but what's that word you keep repeating? i'v

I'm fairly sure that he's trying to spell 'I've'.
Pages: [1] 2 3 ... 8
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Get high quality music tracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
mrbenebob (9 views)
2013-06-19 14:55:23

BrassApparatus (16 views)
2013-06-19 08:52:37

NegativeZero (20 views)
2013-06-19 03:31:52

NegativeZero (22 views)
2013-06-19 03:24:09

Jesse_Attard (27 views)
2013-06-18 22:03:02

HeroesGraveDev (65 views)
2013-06-15 23:35:23

Vermeer (64 views)
2013-06-14 20:08:06

davedes (65 views)
2013-06-14 16:03:55

alaslipknot (58 views)
2013-06-13 07:56:31

Roquen (80 views)
2013-06-12 04:12:32
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!