Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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 / Making executable file.... on: 2007-03-09 18:15:09
Is there any way or application that can make an executable file even without jar files???

Need links...

Thnx..
2  Game Development / Newbie & Debugging Questions / Re: Kevglass TileMaze please help... on: 2007-03-09 06:26:10
Thnx Kova and bleb, I'll try what you'd said...!!! i get no exception!!!
3  Game Development / Newbie & Debugging Questions / Re: Kevglass TileMaze please help... on: 2007-03-08 15:33:17
 This two doesn't work after i call it from my MainMenu class....



Quote
      this.addKeyListener(board);
quote]container.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });[/quote]



Any suggestions or links for an alternative in making GUI?Huh
4  Game Development / Newbie & Debugging Questions / Re: Kevglass TileMaze please help... on: 2007-03-08 09:35:36
Now, i got one more problem... When i enter into the game class out from my mainmenu class, the game itself somehow lose the focus of keyboard.... The keyboard which controls my entity doesn't work....

Other entities like those zombies were working but only the main character that doesn't who needs keyboard inputs...

Please tell me what can be the possible cause.....

Thnx
5  Game Development / Newbie & Debugging Questions / Re: Kevglass TileMaze please help... on: 2007-03-06 03:26:06
I think the problem is in my Game Class....  because I already have a JFrame in my MainFrame class. So, when i call Game Class from my MainFrame class the drawing became distorted and the controls for the entity also doesn't.... Maybe converting my Game class into a JPanel will work.. But the problem is Game class extends Canvas.... Is it possible to place a Canvas over a JPanel???

I don't understand this lines:::

JPanel panel = (JPanel) container.getContentPane();
setIgnoreRepaint(true);
requestFocus();
      createBufferStrategy(2);
      strategy = getBufferStrategy();



public Game()  {
      JFrame container = new JFrame("CSCI15");
      JPanel panel = (JPanel) container.getContentPane(); // I don't know what this exactly do...
      board = new Keyb();
      panel.setPreferredSize(new Dimension(800,600));
      panel.setLayout(null);
      setBounds(0,0,800,600);
      panel.add(this);
      setIgnoreRepaint(true); -- What's this for???
      container.pack();
      container.setResizable(false);
      container.setVisible(true);
      container.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });

      this.addKeyListener(board);
      requestFocus();
      createBufferStrategy(2);
      strategy = getBufferStrategy();

      initEntities();     
   }
6  Game Development / Newbie & Debugging Questions / Kevglass TileMaze please help... on: 2007-03-05 03:16:05
Quote
I'm working on a maze game from kevglass tutorial.. Now, i came working to the Main menu.... My problem is when i click my Start button to access the game class it loads the game but the game was distorted and the keyboard doesn't work... Please my code for MainMenu and Game class.....

MainMenu class
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.lang.*;


public class MainMenu extends JFrame implements ActionListener {
    private JButton b1, b2, b3;
   private JLabel label1;

    public MainMenu() {
        super("Maze Game");
     
        Container contentPane = getContentPane();
        contentPane.setLayout(null);
        b1 = new JButton("Start Game");
        b1.setActionCommand("start");
        contentPane.add(b1);

        b2 = new JButton("Help");
        b2.setActionCommand("help");
        contentPane.add(b2);

        b3 = new JButton("Exit");
        b3.setActionCommand("exit");
        contentPane.add(b3);

        ImageIcon icon = new ImageIcon("background.jpg");
        label1 = new JLabel(icon);
        contentPane.add(label1);
                                             
        Insets insets = contentPane.getInsets();
        label1.setBounds(0, 0, 640, 480);

        b1.setBounds(15 + insets.left, 5 + insets.top,   105, 22);
        b2.setBounds(15 + insets.left, 35 + insets.top,  105, 22);
        b3.setBounds(15 + insets.left, 65 + insets.top,  105, 22);
                                                                                       
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
       
        setSize(640,480); 
        show();
 
    }

    public void actionPerformed(ActionEvent e)
    {

        if (e.getActionCommand() == "start")
        {
          Game game=new Game();
          game.gameLoop();
        }

        if (e.getActionCommand() == "help")
        {   
           //
        }

        if (e.getActionCommand() == "exit")
        {
           System.exit(0);
        }
       
    }


    public static void main(String args[])
    {
       MainMenu mainmenu=new MainMenu();

        mainmenu.addWindowListener(new WindowAdapter(){
               public void windowClosing(WindowEvent e)
               {
                   System.exit(0);
               }
            }
        );
     }
}


Game Class

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.event.*;
import java.awt.image.BufferStrategy;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Font;
import java.util.Random;
import java.applet.AudioClip;
import java.net.URL;
import java.net.MalformedURLException;

public class Game extends Canvas {
   
   private BufferStrategy strategy;
   private ArrayList entities = new ArrayList();
   private Hero albert;
   private AlienEntity zomb1;
   private AlienEntity zomb2;
   private String message = "";
   public boolean waitingForKeyPress = true;
   private Keyb board;
   private Map map;
   private int fontSize = 30;   
          
