Results 1 to 2 of 2
  1. #1
    haxic is offline Member
    Join Date
    May 2011
    Rep Power

    Default New Game Project

    Hi, I am currently working on a java game project, but need help understanding how to program it effectively.

    So far I've made a GameBoard with Pathing, Terrain, Units and Camera. Etc
    public class GameBoard extends JPanel {
    static Terrain terrain;
    static Pathing pathing;
    static Units units;
    static Camera camera;
    private VARIABLES;

    When the "game" starts up it generates a map by setting :
    for (int X = 0; X < MapSizeX; X++) {
    for (int Y = 0; Y < MapSizeY; Y++) {

    Then it generates Terrain where Obstacle-Blocks sets Pathing[X][Y]=1 where it etc loops X from positionX to sizeX

    Finally it add Units which works just like the Terrain.

    I can set the Camera to any unit and when I do the Camera will follow that Unit when it moves (The Unit is still in the middle of the screen while everything else is moving).

    I'm using Graphics2D to print graphics.

    Everything that happens in the game, both printing and logics, calculates every 10ms.

    The game "runs" perfectly with no bugs of any kind at all, but ofc, I can't do anything but explore the Terrain.

    That's info about the game. I don't know where to start now, with questions and such.

    What I wonder is etc how to effectively add a "Attack" mechanism to the game?

    Where should in the Game-Engine should I add the Attack-logics/calculations and where in the Unit class should I add Attack damage or Attack enable/disable?
    Or should I have all stats and flags inside the Unit class or should it go down in a class hierchy?

    And how do I setup the game-start? When I run the game I want to go to the Game Menu first. In that Menu I should choose start/load game. Should I use JFrame and switch between JPanels? How does it work?

    Just try to explain how you would do it, open a discussion. Im all ears and trying to learn!


  2. #2
    rdjava's Avatar
    rdjava is offline Member
    Join Date
    Jan 2011
    Rep Power


    I have just created a game engine called Easy Clip2D, I posted about it here It sounds like you have a good start here. But I will say there are a few things you must keep in mind, and also think as abstract as you can when creating objects, in most games you can define this abstract object as a Sprite, and a Player would be a Sprite object, a Bullet, would be a Sprite object, and so on. My game engine allows for programmers to define logic when a collision happens, I wouldn't create something called "Attack" because its not abstract enough to implement in other games. Easy clip also allows you to define your own collision algorithm by implementing the interface "Collision" and plugging it into the engine. Then the game engine follows that algorithm and then passes any objects that have collided to an abstract method in a Sprite object. Where any logic can then be carried out.
    So in short, keep everything expendable, abstract, and utilize the interface modifier to define methods for other objects.

    If you have any specific question i will be happy to help

Similar Threads

  1. New Game Project
    By haxic in forum Java Gaming
    Replies: 2
    Last Post: 06-02-2011, 03:27 AM
  2. Adding a project to an existing project
    By Seijuro in forum NetBeans
    Replies: 4
    Last Post: 08-08-2010, 11:15 AM
  3. Replies: 2
    Last Post: 08-05-2010, 05:49 AM
  4. open existing project project ..
    By itaipee in forum Eclipse
    Replies: 1
    Last Post: 12-28-2008, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts