Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  TBS  (Read 4360 times)
0 Members and 1 Guest are viewing this topic.
Offline rolledback

Junior Duke


Projects: 1



TBS
« Posted 2012-02-21 04:45:32 »



This a continuation of the thread found here: http://www.java-gaming.org/topics/applet-to-application/25794/view.html

Simple turned based strategy game, still in development. My goal at the moment is to finish getting the UI sorted out. I'd like the info/dashboard thing at the bottom to be an independent window of the game screen. The would allow the player the ability the scroll around the game screen, which would also allow for any sized map, regardless of the user's screen size.

So if anyone has any ideas on how to implement this, I'm open to suggestions. I don't know much about java graphics aside from applets.

Game .jar file updated 2/23/12:
http://www.mediafire.com/?i6mid44e31i3x1m

Editor .jar file updated 2/23/12
http://www.mediafire.com/?ucpwfwukq20a1jc

Editor Controls:
1  
2  
3  
4  
-Click on tile to cycle through terrain types
-Press key of first letter of tile type to fill map(ex, p, f, l, m)
-Space bar to change to base editing mode, allows you to place bases on first and last columns
-Right click to export map (need the 2 bases before you can export)
Offline tberthel
« Reply #1 - Posted 2012-02-21 13:08:23 »

Good job making a game.  Your on your way.

You might use some tools to make your games and get an artist to work with you.

Unity and UDK come to mind if you really want to make games and don't care about the tools.

If tools is what you really like making with then you need to work many years molding open projects into a tool.

Offline lordberzerker97

Senior Newbie





« Reply #2 - Posted 2012-02-22 05:15:11 »

How do you end turn?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline rolledback

Junior Duke


Projects: 1



« Reply #3 - Posted 2012-02-22 20:11:30 »

How do you end turn?

Either press "End Turn" or hit your space bar.

I've also updated the JAR. Why is it that JFrame size and Applet size do not end up being equal?
Offline rolledback

Junior Duke


Projects: 1



« Reply #4 - Posted 2012-02-22 20:45:22 »

So obviously this won't work since I'm no longer working in an applet:
1  
2  
tank_fire = getAudioClip(getCodeBase(), "tank_fire.wav");
tank_destroyed = getAudioClip(getCodeBase(), "tank_destroyed.wav");

But neither does this:
1  
2  
tank_fire = getAudioClip(Main.class.getClassLoader().getResource("tank_fire.wav"));
tank_destroyed = getAudioClip(Main.class.getClassLoader().getResource("tank_destroyed.wav"));  

I have used System.out.println() to confirm that the code is pointed to the correct file, yet I keep getting a null pointer exception.

Any ideas?
Offline sproingie

JGO Kernel


Medals: 202



« Reply #5 - Posted 2012-02-22 20:52:59 »

If you use getClassLoader().getResource(), your paths are always from the root of your classpath, i.e. at the root of any dirs in your classpath or at the root of one of your jars.   Where are your wav files located now?
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2012-02-23 00:19:58 »

Use Class.getResource(String) for paths relative to that Class. Use Class.getClassLoader().getResource(String) for paths relative to the root of the classpath.

Offline sproingie

JGO Kernel


Medals: 202



« Reply #7 - Posted 2012-02-23 00:27:50 »

No, just use Class.getResource("/absolute/path/to/resource") to get paths relative to the root of the classpath.  One API is much more convenient when you start putting resource paths in properties files and don't have to remember which resource loader method you used.
Offline rolledback

Junior Duke


Projects: 1



« Reply #8 - Posted 2012-02-23 02:57:52 »

Is there a reason Java sucks at handling sound files? I have a copy of the sound files in my source folder, in their own source folder, in the package the class is in, and in the general project folder. Yet neither method of retrieving them works.
 Huh Huh Huh
1  
2  
3  
4  
5  
6  
System.out.println(Main.class.getResource("tank_fire.wav"));
System.out.println(Main.class.getClassLoader().getResource("tank_fire.wav"));

//tank_fire = getAudioClip(Main.class.getResource("tank_fire.wav"));
tank_fire = getAudioClip(Main.class.getClassLoader().getResource("tank_fire.wav"));
//both give the same error

1  
2  
3  
4  
5  
6  
7  
8  
file:/H:/Eclipse%20Workspace/TBS/bin/com/rolledback/game/tank_fire.wav
file:/H:/Eclipse%20Workspace/TBS/bin/tank_fire.wav
java.lang.NullPointerException
   at java.applet.Applet.getAppletContext(Unknown Source)
   at java.applet.Applet.getAudioClip(Unknown Source)
   at com.rolledback.game.Main.declareImages(Main.java:102)
   at com.rolledback.game.Main.init(Main.java:62)
   at com.rolledback.game.Game_Frame.main(Game_Frame.java:18)
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #9 - Posted 2012-02-23 03:27:28 »

That's because there is no AppletContext if you are adding it to the JFrame. Use the static "newAudioClip" method instead.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline rolledback

Junior Duke


Projects: 1



« Reply #10 - Posted 2012-02-23 03:54:04 »

That's because there is no AppletContext if you are adding it to the JFrame. Use the static "newAudioClip" method instead.

You so smart!   Grin
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #11 - Posted 2012-02-23 04:17:59 »

Grin

Offline rolledback

Junior Duke


Projects: 1



« Reply #12 - Posted 2012-02-23 20:50:27 »

Well I'm pretty much done with this project. Was a nice way to learn tile map system, packages, image/sound handling, writing custom algorithms, etc. The final jar's for both the game and the editor have been uploaded, links can be found in the original post. And you now have the option of using a custom map seed, so the editor actually has a purpose now. I'll only make changes if bugs are found or if I feel like adding something.

If anyone would like to have the source code, for whatever reason, I'll upload it. Just make sure you give credit where due.  Smiley

Thanks for all the help on the final touches. I'll be starting a new project soon.
Pages: [1]
  ignore  |  Print  
 
 

 
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!