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   
Pages: 1 [2] 3 4 ... 10
 11 
 on: 2013-05-22 00:58:16 
Started by hobbles - Last post by hobbles
Man wasted my time dickin around with this for a whole day.....

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
switch(blockDescriptor)
      {
      case "white":   // <<<<<< Color
        g.setColor(GameRender.white);
         break;
      case "brown": // <<<<<<< Color
        g.setColor(GameRender.brown);
         break;
      case "grass": // <<<<<<< A whole day wasted
        g.setColor(GameRender.yellowGreen);
         break;
      case "denseGrass": // <<<<<<< A whole day wasted
        g.setColor(GameRender.grassGreen);
         break;
      }


Duh x 2    My playerX and Y along with the buffers are divided by tileSize already, so I needed to use the moveX and Y that I showed earlier. I guess I just needed some sleep lol.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
int moveX = 0, moveY = 0; // Needed this afterall
for(int y = PlayerChar.playerY - GameMain.yBuff; y < PlayerChar.playerY + GameMain.yBuff; y++)
      {
         for(int x = PlayerChar.playerX - GameMain.xBuff; x < PlayerChar.playerX + GameMain.xBuff; x++)
         {  
            block[x][y].render(g, moveX, moveY); // Not block[x][y].render(g, x * tileSize, y * tileSize);
           moveX += tileSize; //Needed this too
        }
         moveX = 0; // <<< These too \/\/\/
        moveY += tileSize;
      }


Now to fix all my tiles for the old engine to work with the new one.

 12 
 on: 2013-05-22 00:57:57 
Started by InfiniteCoder - Last post by InfiniteCoder
I am using LWJGL, and am pretty new to it, so I'll learn some stuff. It also wont be dynamic. It will be a game which revolves underground with wall torches as light.

 13 
 on: 2013-05-22 00:56:18 
Started by InfiniteCoder - Last post by davedes
If you are using LibGDX there is Box2DLights which will make your life easier. If you are using LWJGL then you have to learn about glBlendFunc to achieve the lighting in your screenshots; or shaders. And it won't be "dynamic" in the sense that objects won't affect the light -- for that you need to use meshes or shaders.

 14 
 on: 2013-05-22 00:54:15 
Started by heisenbergman - Last post by xsvenson
JVisualVM is a decent profiler bundled with JDK since... I actually dunno when, I assume jdk5.
When optimizing or looking for performance gains in java land, one should defenitly start by running this tool.

Refactoring is an evolutionary step in the life of the code. There is the refactoring-at-large, which is an overhaul of the design which is a "stop-the-world" process. This is the kind of code maintenance the client doesn't want to pay for since there is no viewable, touchable benefit, except for the developer.
Then there is the lower refactoring, which is abstracting the code and removing duplications and general health level maintenance. This is the "runtime" proccess, where You can refactor the code while activly developing and as such I'm doing pretty much as soon as I see a need.

 15 
 on: 2013-05-22 00:51:20 
Started by InfiniteCoder - Last post by InfiniteCoder
I was watching https://www.youtube.com/watch?v=4BtjcH-iLR0 and he was explaining how a 2d shadow system would work.
I made a little image using minecraft textures in gimp and used the image mode 'Multiply' on it.
-=Without Light=-


-=With Light=-


-=Remember=-
Remember, these are just images, not the real game.

-=Need Help With=-
  • Texturing a light
  • Using the image mode 'multiply' to draw it

If you can help, that'd be great!

 16 
 on: 2013-05-22 00:35:30 
Started by Slyth2727 - Last post by Slyth2727
alright, got the left and right coded in, however for thrust should I do something along the lines of adding the angle of the ship to the velocity?

 17 
 on: 2013-05-22 00:29:54 
Started by Slyth2727 - Last post by Longarmx
I would have it set a Boolean to true when you press down a key. In your ship update loop, check if this Boolean is yes, then move in increments. Sorry, I'm not at my computer right now. Otherwise I would have elaborated and posted code.

 18 
 on: 2013-05-22 00:27:38 
Started by Slyth2727 - Last post by Slyth2727
Alright I finally did it! I'm learning a gaming library, libGDX, which I especially liked cause of the particles Wink I'm starting to love those puppies. Anyway, I am following the Dustin Riley tutorials, and I was wondering: How would I be able to, instead of having the spaceship have 8 positions (up right, up, lower right, etc) , be able to press and hold A or D and have the ship rotate accordingly as well as have it "thrust" when W is pressed. I have this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
   public boolean keyDown(int keycode) {
      ship = world.getShip();
      switch (keycode) {
      case Keys.W:
         ship.getVelocity().y += .1;
         break;
      case Keys.S:
         ship.getVelocity().y -= .1;
         break;
      case Keys.A:
         ship.getVelocity().x -= .1;
         break;
      case Keys.D:
         ship.getVelocity().x += .1;
         break;
      default:
         break;
      }
      return true;
   }

and obviously that doesn't work for so many reasons. I don't even know why I did it, I knew it was ridiculous. And I know about
1  
      Keyboard.enableRepeatEvents(true);

but is there a good way to achieve what I am trying?

EDIT:
Here's the ship class:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
package com.slyth.angrymasons.Models;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.math.Vector2;

public class Ship extends MovableEntity {

   public Ship(Vector2 position, float width, float height, float rotation, float SPEED) {
      super(SPEED, rotation, width, height, position);
   }

   public void update() {
      position.add(velocity.tmp().mul(Gdx.graphics.getDeltaTime() * SPEED));
      if (velocity.x != 0 || velocity.y != 0)
         rotation = velocity.angle() - 90;

      bounds.x = position.x;
      bounds.y = position.y;
   }
}

 19 
 on: 2013-05-22 00:08:29 
Started by germanyforwm - Last post by xsvenson
It might be a simplified view but my stance is like this:
If You don't know why to use UDP, use TCP. Once You have enough experience or You are hitting a problem, You will know which one is better for You and why.

 20 
 on: 2013-05-21 23:48:07 
Started by kutucuk - Last post by Jimmt
Yes, but when you use contactlistener it can only give you the fixtures/bodies that collide.

Pages: 1 [2] 3 4 ... 10
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks 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!
hobbles (7 views)
2013-05-22 00:54:55

cubemaster21 (74 views)
2013-05-17 21:29:12

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

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

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

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

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

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

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

kutucuk (175 views)
2013-05-12 15:36:09
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.115 seconds with 17 queries.