Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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 / Which is the "better" practice on: 2014-12-26 00:32:06
Hi guys,
when I was in school, I learnt that singletons are generally bad practice. Now I got some manager classes that handle my game states, input (game actions) and game related objects like group of enemies, items and animations.
I want to access them in every class (e.g. in a menu state where I need a localized string) but I don't want to parse my config in each state individually.
My first attempt was (obviously, I guess) a singleton. But the code ends up messy.
My second attempt was a static instance of my configuration in my game class. Is this a "better" practice? My code doesn't look as messy as with singletons.
1  
Game.colors.getIntegerProperty("font_highlight")

vs
1  
ConfigHandler.getInstance().getConfig("colors").getIntegerProperty("font_highlight")


Is there even a better attempt?

Thanks in advance!
2  Game Development / Game Play & Game Design / How to design a crowd-combat game like Dynasty Warriors on: 2014-11-06 16:16:33
Greetings!
Dynasty Warriors has a very special place in my heart. It has a very simple, yet quite unique game play and I have spent hours just mowing through enemy lines. But why do I see little to no clones of this rather old franchise?
I think I'm pretty naive (considering my current experience with 3d and AI and stuff), but I'd like to make a crowd-combat game myself. But here is the question: where do I start? How do I move dozen of units at the same time, fighting each other, taking objectives or flee from the overwhelming enemy force?
I'd like to use this threat for brainstorming. What techniques do I need to know for this kind of game?

My current ToDo/Need-to-Know list consist of these points:
- Move a given unit from point A to point B
Quite anticlimactic, I know, but everyone has to start litte. I got the idea behind A* but I'd like to make my game without any tiles. Maybe Theta*?

- Some sort of hierarchic AI
As I understand it, calculating dozen of dozen unit behaviors at the same time is slow. My idea is it, to make a hierarchic system. An AI-overmind assigns objectives to a few "general"-AIs. These assign their given troops to tasks that will ultimately lead to the assigned goal.
This would work quite well with the Dynasty Warriors theme: When a general or lieutenant is killed in combat, his assigned troops loose their objective and flee or fight without any tactic.

- I need a general grasp on military tactics
I never served and I loose to any easy AI in RTS games. I read in an article about the game AI of Total War, that the dev's used the book "The Art of War". Is this a good start?

- Terrain and objective generation
This is more basic stuff. I'll have to learn about perlin and his nousy behavior I guess.

- Animations
Well, this will be a fun one, but manageable

I'd love to hear your input  Grin
3  Game Development / Newbie & Debugging Questions / Re: Gradient fill a BufferedImage on: 2014-04-13 00:44:14
Okay, finally solved it!
Result is not perfect, but it works  Grin
Click to Play

I pre render the frames and store them in an array list. I had to change isIncluded() to consider alpha values.
4  Game Development / Newbie & Debugging Questions / Re: Gradient fill a BufferedImage on: 2014-04-12 18:28:56
Okay, I kinda found a way but it's way to slow to use it...

First I get the outline of my BufferedImage
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  
   
   /**
    * @see http://stackoverflow.com/questions/18591749/create-java-awt-geom-area-from-points
    */

   public static Area getOutline(BufferedImage image, Color color, boolean include, int tolerance) {
        Area area = new Area();
        for (int x=0; x<image.getWidth(); x++) {
            for (int y=0; y<image.getHeight(); y++) {
                Color pixel = new Color(image.getRGB(x,y));
                if (include) {
                    if (isIncluded(color, pixel, tolerance)) {
                        Rectangle r = new Rectangle(x,y,1,1);
                        area.add(new Area(r));
                    }
                } else {
                    if (!isIncluded(color, pixel, tolerance)) {
                        Rectangle r = new Rectangle(x,y,1,1);
                        area.add(new Area(r));
                    }
                }
            }
        }
        return area;
    }

    private static boolean isIncluded(Color target, Color pixel, int tolerance) {
        int rT = target.getRed();
        int gT = target.getGreen();
        int bT = target.getBlue();
        int rP = pixel.getRed();
        int gP = pixel.getGreen();
        int bP = pixel.getBlue();
        return(
            (rP-tolerance<=rT) && (rT<=rP+tolerance) &&
            (gP-tolerance<=gT) && (gT<=gP+tolerance) &&
            (bP-tolerance<=bT) && (bT<=bP+tolerance) );
    }


