Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 / Game Play & Game Design / Re: Just something to think about while you go about your lives. on: 2013-06-21 10:20:44
I think this is a really interesting topic  Smiley
I suppose the only way that you make the player not want to win the game deliberately would be as you suggested, having a companion along the side, but with a twist  Wink. If you win the game the companion is lost and there is no way to have the same companion again(Random companions each time or something). Or that the game's an RPG and the world evolve as you play it and at the end the whole game saves gets erased. No one would want to erase a world which they created and influenced, thus the player will not want to win the game. Perhaps.
2  Game Development / Game Mechanics / Re: Inter-Entity Communication in an Entity System on: 2013-06-21 01:56:12
I think I'd personally use a solver class that does all the calculations in an update method. Also it'd have to contain all the lists and references to the entities. That's what I'd do. There might be a better way. Looking forward to hear from the rest about their methods.  Smiley
3  Game Development / Newbie & Debugging Questions / Re: Can someone tell me how to make a screen that I can use! on: 2013-06-17 20:09:08
What you had originally is a two-dimensional array. What you want to do is :
1  
int[] pixels1dim = new int[width*height];

And then you were right about the for loops. But inside the for loop you will have to use the
1  
pixels1dim[j * width + i] = color;

instead of
1  
pixels1dim[i][j] = color;

and again in the second loop
1  
2  
3  
4  
5  
6  
int[] pixels1dim = new int[width * height];
for(int j = 0; j< height;j++){
   for(int i =0; i< width;i++){
      pixels1dim[j * width + i] = pixels2dim[i][j];
   }
}
4  Game Development / Newbie & Debugging Questions / Re: Can someone tell me how to make a screen that I can use! on: 2013-06-17 19:22:43
I could explain to you what I know, but I'm bot that good at explanations  Grin
So I'll give to a link to where I learned that stuff back then : it's from the newboston (an excellent teacher)
http://www.youtube.com/course?list=ECFE2CE09D83EE3E28
have a look at the GUI tutorials. Starting from about lesson 51.
5  Game Development / Newbie & Debugging Questions / Re: Making a little library on: 2013-06-17 17:17:33
It's not tough as coding goes. But it certainly is more elegant if I could do what I originally wanted to do. I'll have to live with it thought  Emo
6  Game Development / Newbie & Debugging Questions / Re: Making a little library on: 2013-06-17 16:03:57
Man that's a shame. I will have to make int and double version of everything  Sad
Thank you for your replies though. You illuminated me  Cheesy
7  Game Development / Newbie & Debugging Questions / Making a little library on: 2013-06-17 14:11:59
Hello everybody  Cheesy
I'm trying to make myself a little collection of classes that are custom to my needs. I started making a couple like Vector and Point. The problem is I want to be able to use any data type that I want, double,  float, int etc. but I want to make one class that can do any of them. the problem would be the getters and setters as I would have to define what type I will return. Also I don't want to allocate memory for things that I won't be using in the instance of the class as it's pretty much useless. So my question is is there a dynamic way to get around this problem without something like the code below ?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
class Point{
  int nx,ny;
  double dx,dy;

  Point(int x, int y){
    this.nx = x;
    this.ny = y
  }

  Point(double x, double y){
    this.dx = x;
    this.dy = y
  }
}



Thank you in advance Smiley
8  Game Development / Newbie & Debugging Questions / Re: How to show the bullets on: 2013-06-16 19:01:50
Hello  Smiley
I'm quite a beginner myself so the way I show you might not be perfect.
You should make a Bullet class that holds the bullet information, like speed, position,image etc. and then in the player/spaceship you have a list of those bullets (List<Bullet> bulList) that you will add a new bullet to every time you fire using the bulList.add(new Bullet(param)). Now if I were you I'd make the class something like this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
class Bullet{
    final double SPEED = 2;
    double x,y;

    Bullet(int x, int y){
        this.x = x;
        this.y = y;
    }

    public void move(){
        //bullet goes up
       y -= SPEED;
    }

}


Now that is assuming that you are making a game like space invaders where the bullet goes up. Also you will need to draw the elements in that list every frame. Hope that helps  Grin
9  Game Development / Newbie & Debugging Questions / Re: Image Blurring (Bitwise) problem on: 2013-06-14 17:35:34
Oh I finally understand  Shocked
Thank you mate . That was very helpful  Smiley
10  Game Development / Newbie & Debugging Questions / Re: Image Blurring (Bitwise) problem on: 2013-06-14 17:14:35
My god ! It works  Cheesy
Thank you so much. However, what did we really do ? Why did we shift them first to the right and then to the left ? Why isn't it the same ? I'm guessing that the shifting was just for the masking "&" to work correctly (?). Also, why did we mask with "0xff = 255" on all the channels ? I mean why didn't we mask green with "0x00ff00" etc. ? Moreover the image kept getting darker when I blurred it, but that is something I think I can fix by myself. I know that's alot of question but bear with me  Roll Eyes
11  Game Development / Newbie & Debugging Questions / Image Blurring (Bitwise) problem on: 2013-06-14 15:21:57
Hi everybody  Grin
I'm not really new to the forum but that is the first time I'm posting something.
I have been working on a little project inspired by "Zen'a photo garden",and I need to blur the image in that project. So I decided to learn how to do blurring. I've searched for the algorithm and I think I understand it. However I have a problem with the color channels. Here is my code:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
public void blur(BufferedImage image) {
      //Note: the BufferedImage is of the type "INT_RGB"
     
      // set pixels
     int[] pixelData = image.getRGB(0, 0, image.getWidth(), image.getHeight(), null, 0, image.getWidth());
      //Second array so pixels don't get overwritten while still needing them
     int[] pixels = pixelData.clone();
     
      //main loop over pixels
     for (int n = 0; n < pixelData.length; n++) {
         //Separate channels
        int r = 0, g = 0, b = 0;

         //loops to get neighbor pixels in the x direction
        for (int i = -1; i < 1; i++) {
            //discarding exceptions for the first and last pixels
           try {
               r += (pixelData[n + i] >> 16) & 0xff0000;
               g += (pixelData[n + i] >> 8) & 0x00ff00;
               b += (pixelData[n + i] >> 0) & 0x0000ff;
            } catch (ArrayIndexOutOfBoundsException e) {
               
            }
         }
         
         //averaging the colors of the pixels
        r /= (3);
         g /= (3);
         b /= (3);
         
         //final pixel
        pixels[n] = r | g | b;
      }
     
      //writing pixel data to the image
     image.setRGB(0, 0, image.getWidth(), image.getHeight(), pixels, 0, image.getWidth());
   }


This is the method that I call to blur the image. As you can see (and I can't  Wink ) there is a problem with it. It outputs different colors even when I'm using black and white. I believe the mistake is in the bitwise operations. I've tried various methids to get it to work but with no avail  Sad .

If someone could explain to me what is wrong with my code and how can I solve it that would be great  Grin

PS: I know that this method only takes neighboring pixels in the x direction, and I'm planning to make it take circular shaped neighboring. But that is just for demonstration.
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.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!