Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (426)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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 / Re: Problems with Player Centering in Isometric Style Game on: 2014-04-01 02:44:04
Yeah you know what, I might have been making it more difficult than it needed to be. I do get how to translate it from map to screen, it was just trying to get it to stay centered in the middle of the screen and have the map move around him. It's actually an array of strings just for the background tiles such as grass and dirt rotated 45 degrees. Then, everything else such as trees will be loaded as objects from an array list. I'm gonna play around with it a some more since you got my head straightened out a little but could you give me an example of some more efficient data structures? I guess I could look it up as well.
2  Game Development / Newbie & Debugging Questions / Problems with Player Centering in Isometric Style Game on: 2014-03-30 18:18:38
OK, so I have the game working, and I'm drawing the isometric tiles to the screen alright, but now I can't figure out how to keep my character in the center tile of the screen.  

This kind of shows how the map would be rendered if not for the if statement limiting it to the red window.


So I guess like I said I can't figure out how to render the tiles around the player from the map array and have the player centered. Doing that in a regular tile game was easy.

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  
38  
39  
40  
41  
42  
43  
public void render(Graphics g)
   {
      g.setColor(Color.DARK_GRAY);
      g.fillRect(0, 0, windowWidth, windowHeight);
     
      for(int y = -(windowHeight / tile.height); y <  (windowHeight / tile.height) + 2; y++) // I have no idea of how I got the math for the x and y for loops but it works so far
     {
         for(int x = -tile.width; x < (windowWidth / tile.width) * 4; x++)
         {


            if(((x - y) * (tile.width / 2)) > (0 - tile.width) //This makes it only render the tiles that fit in the window
                 && ((x + y) * (tile.height/2)) > (0 - tile.height)
                  && ((x - y) * (tile.width / 2)) < windowWidth
                  && ((x + y) * (tile.height/2)) < windowHeight)

            {
               temp = new ImageIcon("sprites/Tiles/" + map[(keyCursorX + mapX) + 10][(keyCursorY + mapY) + 10] + ".PNG").getImage(); //The map is actually a array of strings for now but I might change it soon.

               g.drawImage(temp, ((x - y) * (tile.width / 2)), ((x + y) * (tile.height/2)), null); // Draws the sprite onto the canvas
                 
                  if(keyCursorX == x && keyCursorY == y)
                  {
                     g.drawImage(tileHighlight, ((x - y) * (tile.width / 2)), ((x + y) * (tile.height/2)), null); // This is actually want to be centered around
                 }
                 
                  for(GameObjects go : objects) // Extra objects...
                 {
                     if(x == go.x && y == go.y)
                     {
                        g.drawImage(go.sprite, ((x - y) * (tile.width / 2)), ((x + y) * (tile.height / 2)) - (go.sprite.getHeight(null) - (tile.height / 2)), null);
                     }
                     
                  }
            }
            mapX++;
         }
         mapX = 0;
         mapY++;
      }
      mapX = 0;
      mapY = 0;
   }


How I have it right now is just the character is represented as a green highlight around the tile. This has actually bothered me for over a week and I'm about to give up and go back to regular tiles. Any help would be appreciated.
3  Game Development / Game Play & Game Design / Re: Just something to think about while you go about your lives. on: 2013-12-21 21:22:30
I loved all the breaks you could do in Halo 2 (never tried the first). I found my own way out of several levels and it was so fun doing it. Games could be a little more fun if they didn't make them completely bullet proof but they have to be unintentional.... damn invisawalls and death berriers
4  Discussions / Miscellaneous Topics / Re: Starbound on: 2013-12-19 23:59:22
Great game that's for sure, especially after getting friends involved.
5  Game Development / Newbie & Debugging Questions / Trying to Simplify the Addition of New Objects to a Game on: 2013-12-19 03:50:41
I am thinking of restarting a game I was working on and I wanted it to be very easy to add new objects into the game without having to get into my code every time. In games with alot of tiles for the same kind of object how do people generally handle it? I was thinking if I had say a wall class, it would read from a txt file containing its name, location and other important attributes/rules.

For instance something like this for a water class.

water.txt

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
Name = "pond_tile"

Location = "forest" + "town"

Animate = "false"

Sprite = "pond_tile.png"
///////////////////////////////////////////////

Name = "river_tile"

Location = "forest" + "jungle" + "town" + "desert"

Animate = "true"

Sprite = "river_tile.png"


