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 (406)
games submitted by our members
Games in WIP (293)
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
1  Game Development / Newbie & Debugging Questions / What is wrong??? on: 2013-04-25 23:48:47
Hello,

I have this code:
System.out.println(((((25 * 1) / 100)) + 1) * 64);

it's returning 64 but it should return 80...

Why?


Tks, Joaogl
2  Games Center / WIP games, tools & toy projects / Re: State of Fortune on: 2013-03-26 21:34:04
Are u stupid right? If u are making a project and want to show to the community is to get the feed back... His running a full time server and his paying for it his working hard on this and u are screwing it! stop and think... would u like to have a person like u on your work?!
3  Games Center / WIP games, tools & toy projects / Re: State of Fortune on: 2013-03-26 21:24:15
Griefer attack again..... the same stupid... Pauler...

Ban him! if u dont have that in the game yet just use the server firewall to block any connections from his IP and add somehting very easy.. if the playername is pauler dont download the game or dont let him connect to the game....
4  Game Development / Newbie & Debugging Questions / Re: How to start with LWJGL physics. on: 2013-03-26 16:26:21
Thanks... Cheesy

I just sad 3D because I'm making a 3D game.. I've already made the basic movement stuff and the obj import with textures now to move on I need the physics so u guys recommended to start with 2D I will Cheesy

One more time thanks
5  Game Development / Newbie & Debugging Questions / How to start with LWJGL physics. on: 2013-03-26 15:38:41
Hello,

I'm thinking in start learning physics... I started to search stuff and I found lots of engines but I dont know that.... I want to make my own physics....

So if someone is able to tell me some guide lines to start learning... btw using 3D lwjgl...

Thanks.
6  Game Development / Newbie & Debugging Questions / Re: Files and resorces... on: 2013-03-26 15:27:28
Actually.. its working... thanks for the help guys!
7  Game Development / Newbie & Debugging Questions / Re: Files and resorces... on: 2013-03-26 15:26:11
I've already used or tryed to use the url and it works untill the method its called error: NullPointerException
8  Game Development / Newbie & Debugging Questions / Re: Files and resorces... on: 2013-03-26 15:22:41
using this method tells me "The constructor FileReader(InputStream) is undefined".

9  Game Development / Newbie & Debugging Questions / Files and resorces... on: 2013-03-26 15:04:48
Hello,

1  
2  
3  
4  
String objFilename = "/test.obj";
objFile = new File(objFilename);
fileReader = new FileReader(objFile);
bufferedReader = new BufferedReader(fileReader);


So with this is working.. but the File is in the res folder So e think I have to use something like getClass().getResource(objFilename);

but When I do that tells me "The constructor File(URL) is undefined" ... so how can I set this to work?
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: lwjgl textures on: 2013-03-25 16:06:30
Thanks I will.
11  Java Game APIs & Engines / Engines, Libraries and Tools / lwjgl textures on: 2013-03-25 14:48:52
Hello,

I'm trying to start a 3D game just for fun... And I've made a 3D model and load into Java using the LWJGL but I don't know how to set textures to this...
I've made a few testing projects where I added textures and I know how to do it but because this is a 3D model(btw made in Blender) how can I apply textures?

U can see my code here: https://github.com/joaogl/3DGameTextur/


Thanks Joao.
12  Game Development / Newbie & Debugging Questions / Re: Problem with KeyListener on: 2013-03-24 17:55:24
Quote
KeyEvent.VK_UP, is that the integer value of the "Up Arrow"-button?

Yes it is
13  Game Development / Newbie & Debugging Questions / Re: How to encrypt our code. on: 2013-03-24 04:01:21
lol... its to protect  the code.... its harder... and I dont encrypt it on the eclipse... only encrypted to the jar file...
14  Game Development / Newbie & Debugging Questions / How to encrypt our code. on: 2013-03-24 03:50:46
Hello, i would like to know how can we encrypt our code...

If someone knows please help me...
15  Game Development / Newbie & Debugging Questions / Re: Problem with KeyListener on: 2013-03-24 03:45:48
... They are the same... the diference is if its easier to work with or no....

All do the same thing.... but on yours u'll take more time to add new keys on it...
16  Games Center / WIP games, tools & toy projects / Re: State of Fortune on: 2013-03-24 00:38:32
Its easier to show u.. I'll be on the game till about 2 or 3 am and tomorrowI can stay a few hours... try to find me Cheesy
17  Game Development / Newbie & Debugging Questions / Re: if statment on: 2013-03-23 23:28:37
Thats right...... I always forget that.....
tks
18  Game Development / Newbie & Debugging Questions / if statment on: 2013-03-23 23:18:59
Ok... this is awkward but this is getting me cray but something is wrong and I can't see what its wrong...



1  
2  
3  
4  
5  
6  
7  
      System.out.println(getTime());   
      if (getTime() == getTime()) {
         System.out.println("WORK!!!!!");  
         brightness = -120;
      } else {
         System.out.println(getHour() + ":" + getMinutes() + ":" + getSeconds() + "-" + "00:00:00");            
      }