   public Game()  {
      JFrame container = new JFrame("CSCI15");
      JPanel panel = (JPanel) container.getContentPane();
      board = new Keyb();
      panel.setPreferredSize(new Dimension(800,600));
      panel.setLayout(null);
      setBounds(0,0,800,600);
      panel.add(this);
      setIgnoreRepaint(true);
      container.pack();
      container.setResizable(false);
      container.setVisible(true);
      container.addWindowListener(new WindowAdapter() {
         public void windowClosing(WindowEvent e) {
            System.exit(0);
         }
      });

      this.addKeyListener(board);
      requestFocus();
      createBufferStrategy(2);
      strategy = getBufferStrategy();

      initEntities();      
   }

   public void startGame() {
      
      //startLoadingSounds();
      entities.clear();   
      initEntities();
      board.left = false;
      board.right = false;
      board.up = false;
      board.down = false;
      
      
   }
   
   public void initEntities() {
      map = new Map();
      albert = new Hero(this,"res/hero_down.gif", map, 5, 5);
      entities.add(albert);
   zomb1 = new AlienEntity(this,"res/zombie1.gif",map,15,14);
      entities.add(zomb1);
   
   zomb2 = new AlienEntity(this,"res/zombie1.gif",map,24,1);
      entities.add(zomb2);
      
//loopClip = soundList.getClip(chosenFile);
      
   }



   public void gameLoop() {
      boolean gameRunning = true;   
      while (gameRunning) {
          Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
          g.setColor(Color.black);
          g.fillRect(0,0,800,600);
             for (int p=0;p<entities.size();p++)
             {
                for (int s=p+1;s<entities.size();s++)
                 {
                   Entity me = (Entity) entities.get(s);
                   Entity him = (Entity) entities.get(p);
                   if (me.collidesWith(him))
                    {
                       me.collidedWith(him);
                       him.collidedWith(me);
                    }
                 }
             }


          map.paint(g);
          albert.paint(g);
          zomb1.paint(g);
          zomb2.paint(g);
          g.dispose();
          strategy.show();   
          try { Thread.sleep(100); } catch (Exception e) {}
          logicHero();
          logicAlien();
        }       
   }


   public void logicHero() {

      int dx = 0;
      int dy = 0;

      if (board.left) {
         dx -= 1;
      }

      if (board.right) {
         dx += 1;
      }
      if (board.up) {
         dy -= 1;
      }
      if (board.down) {
         dy += 1;
      }

      if ((dx != 0) || (dy != 0)) {
         albert.move(dx,dy);
      }
   }


   public void logicAlien() {
   
      Random randomNumbers = new Random();
      int dx;
      int dy;
//      dx =  ( randomNumbers.nextInt( 3 ) - 1);
//      dy =  ( randomNumbers.nextInt( 3 ) - 1);
//      dx =  ( randomNumbers.nextInt( 300 / 100 ) - 1);
//      dy =  ( randomNumbers.nextInt( 300 / 100 ) - 1);
      dx =  ( randomNumbers.nextInt( 30/10)-1);
      dy =  ( randomNumbers.nextInt( 30/10 )-1);
      zomb1.moveZ1(dx,dy);
      zomb2.moveZ1(dx,dy);
   }

   public void notifyDeath() {
      //code here   }

   public void notifyWon() {
      //code here   }   
   
}


Please i really nid help!!! Thnx!!!
7  Java Game APIs & Engines / J2ME / Re: Tamaguchi ( Digital Pet) on: 2007-01-30 23:57:52


Many Tanx...... ^_^
8  Game Development / Newbie & Debugging Questions / Maze Game on: 2007-01-22 17:10:18
Pls help!!
I have made two maps for my maze game separately but i didn't know how to
get through the second map after completing the first map...

What do you think can be the logic for that?

Tnx...
9  Game Development / Newbie & Debugging Questions / Embedding Flash to Java Application.... on: 2007-01-20 18:16:30
Do you guys have examples on how to use Flash to java application??

I want my flash movie to be as if the cinematic of my game...

Is there a way i can do this???

Need Help... Thnx
10  Java Game APIs & Engines / J2ME / Tamaguchi ( Digital Pet) on: 2007-01-18 16:28:37
Hi!

Im kinda beginner in JAVA and have some questions regarding
programs on mobile phones through J2ME.

The program is kind of a simulator or a game.
It's about taking care of a pet from its day born...(Tamaguchi-like game)

And i want my pet to Alarm me everyday to say,
Gud am, gud pm, and gud night every nth time...

I also wanted my pet to learn talking through my daily
messages i received in my phone...

Also, i wanted my pet to learn singing through the mp3's
saved in my phone...

Is it possible to access my phone memory and be use it
on my game?

Is it also possible to make an alarm even if the game isn't
activated?

Is it also possible to draw on the desktop of your cellphone?

Will my project be so ambitious for a beginner?Huh?

Sorry if the detailing is kinda poor. I have difficulty
using ENGLISH...

I want advices from those who already made like this..
And from those experts in J2ME..

Please, need  an expert..

Thnx!!
11  Game Development / Newbie & Debugging Questions / Re: How to create a simple maze ? on: 2007-01-12 18:15:19
You guys can use 0 and 1 to create walls... Examples you can represent 0 for a wall which passable or a 1 for a blocked wall....
You must create a grid of WIDTH X HEIGHT and then place those walls within the cells of those grids....
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.

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

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

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

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

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

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

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

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

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

CJLetsGame (211 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
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!