I think I want to get the core game out of the way and have just one type of tile for each class at the beginning. After the games how I want it I could pump out loads of tile types and biomes this way. Another benefit would be the ease of modding a game with a set up like this which I'd love to support. I was just thinking of ideas and kind of remember a game might have used something similar.... minecraft? A couple questions I have are "Is there better ways to do this?", "Any downsides?", "Have any of you used something similar", and "How did it work out for you?". Pretty broad topic, maybe could have been in Game Play and Design but am looking forward to any input.
6  Game Development / Game Play & Game Design / Re: Just something to think about while you go about your lives. on: 2013-12-19 02:52:28
Having something or someone that a player can grow attached to is probably one of the best ways.

Fallout 3
That option to go into the chamber instead of the girl in Fallout 3. I instantly sacrificed myself without a second thought and the game ended on me haha.

Dark Souls
The conclusion to Solaire's quest to find his sun if you didn't take the shortcut. That was probably one of the most painful especially since it was my first play through.

Also AC: Black Flag.
When you meet the merchant dude in the very beginning I was like this dude is gonna be my new best friend and was pissed when I didn't get a option to get his sugar.

I kind of play games by doing what I'd feel like I'd do in that situation, and do grow attached to alot of characters in games both intentional and unintentional characters. But at the same time I watched my siblings play games and they just kill everyone and what not so I can't say for sure if it can cause most people to turn away from an end to the game.
7  Discussions / General Discussions / Re: Running Jar with Unknown Publisher Blocked in Future Java Release on: 2013-10-18 05:03:52
I loved java but I think I'm done with it unfortunately. If java ever gets they're stuff together maybe I will possibly come back to it.
8  Game Development / Newbie & Debugging Questions / Re: Having Problems With The Key Listener on: 2013-09-20 03:36:20
Sweet thanks a lot seems like something I should have noticed...
9  Game Development / Newbie & Debugging Questions / Re: Having Problems With The Key Listener on: 2013-09-20 03:15:34
I was letting it bake in a little Wink. I'm just trying to move the the character and I have done it several different ways. Even had the keylistener in the player class with the code in the keypressed method and it still wasn't working. I'm just lost I don't really see much difference between the other games I was doing.
10  Game Development / Newbie & Debugging Questions / Having Problems With The Key Listener on: 2013-09-20 01:29:46
Man I spent hours scratching my head on this one. I have never had a problem with input before but I am kinda changing things up a little. Man I can't wait to stop letting myself get these irritating errors.

This is where I added it to the canvas.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public Main()
   {
      initGame();
     
      JFrame frame = new JFrame(gameMain.getName());
      frame.setIconImage(gameMain.setLogo());
      Canvas canvas = new Canvas();
      canvas.setPreferredSize(gameMain.getScreenSize());
     
      InputListener input = new InputListener();
      canvas.addKeyListener(input);
      canvas.addMouseListener(input);
     
      frame.add(canvas);
      frame.pack();
      frame.setVisible(true);
      canvas.setVisible(true);
      canvas.requestFocus();
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
      canvas.createBufferStrategy(2);
      buffer = canvas.getBufferStrategy();
   }


This is the simple code to move in my player class and I did import the inputlistener.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
   
public void input()
   {
      InputListener input = new InputListener();

      if(input.getKey() == "w")
         dir(0,-1);  
      if(input.getKey() == "a")
         dir(0,1);
      if(input.getKey() == "s")
         dir(-1,0);
      if(input.getKey() == "d")
         dir(1,0);
   }


Here is the InputListener class.

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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
package com.base.engine;