From that I create an image I can draw:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
    public BufferedImage getImageWithGradientColor(BufferedImage original, Color color) {
       area = (area == null) ? Images.getOutline(original, color, true, 10) : area;
        final BufferedImage result = new BufferedImage(original.getWidth(), original.getHeight(), BufferedImage.TYPE_INT_ARGB);
       
        Graphics2D g = result.createGraphics();
       
        g.setClip(area);

        g.setPaint(
              new GradientPaint(   0, 0, Images.alphaColor(Color.WHITE, 0),
                             0, (int)(original.getHeight()*(gradientHeight)), Color.WHITE)
           );
       
        g.fillRect(0,0,original.getHeight(),original.getWidth());
       
        g.draw(area);

        return result;
    }


I think creating a new BufferedImage every frame is slowing it down. Is there a better/cleaner way to do so?
5  Game Development / Newbie & Debugging Questions / [Solved]Gradient fill a BufferedImage on: 2014-04-12 14:44:35
Hi,
I'd like to make a fancy death animation for my combat system but got stuck on the second half of my idea. My combat is like the one from RPG Maker games. I got a BufferedImage of the current enemy in the center of the frame, like this:


When an enemy dies he will gradually turn white. That is the first part of my idea. But the second part is the tricky one. I want fill the BufferedImage with a transparent gradient from top to bottom.

Is there a way in plain java to do so? I already googled it but didn't find anything  Clueless
6  Discussions / General Discussions / Re: what do you code on? on: 2014-01-12 19:41:18
At home:
Intel i5-2,5k @ 3.3 GHz
8 GB RAM
64 Bit Windows 8.1
GeForce GTX 570

At work:
Intel i5-2,5k @ 3.3 GHz
16 GB RAM
64 Bit Windows 8.1
Onboard Intel dunno
7  Game Development / Newbie & Debugging Questions / Re: Saving and Loading on: 2014-01-10 17:00:41
Did you use BufferedImages to display them? If so you should know that these are transient and doesn't get saved.
Save the Path to the image and get it back when you load. Something like
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   
   public void setBattlerSprite(String filePath) {
      this.spritePath = filePath;
      this.battlerSprite = new Sprite(filePath);
   }
   
   public Sprite getSprite() {
      if(this.battlerSprite == null) {
         this.battlerSprite = new Sprite(spritePath);
      }
     
      return this.battlerSprite;
   }
8  Game Development / Artificial Intelligence / Active Time Battle AI :: Am I doing it right? on: 2014-01-10 12:41:19
My game has a similar battle system like Final Fantasy however in my system the player and the AI will only fight with one character at a time.
I'm fairly new to game developing and AI systems so I followed the advice of this article.
It suggests to use formulas to simulate certain desires instead of hard coded values like
1  
2  
3  
if(ammo == 0) {
  reload();
}


I tried my best and the result does look okay-ish. Could someone help me to improve it?
Here is the code of my behavior class. Each time it's my AI's turn the method getBehavior(Hero target) will be called.
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  
   private static final String BEHAVIOR_ATTACK = "attack";
   private static final String BEHAVIOR_DEFEND = "defend";
   private static final String BEHAVIOR_REGSTAM = "regstam";
   private static final String BEHAVIOR_SKILL = "skill";
   
   private Enemy host;
   private float attackBias;
   private float skillBias;
   private float defendBias;
   
   private float lastTurnHealth; // currently unused
   private float lastTurnStamina; // currently unused
   
   private Hero target;
   private float lastTurnTargetHealth; // currently unused
   
   public Behavior(Enemy enemy) {
      this.host = enemy;
      this.attackBias = 0.2f;
      this.skillBias = 0.1f;
      this.defendBias = 0.2f;
     
      this.lastTurnHealth = 1;
      this.lastTurnStamina = 1;
      this.lastTurnTargetHealth = 1;
   }
   
   public void reset(){
      this.lastTurnHealth = 1;
      this.lastTurnStamina = 1;
      this.lastTurnTargetHealth = 1;
      this.target = null;
   }
   
   /**
    *  The desire rises as the target has less health.
    *  The basic formula is 1/(0.75 + e^(targetHealthPercent / attackBias))
    * @return the desire to attack the target
    */

   private double desireOfAttack() {
      return 1/(0.75 + Math.pow(Math.E, (target.getHealthPercent() / attackBias)));
   }
   
   /**
    * The desire rises as the target has less health but lowers as the host's stamina gets low.
    * The basic formula is 1 / (0.74 + e^((targetHealthPercent / skillBias) / hostStaminaPercent))
    * @return the desire to attack the target with a skill
    */

   private double desireOfSkillUse(){
      return 1 / (0.74 + Math.pow(Math.E,((host.getHealthPercent() / skillBias) / host.getStaminaPercent())));
   }
   
   /**
    * The desire rises as the host has less health.
    * The basic formula is 1/(1 + e^(10*hostHealthPercent - 10*defendBias)
    * @return the desire to defend against the targets attacks
    */

   private double desireOfDefend() {
      return 1/(1 + Math.pow(Math.E, (10 * host.getHealthPercent()) - (10 * defendBias)));
   }
   
   /**
    * The desire rises as the host has less stamina.
    * The basic formula is 1/(1 + e^(10 * hostStaminaPercent)
    * @return the desire to defend and regenerate stamina
    */

   private double desireOfStaminaRegeneration(){
      return 1/(1 + Math.pow(Math.E, 10*host.getStaminaPercent()));
   }
   
   public CombatAction getBehavior(Hero target) {
     
      TreeMap<Double, String> desireMap = new TreeMap<>();
     
      if(target != this.target) {
         this.target = target;
         this.lastTurnTargetHealth = target.getHealthPercent();
      }
     
      desireMap.put(desireOfAttack(), BEHAVIOR_ATTACK);
      desireMap.put(desireOfDefend(), BEHAVIOR_DEFEND);
      desireMap.put(desireOfStaminaRegeneration(), BEHAVIOR_REGSTAM);
      if(host.getSkills().size() > 0){
         desireMap.put(desireOfSkillUse(), BEHAVIOR_SKILL);
      }
     
      System.out.println("AnxietyMap: "+ desireMap.descendingMap().toString());
     
      this.lastTurnStamina = host.getStaminaPercent();
      this.lastTurnHealth = host.getHealthPercent();
     
      return getBehaviorAction(desireMap.descendingMap().values().toArray()[0].toString());
   }
   
   private CombatAction getBehaviorAction(String behavior){
      CombatAction action = new CombatAction();
     
      switch (behavior) {
      case BEHAVIOR_ATTACK:
         action.skillUse(host, target, SkillBook.Enemy.attack);
         break;

      case BEHAVIOR_REGSTAM:
      case BEHAVIOR_DEFEND:
         host.isDefending(true);
         host.regenerateStamina(true);
         break;
         
      case BEHAVIOR_SKILL:
         action.skillUse(host, target, getRandomSkill());
         break;
         
      default:
         break;
      }
     
     
     
      return action;
   }
   
   private Skill getRandomSkill(){
      return host.getSkills().get(MoreMath.random(0, host.getSkills().size()-1));
   }

I want to extend the methods later to consider the "lastTurnXYZ" variables to simulate hesitation (when the player hits really really hard), euphoria (the player lost a really good chunk of health) and desperation.
Is this approach fine or should I redo it in another way?
9  Game Development / Newbie & Debugging Questions / Re: Different stats on the same Array? on: 2014-01-08 17:04:28
You don't need to add a Class for every item in your game, just make categories.
A sword or a mace are weapons. Weapons are equipment. Armor is equipment too and both share the same stat modifiers (at least in my game).
A leaf on the other hand is maybe used for a recipe (like tea or bandages). So you could make a craftingItem class.

10  Discussions / General Discussions / How do you manage your ideas and resources on: 2014-01-04 20:27:35
Hi guys,
how do you goys manage your ideas and resources in general?
I got a small notebook when I'm at work and use a program called CueCard when I'm at home. It's basicly a notepad with folder management.
Do you use similar tools or massive word/excel files?
11  Game Development / Networking & Multiplayer / Re: correct way to create a packetHandler class on: 2013-12-26 01:19:05
You could use a HashMap. Register your detail packet handler classes in the map and your HandlePacket method just execute their doAction method.
Something along those lines:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
Map<Packet, DetailPacketHandler> handlerMap =  new HashMap<Packet, DetailPacketHandler>();

public PacketHandler(){
  handlerMap.put(INVALID, new InvalidPacketHandler());
  handlerMap.put(ALIVE, new AlivePacketHandler());
  handlerMap.put(new DisconnectedPacketHandler());
}

public void HandlePacket(byte[] data, InetAddress ipAddress, int port){
  String message = PacketUtils.GetDataFromByteStream(data);
  Packets type = PacketUtils.GetPacketIdFromByteStream(data);
 
  DetailPacketHandler currentHandler = (DetailPacketHandler) handlerMap.get(type);
  if (currentHandler != null) {
    currentHandler.doAction(message, ipAddress, port);
  } else {
    // fallback in here
  }
}


At least I manage my game states that way
12  Game Development / Newbie & Debugging Questions / Re: Advanced BufferedImage manipulation in pure Java on: 2013-12-17 19:16:08
Wow, thanks. I altered your code a bit to fit my needs, but it works like a charm  Kiss
13  Game Development / Newbie & Debugging Questions / Re: Advanced BufferedImage manipulation in pure Java on: 2013-12-16 19:19:32
Okay, I think I'll drop the glass scattering  Grin I don't want to use external libs fo this project.
14  Game Development / Newbie & Debugging Questions / Advanced BufferedImage manipulation in pure Java on: 2013-12-15 19:04:50
Hi guys,
I use BufferedImages to display my sprites and animations in my game. It works really fine and now I want to make things "fancy" Cheesy
On Stack Overflow did I found a way to manipulate an given image into a grayscale one. But how do I ink my images?
Given is a BufferedImage like this png:
given Imagegrayscaledinked
Red is just an example. I want to hand over a color and get the inked image as result.
My grayscale Code looks like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
   public static BufferedImage getGrayScaleImage(BufferedImage original) {
 
      GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
      GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();
      GraphicsConfiguration graphicsConfiguration = graphicsDevice.getDefaultConfiguration();
       
      // If the source image has no alpha info use Transparency.OPAQUE instead
      BufferedImage image = graphicsConfiguration.createCompatibleImage(original.getWidth(null), original.getHeight(null), Transparency.BITMASK);
       
      // Copy image to buffered image
      Graphics graphics = image.createGraphics();
       
      // Paint the image onto the buffered image
      graphics.drawImage(original, 0, 0, null);
      graphics.dispose();
       
      // Convert to grayscale
      ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
      ColorConvertOp op = new ColorConvertOp(cs, null);
       
      image = op.filter(image, null);
       
      return image;
   }


I haven't used ColorSpace or ColorConvertOp ever, so I don't how to use them  Huh

My second question is a bit more tricky. Like I said: I use images with transparent backgrounds. If I defeat an enemy, I want it to scatter like glas. Is there a way to do so? If so, how?
15  Game Development / Newbie & Debugging Questions / content deph for prototypes on: 2013-11-25 19:33:38
Hi guys,
I don't know if this fits in this section, but I think every "noob" gets to this point like I did.
How "far" should I fill my game with content for testing?
I create a dungeon crawler with final fantasy styled combat. My base theme is the Anime "Sword Art Online". Which means, there are no Spells and everything is melee and weapon related. To equip a certain weapon you need the mastery of said weapon type. At this moment I got 22 masteries for either blunt, thrust or slash weapons. Originally there were shields or some kind of net included, but i curently have one weapon slot and one armor slot implemented and you can't kill a skeleton with just a buckler, can you?
Each and every of this mastery has it's own rank and gets experience when equiped in a fight. As you grow more familiar with your weapon (rank your mastery up) you get skills. Each skill represents the nature of it's weapon. A dagger has many critical hit and multiple hit skills, while a mace has more base damage attacks.
You see, that entails a slew of content I have to create and balance.

Is there any point or threshold where I clearly can make a cut and implement other things?

Would love to hear your opinions.
16  Java Game APIs & Engines / Java 2D / Re: Resource Loader / Loading Screen on: 2013-11-23 18:35:29
I think the problem is, how to tell the loading screen that every resource is loaded. Or is it how to load these?
17  Discussions / Miscellaneous Topics / Re: What would you like to see in Java? on: 2013-10-08 14:39:04
I'm a bit pampered by PHP but I'd like to name my array keys. One other thing is Java2D. It's fine the way it is, but sometime I'd like to style it with CSS. It would be so much easier than calculating each and every coordinate.
18  Game Development / Newbie & Debugging Questions / Re: New font for my game ???? on: 2013-07-24 13:34:47
Do you want to implement an existing font or creat your very own?
If you want to implement an existing one, then there are many ways.
Here is the way I implement my custom font:
1  
2  
3  
4  
5  
6  
7  
8  
9  
Font font = new Font("Arial", Font.PLAIN, 16); // fallback if font not found
     
try{
  font = Font.createFont(Font.TRUETYPE_FONT, new File("resources/fonts/sao_font.ttf"));
  font = font.deriveFont(Font.PLAIN, 16);
} catch (Exception e) {
  System.err.println("Font not found");
  e.printStackTrace();
}
19  Game Development / Newbie & Debugging Questions / Re: How to get gradients do their job on: 2013-07-22 20:45:44
Thanks, that did the magic.
I thought x and y of each color was percentage, at least the java tutorials of oracle suggested it.
20  Game Development / Newbie & Debugging Questions / Re: How to get gradients do their job on: 2013-07-22 14:41:04
The bar should be light green on the left and dark green on the right side. While the first one has a gradient in that way, even if it is not the way I want it, does the second not have any light green.
21  Game Development / Newbie & Debugging Questions / Re: Loading IMAGES on: 2013-07-22 14:34:14
This is how I get my tiles from my sets:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
   public static ArrayList<BufferedImage> loadTileSet(String setName){
      ArrayList<BufferedImage> tileset = new ArrayList<>();
      try {
         BufferedImage bildTileset = ImageIO.read(new File("resources/images/"+setName+".gif"));
         int width = bildTileset.getWidth()/32;
         int height = bildTileset.getHeight()/32;
         for(int x=0; x<height;x++){
            for(int y=0; y<width; y++){
               BufferedImage tile = bildTileset.getSubimage(y*32, x*32, 32, 32);
               tileset.add(tile);
            }
         }
      } catch (IOException error) {
         System.err.println("Tileset not found");
         error.printStackTrace();
      }
     
      return tileset;
   }


You will get a list of 32x32 tiles, but it will cut your tree into 4 parts  Undecided
22  Game Development / Newbie & Debugging Questions / [solved] How to get gradients do their job on: 2013-07-22 12:46:03
Hey guys,
I try to create a final fantasy 7-ish combat without any library, I want to make a game from scratch before I use any of them.
My problem lies in the gradient. I want something like that:


But in the end it looks like:


They don't look that diferent but the problem is, there are two bars (one for the player and one for the enemy/npc). The second bar doesn't get any gradient at all:


Here is the code of the paint 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  
int barWidth = 220;
int barHeight = 30;
int barInitiativeHeight = 6;
   
Graphics2D g2 = (Graphics2D) g;
     
