Featured games (91)
games approved by the League of Dukes
Games in Showcase (578)
games submitted by our members
Games in WIP (499)
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
1  Games Center / Archived Projects / Space Crap: 2D Shooter on: 2010-05-02 01:06:05
Pretty generic space shooter. Enough said.
The graphics are my own, hence the name.  Roll Eyes
2  Games Center / Archived Projects / Re: Battery - 2d Applet Side Scrolling Shooter. on: 2008-05-18 03:49:51
I got few issues:
1. Thats one pretty slow plane.
2. Whats up with the bullet limit?
3. Whats up with the frames around the helicopters and the plane?
4. The game runs at 100% cpu and it froze on me once.
3  Discussions / Miscellaneous Topics / Re: Applet Hosting on: 2008-03-12 20:12:33
Ummm... requires to complete a signup challenge. I cant do it cause im stupid...
and wont upload jar files, only html files (my jar is 5.5 MB). And its very buggy.

I tried freewebs, it works but it loads deathly slow.
4  Discussions / Miscellaneous Topics / Applet Hosting on: 2008-03-12 16:09:36
Is there a website or something that can host applets for free? I tried google pages and yahoo geocities but they crash or do not load.

5  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-07 21:26:46
There isnt by any chance a Layout that doesnt resize components?
6  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-07 20:30:30
Like OMG, guess what happened  Shocked
A friend of mine has to make an  applet for his class where he has to place two textfields in the center and two scrollbars below each texfield using Layout Managers. So we spent a few hours figuring it out and arrived at nowhere. I coulda done all that without layout manager in 2 minutes. Man, i wouldnt wanna be in his place...  Roll Eyes
Turns out im not the only one who does not consider layout managers the easiest thing in the world.
7  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-04 18:20:20
The implementation of layout managers is not trivial. Why not just keep the size of a component as if it did have a layout manager when a user decides not use one. Setting a component size to 0 inroduces so much ambiguity. If it just set the size to some number (not 0) then the programmer would know that he needs to resize it. Anyways, lets not argue aout the correct use of layout managers, if there is function that disables a layout manager, then the AWT should fully support this possibility.
8  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-02 19:30:54
Quote from: alexxz4 on March 01, 2008, 11:55:01 am
Well, then, if u just add a component, would you be able to see it if it has the default size (i.e. 0,0)?

No, you wouldn't.  That's why you should use layout managers, as was suggested many times before in this thread.  Why do you not like them?
Ummm.... yes you would. Try adding a button to an applet, you'll see it in the upper-central location. Its size is not 0,0 i can tell you.
So in affect this code:
setLayout(null); button.setLocation(20,20);

all by itself has the same affect as