import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class InputListener implements KeyListener, MouseListener, MouseMotionListener
{
   Dimension mousePos;
   boolean clicked = false;
   boolean keyDown;
   boolean keyUp;
   String key;
   String tempKey;
   

   public Dimension mouseLoc()
   {
      return mousePos;
   }

   public void mouseMoved(MouseEvent e)
   {
      mousePos = new Dimension(e.getX(), e.getY());
   }

   public void mousePressed(MouseEvent e)
   {
      clicked = true;
   }

   public void mouseReleased(MouseEvent e)
   {
      clicked = false;
   }

   public void keyPressed(KeyEvent e)
   {
      keys(e.getKeyCode());
      keyDown = true;
   }

   public void keyReleased(KeyEvent e)
   {
      keyDown = false;
   }

   public void keyTyped(KeyEvent e)
   {

   }
   
   public void keys(int i)
   {
      if(i == KeyEvent.VK_A)
         key = "a";
      if(i == KeyEvent.VK_B)
         key = "b";
      if(i == KeyEvent.VK_C)
         key = "c";
      if(i == KeyEvent.VK_D)
         key = "d";
      if(i == KeyEvent.VK_E)
         key = "e";
      if(i == KeyEvent.VK_F)
         key = "f";
      if(i == KeyEvent.VK_G)
         key = "g";
      if(i == KeyEvent.VK_H)
         key = "h";
      if(i == KeyEvent.VK_I)
         key = "i";
      if(i == KeyEvent.VK_J)
         key = "j";
      if(i == KeyEvent.VK_K)
         key = "k";
      if(i == KeyEvent.VK_L)
         key = "l";
      if(i == KeyEvent.VK_M)
         key = "m";
      if(i == KeyEvent.VK_N)
         key = "n";
      if(i == KeyEvent.VK_O)
         key = "o";
      if(i == KeyEvent.VK_P)
         key = "p";
      if(i == KeyEvent.VK_Q)
         key = "q";
      if(i == KeyEvent.VK_R)
         key = "r";
      if(i == KeyEvent.VK_S)
         key = "s";
      if(i == KeyEvent.VK_T)
         key = "t";
      if(i == KeyEvent.VK_U)
         key = "u";
      if(i == KeyEvent.VK_V)
         key = "v";
      if(i == KeyEvent.VK_W)
         key = "w";
      if(i == KeyEvent.VK_X)
         key = "x";
      if(i == KeyEvent.VK_Y)
         key = "y";
      if(i == KeyEvent.VK_Z)
         key = "z";
   }
   
   
   public String getKey()
   {
     
      return key;
   }
   
   public boolean getKeyPress()
   {
      return keyDown;
   }

   @Override
   public void mouseDragged(MouseEvent e) {}
   @Override
   public void mouseClicked(MouseEvent e) {}
   @Override
   public void mouseEntered(MouseEvent e) {}
   @Override
   public void mouseExited(MouseEvent e) {}
}
11  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2013-09-20 00:53:39
....you were drunk when you wrote that? ahaha

Yeah it happens sometimes.
12  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2013-09-19 03:02:09
Oh man I have a bad habit of drinkin and goin on the forums persecutioncomplex it would be pretty cool if it helps out some. Haha I did get a medal out of it and it does seem like I was making sense enough. Also like I said if I actually get some time to myself I could start brainstorming ideas for your game.
13  Java Game APIs & Engines / OpenGL Development / Re: Problem Setting Up on: 2013-09-18 23:25:42
Alright well thanks guys for replying I finally found out what is going on with the drivers. There is something wrong with the latest catalyst drivers for some of these older cards. I got a 2012 version of catalyst control center and it cleared things up. Also for now I'm just gonna leave everything how he shows it. I don't really care much I just want to learn ideas on how to do rpgs along with using lwjgl other than me just bashing away at it on my own.
14  Java Game APIs & Engines / OpenGL Development / Re: Problem Setting Up on: 2013-09-18 23:11:05
Its from a tutorial so I don't really know. I have never even used java the way he does. He mad like 3 packages and several classes. He did kinda make the game engine separate though so I don't know.

http://www.youtube.com/watch?v=1eeWo9AVP_4
15  Java Game APIs & Engines / OpenGL Development / Re: Problem Setting Up on: 2013-09-18 22:48:17
Yes, actually I just tried to play another game that uses lwjgl and got the same error in the console.

My laptop has an ati radeon 4100m and I am having a hard time finding a driver for it. Toshiba only has a 2010 driver for my L505d - S5985.
16  Java Game APIs & Engines / OpenGL Development / Problem Setting Up on: 2013-09-18 22:32:09
Hi, I just started using LWJGL with eclipse recently and had no problem setting it up on my main computer but for some reason it is not working on my laptop. It's the same project and everything the only difference I could think of is my main computer is 64bit and my laptop is 32bit, not that I think it would make a difference. I installed LWJGL into my java folder in program files and added the library for the project including the natives so I am at a complete loss. Then I was like hey I'll just get all the stuff to make android games on my laptop and make java games on my other pc and that crap isn't working right either.... just my luck.