// Background Color new Color(73,73,73)
// Border Color new Color(91,91,91)
     
     
g2.setColor(new Color(73,73,73));
g2.fillRect(63, 450, barWidth-1, barHeight-1);//Stam Player
g2.fillRect(523, 450, barWidth-1, barHeight-1);
g2.setColor(new Color(91,91,91));
g2.drawRect(62, 449, barWidth, barHeight);//Stam
g2.drawRect(522, 449, barWidth, barHeight);


//Stamina Color TODO: Gradient -> dark 234;158;15   light 251;181;15
g2.setPaint(new GradientPaint(0,0,new Color(234, 158,15),100, 0,new Color(251,181,15)));
g2.fillRect(63, 450, (int) (barWidth*(player.getCharacters().get(0).getStamina()/(float)player.getCharacters().get(0).getMaxStamina())-1), barHeight-1);
g2.setPaint(new GradientPaint(0,0,new Color(251,181,15),100, 0,new Color(234, 158,15)));
g2.fillRect(523+(barWidth-(int)(barWidth*(enemies.get(0).getStamina()/(float)enemies.get(0).getMaxStamina()))), 450, (int) (barWidth*(enemies.get(0).getStamina()/(float)enemies.get(0).getMaxStamina())-1), barHeight-1);//HP
     
g2.setColor(new Color(73,73,73));
g2.fillRect(26, 434, barWidth-1, barHeight-1);//HP
g2.fillRect(63, 482, barWidth-1, barInitiativeHeight-1);//Init
     
g2.fillRect(558, 434, barWidth-1, barHeight-1);//HP
g2.fillRect(523, 482, barWidth-1, barInitiativeHeight-1);//Init
     
g2.setColor(new Color(91,91,91));
g2.drawRect(25, 433, barWidth, barHeight);//HP
g2.drawRect(62, 481, barWidth, barInitiativeHeight);//Init
   
g2.drawRect(557, 433, barWidth, barHeight);//HP
g2.drawRect(522, 481, barWidth, barInitiativeHeight);//Init
           
//HealthPoint Color TODO: Gradient -> dark 17,118,0      light 57,160,40
g2.setPaint(new GradientPaint(0,0,new Color(17,118,0),100, 0,new Color(57,160,40)));
g2.fillRect(25, 433, (int) (barWidth*(player.getCharacters().get(0).getHealthPoint()/(float)player.getCharacters().get(0).getMaxHealthPoint())), barHeight);//HP
g2.setPaint(new GradientPaint(0,0,new Color(57,160,40),100, 0,new Color(17,118,0)));
g2.fillRect(557+(int) (barWidth-(barWidth*(enemies.get(0).getHealthPoint()/(float)enemies.get(0).getMaxHealthPoint()))),433, (int) (barWidth*(enemies.get(0).getHealthPoint()/(float)enemies.get(0).getMaxHealthPoint())), barHeight);
     
//Init Color new Color(255,93,25)
g2.setColor(new Color(255,93,25));
g2.fillRect(63, 482, (int) (barWidth*(player.getCharacters().get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER )-1), barInitiativeHeight-1);//Init
g2.fillRect(523+(int) (barWidth-(barWidth*(enemies.get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER ))),482, (int) (barWidth*(enemies.get(0).getTurnTimer() / (float)CombatState.MAX_TURN_TIMER )), barInitiativeHeight-1);


Any Idea?
23  Game Development / Newbie & Debugging Questions / Re: How to make text/numbers add to the left instead of right? :( on: 2013-07-22 12:04:10
wouldn't this work too?
1  
2  
3  
4  
5  
Graphics g = new Graphics();
FontMetrics fm = g.getFontMetrics( g.getFont() );
int scoreWidth = fm.stringWidth(score);

hudBatch.draw(score, 0, 448-scoreWidth);

      
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.

Elsealabs (15 views)
2014-12-28 10:39:27

CopyableCougar4 (19 views)
2014-12-28 02:10:29

BurntPizza (24 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (58 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (96 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
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!