And layout managers position stuff how-ever they like to. You cant tell position of a component when a layout manager is done with it.
If you insist on using null layout as you are, then yes, it makes perfect sense that the programmer is required to set both the size and location of all components.  How else would the AWT know where/how big to display the components?
It doesnt make sense to me why a programmer must set the size of a checkbox when he doesnt have to.
If u have 2 default sizes they are not default anymore are they? Gottcha....
I'm not sure what you mean by this.
Well, the first default size is the smallest size to fit the contents of the component. You get it when you do this:
void init(){
Button button=new Button("Button");

The "second" default size is (0,0), you get it when u do this:
void init(){
Button button=new Button("Button");

If you're going to be the only one to ever look at/modify your code, then this mindset is fine.  But don't say this at a job interview!
Like i said, im gonna modify it after i finish. First i gotta make sure it works without making my head explode with countless classes.
You consider good OOP design, with several concise, readable classes, each doing a different task, more "bloated" than a 3000+ line mega-class?
Common, everyone knows that OOP takes more statements to implement than FO. A formal OOP implementation requires the use of declaration, setters and getters, while OF only needs a declaration. OOP doesnt reduce line count by any stretch of imagination.
They didn't have the problems you're having.  Don't you think this means that the problems you're having aren't with the AWT, but instead with your code (or your understanding of the API?).
Shocked Yeah right, they never had to press Backspace or Delete or refer to a manual or debug or ask for help. Common! No actually, my problems are with AWT cause my code uses them. The AWT may not be buggy, but its a little under-developed, which is what i have a problem with. 
9  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-01 20:55:01
Your assumption is wrong, there are default values for size, where size might be 0,0 making it impossible to spot. your making up stuff here.
Well, then, if u just add a component, would you be able to see it if it has the default size (i.e. 0,0)? If u have 2 default sizes they are not default anymore are they? Gottcha....
I wouldn't know, I do know that something that is well ordered is much easier to modify and read.
Im not writing an essay am i? I find it faster to program if i dont adhere to some conventions.
Short lived objects might be more efficient in certain cases, the amount of classes that OOP introduce are largely insignificant performance wise.
Ummm... i dont think that means "short lived objects improve performance considerably", which was my point...
A contract or obnoxious comments as you call them avoids all the issues your having for the rest of us.
Plus it bloats up the code considerably. I hate it when i only see one statement on the page with a bunch of spaces and comments.
10  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-03-01 19:44:20
This prints true here and I assure you nothing is being drawn. setVisible is there for performance reasons and wasn't intended as a diagnostic mechanism. As for those methods that you mention I can't find them, what class are they suppose to belong to?
What i meant was that how could 10 components be drawn and 5 components not be drawn if all the code related to those 15 components is in the same functions, and those functions perform the same thing. If nothing was drawn, i'd know i made a mistake somewhere.
If its not too hard, could someone modify the source code so that it works?
I'd be crazy enough to do it. but see above.
Someone must have known that setLocation() and setSize() must go together.
It's not just OO if this was FO you couldn't get away with half of that stuff. I'm also wondering where you think your getting speed up from doing it like this, it takes longer to sort out the code then to rewrite it.
Considering performance issues, i dont think OOP (i.e. 1000 classes) will improve it drastically. Plus, i think that a program that runs is better than a program that has a good style but is very buggy. Like i said, when im done im gonna stuff that code into classes, put obnoxious and pointless comments all over the program, and the OOP geezers will be happy... 
(like the same program starting out in different states, etc.)
say what?
In one game i often have the character falling from the sky when the game loads. More often he is standing on the ground when the game starts.  Roll Eyes
11  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 22:53:24
You spend all this time trying to figure out what is wrong when you could have been half way through the tutorial by now.
Well, considering that stuff about positioning is at the end, i saved some time.
Still, normal assumption is that if you want to change position of a button only (and keep its size to default) you would only need to use setLocation() without using setBounds() and changing its size. The same goes for checkboxes, i dont see any reason why anyone would change its size. Lets use common sense, people. If everyone referred to java tutorial without making assumptions we would not get anywhere.
Anyways, its easy to blame it all on me since i was the one who found the answer. OMG.
12  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 21:35:39
OMG, i shouldve known it. When setting location of a component, you need to set its size too, otherwise it would not show. So all components, including checkboxes need to have their size set (setting a size of a checkbox has no effect by default, but u need to set its size when u change its position).  Shocked That makes hole lotta sence, no brainer. Works out pretty nice when you need to change a button's text, you would have to guess the buttons required length or use FontMetrics class. I love java OMG.
Now i know some of the experts here knew this and yet didnt tell me.  Angry
13  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 21:13:12
In your case, programming is not just knowing the language, it's about knowing the APIs and proper coding styles. You have to understand what your code does, and how it handles the APIs, because when you don't, you'll never know whether your code, or the API caused that bug you're seeing. It's pretty safe to assume the bug is in your code most of the time, though. When in doubt, insert lots of System.out's, to see what state your application is in, as your assumptions can be very wrong.
Its not a problem its a java bug. Ive seen a share of them (like the same program starting out in different states, etc.) Usually im able to work around those bugs, but not this one. I would never touch AWT if this project was only for myself, but im "supposed to" use java API.
I have a question then (i asked it before): How could a component not be visible when its state is set on visible? If there are some ambiguous functions (like setEnabledVisibility() or setVisibleWhenSettingVisible() or showComponentOnTheScreen()) that control visibility, its an API flaw, not mine.
14  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 19:39:33
No, like i said, repaint()'ing doesnt help.   Tongue

If its not too hard, could someone modify the source code so that it works?
15  Discussions / Miscellaneous Topics / Re: Need a small portable IDE on: 2008-02-29 18:53:51
So work with projects.  Do you have some kind of religious objection to them, or something?
Its just much easier to work with plain .java files.
Anyways, i installed JCreator on my flash drive (didnt know if it would work, but i tried anyways) and it works great.
Sorry for my noobiness.  Grin
16  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 18:32:20
Hmmm... i thought what i had in update() method was supposed to take care of double-buffering. Anyways, its not really important, im not gonna use optionpanes in this project.
Ok, to elaborate on some of my code, here is a piece of it from actionPerformed(ActionEvent e):
else if(e.getSource()==b_quiz){
         function=3;                        // this sets it to quiz mode
         b_atlas.setVisible(false);   b_quiz.setVisible(false);     // this hides quiz and atlas buttons so that they dont show
        loadAsia();                   // this loads all the graphical stuff and flags of the continent
        question_mode=1;    // this mode is multiple choice question
        newQuestion(question_mode);   // this generates new question
        hideAWT(false);                // this shows all the components on the screen
        positionAWT();       // this positions and resizes buttons and checkboxes
        showComponents(question_mode);        // this hides some of the components that are not needed.

This is a piece of code from showComponents() that sets visible those components that need to be shown. Notice that if mode=1, then the 4 checkboxes should be visible.
if(mode==1 || mode==4 || mode==6 || mode==9 || mode==11 || mode==13 || mode==16
          || mode==17){
         checkbox1.setVisible(true);   checkbox2.setVisible(true);
         checkbox3.setVisible(true);   checkbox4.setVisible(true);

Maybe those buttons that are named "submit" are never shown by java (same goes for the checkboxes). But then again, i tried renaming them and still doesnt work, so its not it. Maybe there is a limit on how many components you can have and maybe i have too many...  Undecided 
If someone would just tell me that AWT stuff is very buggy, i will use my own components cause i wont have no other choice...
17  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-29 17:06:01
also what a monster class, I can dump 100 best practices on you right now but'll start with stuff which has a direct effect.
As u probably noticed, this is not a complete project. I prefer "coding it out" before dealing with OOP logistics.
The pop-up window is custom made if i need to add more stuff to it. Plus, im not sure if applets support JOptionPanes (i know JApplets probably do but JApplets flicker and mess up my drawing stuff).
I called it just before you called restart(). Not knowing how the rest of your code works, this kind of made sense  Smiley).
The buttons at the start screen at least now show up where you expected. I didn't test anything else but I suppose it'll solve your other layout problems as well.
Yeah, it solved it, but the 4 checkboxes and the submit button are still not showing in the 'quiz' mode.
Here is how it looks with AWT buttons and checkboxes:
And this is what its supposed to look like (using my own Checkboxes and Buttons):
18  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-28 17:07:38
OK, here is my code (with all the files and classes).
I dont want you to get wild with it, just press 'Quiz' button when it loads.
On line 468 i draw some stuff about 'submit' button. As u see, its visible yet its not showing. Im not even complaining about 'Quiz' and 'Atlas' buttons on the start page in convoluted places, at least THEY ARE THERE (I set their positions and sizes in positionAWT() function, line 1030. For some reason java decided to position all the buttons in correct places except those 2  Huh). The four checkboxes are not there also.
Sorry for putting all that coding monstrosity here. Its just that it functions fine if the program is smaller, i noticed.
19  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-28 15:01:36
I don't mean to sound harsh, but learning how stuff works first (instead of complaining that AWT buttons are buggy when you don't understand why they don't behave like you expect) is never a waste of time if you ask me... Understanding that you don't understand something is a good start.
I dont mean to sound harsh, but its very easy to say "Maybe you should read the tutorial". I could say that all the time even if i didnt know a thing.

Ok, if im drawing this string on the screen:
> g.drawString(""+checkbox.isVisible(),400,20);
and it draws
> true
but the checkbox is not on the screen (and its location is within the viewing area), what else am i supposed to do?
I could waste my time trying all the different things to make it appear or read the (300 page) swing tutorial, to find out after all that that it didnt help me, i would be forced to reinvent the wheel anyways. So thats what i done, i created my own checkboxes and buttons; works like butter.
Because reinventing the wheel is just efficient.
Yeah, i agree, more efficient than reading a tutorial.  Roll Eyes
20  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-27 22:41:11
You might want to go through the Java Tutorial on AWT (or even Swing)
Well, i dont wanna waste time, designing buttons and checkboxes from ground up is much faster and more objective.
Anyways, i just wanted to see if other people had those problems and what they used to deal with them. I see that not many people are using AWT in applets, for obvious reasons...  Undecided
21  Game Development / Newbie & Debugging Questions / Re: AWT stuff is not reliable on: 2008-02-27 22:07:25
I wish i could, its over 1000 lines. I couldnt replicate it on a small scale. I mean there is gotta be something buggy about Buttons and other stuff just because their positioning and resizing has to be done in run() method. So if i put this in init() method:
cb1=new Checkbox("Checkbox1");
cb2=new Checkbox("Checkbox2");      
cb3=new Checkbox("Checkbox3");
b1=new Button("Button1");
b2=new Button("Button2");
b3=new Button("Button3");
cb1.setLocation(20,20);            // has no effect
cb2.setLocation(20,40);// has no effect
cb3.setLocation(20,60);// has no effect
b1.setLocation(100,20);      b1.setSize(80,20);// has no effect
b2.setLocation(100,50);      b2.setSize(80,20);// has no effect
b3.setLocation(100,80);      b3.setSize(80,20);// has no effect

It wont do what it is supposed to do. But ok, i position/resize them in run() method and it works fine, but making them show up when i want to is beyond me.
Another example:
I load the applet in IE first time, in the code i resize and reposition 2 buttons, they show up in wrong places. So i click the first button, this should make 4 checkboxes appear, they do.
The second time i load it in IE, the 2 buttons are in the right positions and of the right sizes. So i click the first button, and the 4 checkboxes do not show. I guess its like drawing the same picture twice, they'll always be different.
I woulda created my own buttons and checkboxes only i think i shouldnt have to.
22  Game Development / Newbie & Debugging Questions / AWT stuff is not reliable on: 2008-02-27 17:19:28
Im using AWT buttons and checkboxes in an applet. Often the AWT components do not show, even though they are set on visible. I tried everything including moving them around, enabling them (setEnable()), repainting them in different places... Nothing works.  Angry

23  Discussions / Miscellaneous Topics / Re: Need a small portable IDE on: 2008-02-19 23:29:59
I dont work with projects, i work with classes. I have a folder saved on my flash drive which contains .java files with folders of music and images. I dont think NetBeans or Eclipse can do what i need, i. e. compile those files in one click.
If someone has a small portable IDE, please share...  Sad
24  Discussions / Miscellaneous Topics / Need a small portable IDE on: 2008-02-19 21:57:20
Ok, basicly im working at home and often in my school computer's lab. At home i use JCreator, but the computer lab only got NetBeans which is total overkill. Whenever i want to compile something it asks me to create a project with 1000 fields i have to fill out and then it creates 1,000,000 folders with useless stuff in it, and it wont run or compile a ****... An easier workaround is to copy the entire JDK derictory and use command line. But that too takes a long time. So what i need is a small IDE that i dont have to install (actually i cant install anything on my school's computer), preferably a JAR under 5MB. What i need it to do is to compile .java files and run them. Of course im asking a lot since the only IDE that can compile and run properly is JCreator, but there must be something else out there that is more portable and doesnt require creation of projects, enterprises or what not...
The closest thing i found was Jipe. Of course it has an atrocious editor and its compiler is stupid (it can compile nothing if its super-derictory contains spaces), but if the super-derictories dont have spaces it compiles fine. Yet it wont run (so every time i gotta drop those classes in an executable JAR and deploy the jar instead). There gotta be an easier way to compile .java files into .class files and run them, which is all i need.
25  Game Development / Newbie & Debugging Questions / Re: Accessing classes on: 2008-02-17 03:19:19
Whenever i try using packages, Java starts "losing" classes. Once i tried using EasyOgg package and it didnt work, so i ended up extracting all the stuff and putting it next to main class. Ugly but works.  Roll Eyes
26  Game Development / Newbie & Debugging Questions / Re: Accessing classes on: 2008-02-17 02:39:24
Oh... ok. Im better at summersaulting than using packages, but thanx anyway. It shouldnt affect performance if all those classes are put in this ugly fashion, should it?
27  Game Development / Shared Code / Sound library-thing for noobs on: 2008-02-17 02:29:13
Being a noob myself, I dislike the way java uses sounds; its way to complex especially for beginners. Normally, a novice game developer wants to know as much about the way sounds work as a sea turtle about life on Mars. So i made my own Sound library-thing that can play, loop and stop .ogg, .wav, .au, and .mid sounds without any brain busting. Example:
Sound sound1=new Sound("theme.mid"), sound2=new Sound("explosion.ogg"),sound3=new Sound("shotgun.wav");

Here is the zip folder:
All you have to do is put all the contents next to your .class files and it should work. Also works if u use a jar. You dont have to import anything or use try-catch blocks. I apologize if i massacred conventions of using packages, classes, etc or if this is not exactly "shared code".
28  Game Development / Newbie & Debugging Questions / Re: Accessing classes on: 2008-02-17 00:06:56
Hmmm... it works when this folder is in the same derictory as the main class. But it doesnt work when the folder is in a JAR. I have to place all those classes next to the main class inside the JAR then it works.
29  Game Development / Newbie & Debugging Questions / Accessing classes on: 2008-02-16 23:53:23
I have a folder with a bunch of classes next to my main class. How would i access those classes? Is it possible?
30  Java Game APIs & Engines / Java Sound & OpenAL / Game behaves weird when sound is playing on: 2008-02-16 02:50:55
Here is my Sound class (im completely clueless of what all this stuff means).
class Sound{
   private AudioFileFormat baseFileFormat;
   private AudioFormat baseFormat,decodedFormat;
   private AudioInputStream din,in;
   private AudioFileFormat.Type type;
   private float frequency;
   public Sound(String filename){
         baseFileFormat = AudioSystem.getAudioFileFormat(new File(filename));
      }   catch(UnsupportedAudioFileException ex){
         System.out.println("Audio File not Supported");  
      }   catch(IOException ex2){}
      baseFormat = baseFileFormat.getFormat();
      type = baseFileFormat.getType();
      frequency = baseFormat.getSampleRate();
         in= AudioSystem.getAudioInputStream(new File(filename));
      }   catch(UnsupportedAudioFileException ex){}
         catch(IOException ex2){}
      din = null;
      baseFormat = in.getFormat();
      decodedFormat =new AudioFormat(AudioFormat.Encoding.PCM_SIGNED,
                    baseFormat.getChannels() * 2,
      din = AudioSystem.getAudioInputStream(decodedFormat, in);
   public void play(){
         rawplay(decodedFormat, din);
      }   catch(LineUnavailableException ex){}
         catch(IOException ex2){}
   public void stop(){
      }   catch(IOException ex2){}
   private void rawplay(AudioFormat targetFormat,AudioInputStream din)
         throws IOException, LineUnavailableException{
       byte[] data = new byte[4096];
        SourceDataLine line = getLine(targetFormat);
        if (line != null){
          int nBytesRead = 0, nBytesWritten = 0;
          while (nBytesRead != -1){
              nBytesRead =, 0, data.length);
              if (nBytesRead != -1)
               nBytesWritten = line.write(data, 0, nBytesRead);
   private SourceDataLine getLine(AudioFormat audioFormat) throws LineUnavailableException{
        SourceDataLine res = null;
        DataLine.Info info =
          new DataLine.Info(SourceDataLine.class, audioFormat);
        res = (SourceDataLine) AudioSystem.getLine(info);;
        return res;

When i try playing a sound with it, the game freezes untill the sound stops playing. When i try playing it again, it wont play. The stop() function does not stop the sound. I have another question: how would i implement loop() function (one that works properly). To make long story short: is there a library-thingy for a java application which provides play(), stop() and loop() functions?  Sad
Pages: [1] 2 3

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (31 views)
2014-04-15 18:08:23

BurntPizza (28 views)
2014-04-15 03:46:01

UprightPath (43 views)
2014-04-14 17:39:50

UprightPath (26 views)
2014-04-14 17:35:47

Porlus (42 views)
2014-04-14 15:48:38

tom_mai78101 (64 views)
2014-04-10 04:04:31

BurntPizza (124 views)
2014-04-08 23:06:04

tom_mai78101 (223 views)
2014-04-05 13:34:39

trollwarrior1 (190 views)
2014-04-04 12:06:45

CJLetsGame (198 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30 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‑
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!