This is the compilation error.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
Sep 18, 2013 4:22:27 PM com.base.engine.Main initDisplay
SEVERE: null
org.lwjgl.LWJGLException: Pixel format not accelerated
   at org.lwjgl.opengl.WindowsPeerInfo.nChoosePixelFormat(Native Method)
   at org.lwjgl.opengl.WindowsPeerInfo.choosePixelFormat(WindowsPeerInfo.java:52)
   at org.lwjgl.opengl.WindowsDisplay.createWindow(WindowsDisplay.java:252)
   at org.lwjgl.opengl.Display.createWindow(Display.java:306)
   at org.lwjgl.opengl.Display.create(Display.java:848)
   at org.lwjgl.opengl.Display.create(Display.java:757)
   at org.lwjgl.opengl.Display.create(Display.java:739)
   at com.webs.burningtreegames.engine.Main.initDisplay(Main.java:83)
   at com.webs.burningtreegames.engine.Main.main(Main.java:22)

Exception in thread "main" java.lang.RuntimeException: No OpenGL context found in the current thread.
   at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
   at org.lwjgl.opengl.GL11.glMatrixMode(GL11.java:2073)
   at com.webs.burningtreegames.engine.Main.initGL(Main.java:68)
   at com.webs.burningtreegames.engine.Main.main(Main.java:23)


Throw in the main class from the tutorial I'm doing and like I said its the same as on my gaming pc.

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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
package com.base.engine;

import java.util.logging.Level;
import java.util.logging.Logger;

import org.lwjgl.LWJGLException;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import com.base.game.GameMain;

import static org.lwjgl.opengl.GL11.*;

public class Main
{

   private static GameMain gameMain;
   
   public static void main(String[] Args)
   {
      initDisplay();
      initGL();
      initGame();
     
      gameLoop();
      cleanUp();
   }
   
   private static void initGame()
   {
      gameMain = new GameMain();
   }
   
   private static void gameLoop()
   {
      while(!Display.isCloseRequested())
      {
         getInput();
         update();
         render();
      }
   }
   
   private static void getInput()
   {
      gameMain.getInput();
   }

   private static void update()
   {
      gameMain.update();
   }
   
   private static void render()
   {
      glClear(GL_COLOR_BUFFER_BIT);
      glLoadIdentity();
     
      gameMain.render();
     
      Display.update();
      Display.sync(60);
   }
   
   private static void initGL()
   {
      glMatrixMode(GL_PROJECTION);
      glLoadIdentity();
      glOrtho(0,Display.getWidth(),0,Display.getHeight(),-1,1);
      glMatrixMode(GL_MODELVIEW);
     
      glDisable(GL_DEPTH_TEST);
     
      glClearColor(0,0,0,0);
   }
   