print:

1  
2  
3  
4  
5  
6  
00:00:00
00:00:00-00:00:00
00:00:00
00:00:00-00:00:00
00:00:00
00:00:00-00:00:00


getTime()

1  
2  
3  
   public static String getTime() {
      return getHour() + ":" + getMinutes() + ":" + getSeconds();
   }


Why its now getTime() == geTime?!?!?!
19  Game Development / Newbie & Debugging Questions / Re: Problem with KeyListener on: 2013-03-23 21:41:49
I didnt posted xD... I posted how to make it work how to define it not how to do the listener...

Any way I'm going to post it...

First u need to create a few variables...

1  
2  
   private boolean[] keys = new boolean[9000];
   public boolean up, down, left, right;


Then because its a key listener u have to have this methods:

1  
2  
3  
4  
5  
6  
7  
8  
        public void keyPressed(KeyEvent e) {
   }

   public void keyReleased(KeyEvent e) {
   }

   public void keyTyped(KeyEvent e) {
   }


now to make it easier lets do this:


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void keyPressed(KeyEvent e) {
      keys[e.getKeyCode()] = true;
   }

   public void keyReleased(KeyEvent e) {
      keys[e.getKeyCode()] = false;
   }

   public void keyTyped(KeyEvent e) {

   }


so like this now matter what key u want it will update all the keys.. when pressed and released...

so now to make this thing work u need a tick/update method...

1  
2  
3  
4  
5  
6  
   public void tick() {
      up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
      down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
      left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
      right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
   }


so like this to check if the key is pressed or no u just have to do:

1  
2  
3  
if (up) {
// do something
}


and to add more keys u just have to add them to the boolean:

1  
public boolean up, down, left, right, f1;


and add it on the tick method:

1  
2  
3  
4  
5  
6  
7  
   public void tick() {
      up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W];
      down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S];
      left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A];
      right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D];
      f1 = keys[KeyEvent.VK_F1];
   }


Like this is much more easy to have multiple keys....
20  Games Center / WIP games, tools & toy projects / Re: State of Fortune on: 2013-03-23 21:03:21
The game is perfect There are a few things I would add like the fov... for me its too small.... it looks like we are almost inside the objects... an option to change it it would be great...

There is a bug on the stairs lot all of them I think its only on the stone ones... not sure.. the stairs at i've tested are the castle ones
21  Game Development / Newbie & Debugging Questions / Re: Problem with KeyListener on: 2013-03-23 19:40:32
if you want there is a much easier way to make the keylistener if you want ask me ...
22  Game Development / Newbie & Debugging Questions / Re: Problem with KeyListener on: 2013-03-23 18:57:37
You have create the Kille class and its a a KeyListener thats what u know.. but the game doesn't know ... so you have to tell the game that the Kille class is a keylistener so to do that you have to add this:

1  
addKeyListener(kille)


in the main class so:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
   public GameLoop()
   {
      super("SuperFinalX");
      Container cp = getContentPane();
      cp.setLayout(new BorderLayout());
      JPanel p = new JPanel();
      p.setLayout(new GridLayout(1,2));
      cp.add(board, BorderLayout.CENTER);
      cp.add(p, BorderLayout.SOUTH);
      setSize(1280, 740);
      setResizable(false);
      setDefaultCloseOperation(EXIT_ON_CLOSE);
     
      runGameLoop();
      addKeyListener(kille)

   }


not sure But it should work...
23  Discussions / General Discussions / Re: Realm of the mad god on: 2013-03-23 16:35:45
tks
24  Discussions / General Discussions / Realm of the mad god on: 2013-03-23 16:31:32
Quick question is this game made in java?
http://www.realmofthemadgod.com/
25  Game Development / Newbie & Debugging Questions / Re: Applet dont stop! on: 2013-03-21 02:36:01
I've just updated my java so I think 7.17 and using chrome
26  Game Development / Newbie & Debugging Questions / Re: Applet dont stop! on: 2013-03-21 02:28:46
console:
Quote
Close
basic: Finished applet teardown

So yes it printed close so it reached the stop method on the applet clas..

btw the process is kill at about one minute after I closed the tab..
27  Game Development / Newbie & Debugging Questions / Applet dont stop! on: 2013-03-21 01:51:10
Hello,

When I open my applet as normal.. it starts the java process on the computer... but when I close the tab it keeps working the game... the process is not closed and if I open the page again the player is in the same place... so it keeps working on background


Why does this happen?

Applet code:

Quote
   private Game display = new Game();

   public void init() {
      setLayout(new BorderLayout());
      add(this.display);
      requestFocus();
   }

   public void start() {
      this.display.start();
   }

   public void stop() {
      this.display.stop();
   }

   public void destroy() {
      this.display.stop();
   }

stop code:

Quote
   public synchronized void stop() {
      SoundEffect.stopAll();
      if (!this.running) return;
      this.running = false;
      try {
         this.thread.join();
      } catch (InterruptedException e) {
         e.printStackTrace();
      }
   }
28  Java Game APIs & Engines / OpenGL Development / Using LWJGL Applets on: 2013-03-18 22:57:02
Hello,

I'm changing my 2D java game to use lwjgl but I'm having troubles using it has an applet...
Bellow its my current lwjgl Code and my old applet Code... how can I create the applet?

Code:

Quote
public class Game implements Runnable {

   public boolean running = false;
   private Thread thread;
   private Render render;
   private static String title = "Larry";
   public static int width = 1200;
   public static int height = width / 16 * 9;
   public static int scale = 1;

   public Game() {
      render = new Render();
   }

   private void init() {
      try {
         Display.setDisplayMode(new DisplayMode(width, height));
         Display.setTitle(title);
         Display.create();
      } catch (LWJGLException e) {
         e.printStackTrace();
      }

      glMatrixMode(GL_PROJECTION_MATRIX);
      glOrtho(0, width, height, 0, 0, 1.0f);
      glEnable(GL_TEXTURE_2D);
      glEnable(GL_COLOR_MATERIAL);
      //glEnable(GL_LIGHTING);
   }

   public void start() {
      running = true;
      thread = new Thread(this, "Display");
      thread.start();
   }

   public void run() {
      init();
      long lastTime = System.nanoTime();
      double ns = 1000000000.0 / 60.0;
      double delta = 0;
      long lastTimer = System.currentTimeMillis();
      int frames = 0;
      int updates = 0;
      while (running) {
         long now = System.nanoTime();
         delta += (now - lastTime) / ns;
         lastTime = now;
         if (delta >= 1) {
            update();
            updates++;
            delta--;
         }
         render();
         frames++;
         while (System.currentTimeMillis() - lastTimer > 1000) {
            lastTimer += 1000;
            System.out.println(updates + " ups, " + frames + " fps.");
            updates = 0;
            frames = 0;
         }
         check();
      }
      Display.destroy();
   }

   private void check() {
      if (Display.isCloseRequested()) running = false;
   }

   int px = 200, py = 150;
   int speed = 5;
   int bspeed = 10;
   boolean dir = false;
   int bx = 0, by = 200;

   private void update() {
      if (Keyboard.isKeyDown(Keyboard.KEY_UP)) py -= speed;
      if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) py += speed;
      if (Keyboard.isKeyDown(Keyboard.KEY_LEFT)) px -= speed;
      if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT)) px += speed;

      if (dir)
         bx += bspeed;
      else bx -= bspeed;
      if (bx < 0) dir = true;
      if (bx >= width - 20) dir = false;
   }

   
   
   private void render() {
      int size = 20;
      glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
      //glEnable(GL_LIGHT0);
      //glLight(GL_LIGHT0, GL_INTENSITY, FloatUtils.asFloatBuffer(new float[]{10f, 10f, 10f, 10.0f}));         
      //glLight(GL_LIGHT0, GL_INTENSITY, GL_INTENSITY);
      render.setColor(0.0f, 1.0f, 0.0f);
      render.tile(px, py, size);
      render.setColor(1.0f, 0.0f, 0.0f);
      render.tile(bx, by, size);
      Display.update();
   }

}


Old java applet that I used before switch to lwjgl:

Quote
public class LarryApplet extends Applet {
   private static final long serialVersionUID = 1L;
   private Game display = new Game();
   
   public void init() {
      Game.debugging = false;
      setLayout(new BorderLayout());
      add(display);
      requestFocus();
   }
   
   public void start(){
      display.start();
   }
   
   public void stop(){
      display.stop();
   }
}


How can I change the old applet code to start the lwjgl?
29  Game Development / Newbie & Debugging Questions / Re: Applet reload? on: 2013-02-15 01:42:07
What can I do to resolve this?
30  Game Development / Newbie & Debugging Questions / Re: Applet reload? on: 2013-02-14 20:28:11
<applet code="me.joaogl.road.applet.Applet" archive="Test.jar" width="800" height="600" >
<param name='cache_option' value='no'>
</applet>

BTW by pressing CTRL + F5 it reloads but keeps not updating the applet
Pages: [1] 2
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!
cubemaster21 (76 views)
2013-05-17 21:29:12

alaslipknot (89 views)
2013-05-16 21:24:48

gouessej (119 views)
2013-05-16 00:53:38

gouessej (113 views)
2013-05-16 00:17:58

theagentd (125 views)
2013-05-15 15:01:13

theagentd (112 views)
2013-05-15 15:00:54

StreetDoggy (156 views)
2013-05-14 15:56:26

kutucuk (178 views)
2013-05-12 17:10:36

kutucuk (178 views)
2013-05-12 15:36:09

UnluckyDevil (186 views)
2013-05-12 05:09:57
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

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.235 seconds with 20 queries.