   public static void initDisplay()
   {
     
      try {
         Display.setDisplayMode(new DisplayMode(800,600));
         Display.create();
         Keyboard.create();
         Display.setVSyncEnabled(true);
      } catch (LWJGLException e)
      {
         Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, e);
      }
   }
   
   private static void cleanUp()
   {
      Display.destroy();
      Keyboard.destroy();
   }
}
17  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2013-09-10 05:55:05
I was checking up to see how your game was going and saw that you may need a little help. I feel you on how you are having problems finishing your game (I don't think I completed a single full featured game). You may have heard some of this stuff before but maybe something might help.

Your problem seems to be coming up with ideas and less on implementation. I have it the other way around which results to frustration on not being able to implement my ideas. I will think about coming up with a story but I'd like at least some idea of what you'd like. Something I would recommend is to keep a notebook or a small journal with you to write down ideas. Simple, stupid, and it every one stresses this even for all types of hobbies n stuff, but it does work and will hopefully help. You said you are not a big gamer but if you watch tv shows, movies or do play that occasional game think of what you like about it. Is it the story, atmosphere, weapons, customization, gameplay, tactics and what not. What genre do you enjoy? Do you like action for more intense play, comedy bringing a lighter side to the game, horror with demons and zombies and stuff, or even romance. Try breaking down the plot into a simple form of whats going on. Keep that notebook near your bed and make sure you have a pen so your not trudging through your house looking for one when you got that aha moment before you fell asleep.

Just think of how many shows and games use these same ingredients over and over again. \/\/\/

Mario = Fight your way to save the princess

Die Hard = Fight your way to defeat the main antagonist

Clue = Find out who committed the crime with the evidence you gather

One of my all time moments was going into vaults for the first time in fallout 3. Figuring out what has happened to a environment where its inhabitants are missing or changed in some ways is what really got me. Particularly that one that was an experiment to test the inhabitants reactions being givin psychedelics without them knowing and finding out what happens to when the vaults order of power starts breaking down and everyone starts going insane. Man, seeing the hallucinations and realizing its effecting you too was one of my all time favorites in a game. Another one at the top would be vault 11 in New Vegas (wont spoil since its the latest one and is really good) particularly the super vague conclusion of the whole vault which may have gone under the radar and you'd never have a second thought. If you never plan on playing I suggest looking that one up. I spent hours looking all over when I found out  Smiley.

Writing a story about something you like is important because you are going to be the one spending your time building the game around it and spending a whole lot of time play testing. Even if someone hands you a story for your game and you use it just because its all you got. Do you want to spend all that time and frustration going into something you don't care much about. Another thing is to build up excitement (even if it is faked) whenever you can to help you push forward to finish. Try and make writing dialog for all those npcs a big triumph or better yet make even creating one have that same feeling. Showing family, friends, and even people on random forums  Roll Eyes will help you keep from dropping everything. Also while your at it ask them what they think and ask if there is anything they think should be in the game or what kinda of stuff they like in general. Also I am one of those guys that will say not try to do something new until you get several games under your belt especially when it comes to games with alot of substance like rpgs, it'll break you like me and so many others. Another thing is to try keeping away from the idea of minecraft cause a game like that is hard to get right since it is almost solely based on crafting and it is up to the player to get the fun out of it. Also I feel that unless it continually gets updates or has multiplayer it gets old pretty quick.

Like I said if I come up with an idea I'll let you know if you are still working on it. I have/ had the hardest time finishing games and coming up with ideas which lead me to reading up alot on it. So hopefully you got something useful out of all this also don't give up the game looks great so don't let this one go man.
18  Game Development / Newbie & Debugging Questions / Re: Errors Using the Diamond Square Algorithm on: 2013-08-04 01:10:49
I probably will end up using it at some point its just a little beyond me at the moment.
19  Game Development / Newbie & Debugging Questions / Errors Using the Diamond Square Algorithm on: 2013-08-04 00:35:30
Hello, I have been working on making random maps and am having a problem with my code. I decided to put the diamond step in a try and catch so if its doing a point next to the edge it will switch to doing 3 known points. Its not working for some reason and I'm not grasping why. Its when I use map[x - midX][y] thats the problem. If I take out the try catch and just use all the alternative ones it works but has some artifacts. I got some code and pictures. Also I wonder why the stupid thing only has water coming from the left in every one I open. Any help will be much appreciated.

http://pastebin.java-gaming.org/d3d42676f69

This what it looks like using 3 points


What happens when I add a fourth
20  Discussions / General Discussions / Re: XBox One on: 2013-05-26 00:39:24
Man I hope we don't need to be logged into the net to use it that would be terrible. Screw it I'm just sticking with my computer... running windows 7 uhhh.

we need more run and gun FPSes like Doom. Also I wish they hadn't canceled Star Wars BattleFront III. it promised to be good.
OMG was that gonna happen at some point, man I loved those games. I Just checked out the gameplay for that and oh man I would of bought that right away.
21  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2013-05-25 23:13:20
Cool sounds like you got quite a thing, can't wait to see more. Are those your own sprites or did you barrow them? If they're not, don't worry about it until later I was just curious. Haha, I swear I spent a week making a tileset that I'm not even gonna use yet because I'm having mixed feeling about it being a ASCII game or not. I can't wait to get mine where its presentable, right now I'm kinda struggling getting the core of the game where I want it to be. Redid the engine like 3 or 4 times and now I might redo it again (uhh) its because I kinda want to use the same engine for multiple different game types.
22  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2013-05-25 15:06:41
Looks really good. Are you gonna be keeping the farming, mining and all that?
23  Games Center / WIP games, tools & toy projects / Re: 2d RPG with no name... on: 2013-05-24 04:15:49
Thanks for that I'll be sure to give it a go soon. What do you think about Lodescape for a name?
Oooooh nice
24  Games Center / WIP games, tools & toy projects / Re: 2d RPG with no name... on: 2013-05-23 10:31:24
Fixed the code and put it back up top. Have you thought about any names yet. Leerscape, Uscape(theres a youscape game so Idk), Graycastle, Hiemlease, Grass and Fire(I'm thinkin make a volcanic lookin region or not it doesn't have to make sense). Googled to see if they were used yet and they are not. Now say "the Game" after each one Grin. I like coming up with names just thought of the first two since you said it was gonna be a bit like runescape. By the way I like the farming thing you got going on there.
25  Games Center / WIP games, tools & toy projects / Re: 2d RPG with no name... on: 2013-05-22 07:05:18
I really like the idea of the game and it looks pretty cool. I know they aren't really meant for your game but just make the creepers hone in on you and explode when close  Grin

I'm pretty sure this would be simple enough to add. Its from my current tile based game I'm working on and I doubt its the first somebody did this but I came up with it myself (made one of those minor hurray moments). I'm not sure if you are already adding something but I noticed they weren't following me when I was playing.

Edit* Redid it how Jimmt said I should  Smiley   -Took out the comments though hope it still makes sense enough
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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
   public void tick()
   {  
      if(npcSleep > 50)
      {
         npcMovement();
         npcSleep = 0;
      }npcSleep++;
   }

   public void npcMovement()
   {
      int distFromPlayer = (npcX + npcY) - (PlayerChar.playerX + PlayerChar.playerY);

      if(Math.abs(distFromPlayer) < 15 && Math.abs(distFromPlayer) > 5)
      {
         npcChase();
      }else{
         npcRandomMove();
      }

      if(npcMoved && GameMain.tiles.walkable(WorldGen.block[npcX + xDir][npcY + yDir].blockType))
      {
         updateNPCPos(xDir, yDir);
         xDir=0;
         yDir=0;
         npcMoved = false;
      }
   }

   public void npcRandomMove()
   {
      xDir = (new Random().nextInt(3)) - 1;
      yDir = (new Random().nextInt(3)) - 1;
   }

   public void npcChase()
   {
      if(npcX + (new Random().nextInt(20) - 10) < PlayerChar.playerX + (new Random().nextInt(20) - 10)) // I added Random to these so that they dont travel in strait line
        xDir++;
      if(npcX + (new Random().nextInt(20) - 10) > PlayerChar.playerX + (new Random().nextInt(20) - 10)) // 20 - 10 is more of a loafing around kind of feel
        xDir--;
      if(npcY + (new Random().nextInt(20) - 10) < PlayerChar.playerY + (new Random().nextInt(20) - 10)) //change to something like 4 - 2 for a more direct chase down
        yDir++;
      if(npcY + (new Random().nextInt(20) - 10) > PlayerChar.playerY + (new Random().nextInt(20) - 10))
         yDir--;
   }
26  Game Development / Game Mechanics / Re: Need Help With My 2D Tile Engine on: 2013-05-22 00:58:16
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.
27  Game Development / Game Mechanics / Re: Need Help With My 2D Tile Engine on: 2013-05-21 18:49:47
I'm going to be trying to fix this still but I'm going to need you to elaborate a little more as well. So make a separate class with a method that can check the age and determine what it should be if it returns true make a new block with the type and attributes? And have it in the for block, in the worldmap.render method?

I guess I don't need to inherit Rectangle since I usually had the x , y of the for loop to choose which block, and moved the blocks real chords by adding the tilesize.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   int moveX = 0, moveY = 0;
   for(int y = (PlayerChar.playerY - GameMain.yBuff) + 1; y < PlayerChar.playerY + GameMain.yBuff + 5; y++)
   {
      for(int x = (PlayerChar.playerX - (90/Tiles.tileSize)/2)- GameMain.xBuff; x < PlayerChar.playerX + GameMain.xBuff - ((90/Tiles.tileSize)/2) + 5; x++)
      {
         GameMain.tiles.drawTile(g, moveX, moveY, map[x][y]);
         moveX += Tiles.tileSize;
      }
      moveX = 0;
      moveY += Tiles.tileSize;
   }


The rectangle thing sounded neat but I guess its the same thing maybe.
28  Game Development / Game Mechanics / Need Help With My 2D Tile Engine on: 2013-05-21 16:50:33
Alright I have redid my game engine twice now. First it was stored in a array of ints, then strings, and now its an array of the block class. But I hit a couple snags. It won't show any tiles when I make a view port around my character and I have a feeling it is similarly related to why no blocks show up after the dirt ages and turns into grass. I was watching a tutorial on making a platformer and saw a guy use a block class that extended rectangle and I thought I could get more functionality of the blocks this way. Now each is able to age and store data that I couldn't do before. Like I've said I have done tile maps before but I never tried with this approach.

This is my WorldGen code with it actually showing tiles and the render method down there has the commented out view port code that doesnt work for whatever reason.
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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
;

import java.awt.Graphics;
import java.awt.Rectangle;

public class WorldGen{
   
   byte tileSize = 25;
   int worldSize = 1000;
   
   Block[][] block = new Block[worldSize][worldSize];

   
   public WorldGen()
   {
      for(int y = 0; y < worldSize; y++)
      {
         for(int x = 0; x < worldSize; x++)
         {
            block[x][y] = new Block(new Rectangle(x * tileSize, y * tileSize, tileSize, tileSize), "dirt"); // Makes all blocks dirt
        }
      }
   }
   
   public void tick() //Updates blocks I didn't check to see if this worked or not and im sure the little buffer to updating the tiles around you might not work out so well
  {
      for(int y = PlayerChar.playerY - GameMain.yBuff - 20; y < PlayerChar.playerY + GameMain.yBuff + 20; y++)
      {
         for(int x = PlayerChar.playerX - GameMain.xBuff - 20; x < PlayerChar.playerX + GameMain.xBuff + 20; x++)
         {
            block[x][y].tick();
         }
      }
   }
   
   public void render(Graphics g)
   {
     
      for(int y = 0; y < 100; y++) //Kinda Working Graphics
     {
         for(int x = 0; x < 100; x++)
         {            
            block[x][y].render(g, x * tileSize, y * tileSize, tileSize, tileSize);
         }
      }
     
      /*for(int y = PlayerChar.playerY - GameMain.yBuff; y < PlayerChar.playerY + GameMain.yBuff; y++) // Not Working
      {
         for(int x = PlayerChar.playerX - GameMain.xBuff; x < PlayerChar.playerX + GameMain.xBuff; x++)
         {            
            block[x][y].render(g, x * tileSize, y * tileSize, tileSize, tileSize);
         }
      }*/

   }
   
   
}



Heres the block code I hope it makes sense but I never used things like set bounds before and what not so I could be not grasping how this all works at the moment. Have it go around 30 fps to 60 running it full tilt will make the grass grow way to quick.

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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;

@SuppressWarnings("serial")
public class Block extends Rectangle{
   
   int randomAgeModifier = new Random().nextInt(5000); // I try to make my variables very self descriptive
  int age = 0;
   String blockDescriptor = null;
   String blockType = null;
   
   public Block(Rectangle size, String type) // Constructor
  {
      setBounds(size);
      blockType = type;
      getDescriptor(type);
     
   }
   
   public void tick() //Updert
  {
      age++;
      age();
   }
   
   public void age() // Ages the tiles should make sense there is a random number tacked on so they dont all start poppin up at the same time.
  {
      if(blockType == "dirt" && age > (randomAgeModifier + 4000))
      {
         blockType = "grass";
         getDescriptor("grass");
         randomAgeModifier = new Random().nextInt(4000);
         age = 0;
      }else if(blockType == "grass" && age > (randomAgeModifier + 8000))
      {
         blockType = "denseGrass";
         getDescriptor("denseGrass");
         randomAgeModifier = new Random().nextInt(4000);
         age = 0;
      }      
   }
   
   public void getDescriptor(String type) //Gives a descriptor to the block so if I put them together with an examine option it would give somthing like You look at the green grass blah blah blah
  {
      switch(type)
      {
      case "dirt":
         this.blockDescriptor = "brown";
         break;
      case "grass":
         this.blockDescriptor = "green";
         break;
      case "denseGrass":
         this.blockDescriptor = "darkGreen";
         break;
      }
   }
   
   

   
   public void render(Graphics g, int x, int y, int width, int height) // Draws Blocks with custom colors.
  {
      switch(blockDescriptor)
      {
      case "brown":
         g.setColor(GameRender.brown);
         break;
      case "grass":
         g.setColor(GameRender.yellowGreen);
         break;
      case "denseGrass":
         g.setColor(GameRender.grassGreen);
         break;
      }
     
      g.fillRect(x, y, width, height);
     
      g.setColor(GameRender.gridGray);
      g.drawRect(x, y, width, height); // Just makes a gray outline of each tile
  }
}
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 (72 views)
2014-04-15 18:08:23

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

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

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

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

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

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

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

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

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