Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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
  ignore  |  Print  
  Dreamscape  (Read 13468 times)
0 Members and 1 Guest are viewing this topic.
Offline tyeeeee1
« Posted 2012-12-17 21:35:04 »

Note: I'll be re-writing this OP eventually...

Over the past few months I've been very slowly learning Java and becoming better and better through re-writing this game multiple, around six, times now. This game will, hopefully, be a playable RPG in the future but for now it's just a little project of mine.
It's taken quite a while but I managed to wrap my head around how a bit of these things such as collision detection work and so I was able to finally get it working and into the game. Now that that, in my opinion, huge leap has happened I can finally start working on some of the more fun and interesting parts of the game.

Although there isn't much to show, here is what the game currently looks like:



Random Ideas for the Future:
  • The game will be a top down view just like an old NES style SRPG.
  • There will be no set classes in the game. You decide if you want to be mele, caster or ranged at the beginning but you can become whatever you want.
  • The game will be open ended as to allow me to keep adding content.

Current Goals:
  • Put enemies into the game and have them move around using waypoints.
  • Create a decent looking map to play on.
  • Get a custom made player sprite to replace the current one that I ripped off of google images.
  • Create menus for quests, options, etc...
  • Add sound and music.
  • Add a battle system.


~Updated 13-Jul-2013
Offline Pickleninja

JGO Coder


Medals: 10
Projects: 1


I'm tired of working for someone else.


« Reply #1 - Posted 2012-12-17 21:43:57 »

There isn't much to go off, but from what I do see, you should use some anti-aliasing around the scrolls so they don't have so much of a jagged look to them.

Example:

The one of the right looks a lot more smooth due to anti-aliasing...


-Pickle Smiley

Offline tyeeeee1
« Reply #2 - Posted 2012-12-17 21:55:21 »

There isn't much to go off, but from what I do see, you should use some anti-aliasing around the scrolls so they don't have so much of a jagged look to them.

Example:

The one of the right looks a lot more smooth due to anti-aliasing...


-Pickle Smiley

Does anti-aliasing work on png images that are being loaded from the folder that the program is running from, if so I'll check out how to use it.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Pickleninja

JGO Coder


Medals: 10
Projects: 1


I'm tired of working for someone else.


« Reply #3 - Posted 2012-12-17 22:13:03 »

Pixels that
Does anti-aliasing work on png images that are being loaded from the folder that the program is running from, if so I'll check out how to use it.

Pixels that are see-through will appear white against another background with .png's... I think it maybe a problem that'll have to be solved in an image editting program like photoshop.

The other thing you may be able to do (not sure, haven't tried) is adding a tiny blur effect to buttons... This might solve the problem. Either way, if it's too time consuming, I would say put a pin in it and come back to it later when the game is reaching alpha/beta testing.


-Pickle Smiley

Offline tyeeeee1
« Reply #4 - Posted 2012-12-17 22:19:25 »

I just did a little test with the blur tools in photoshop, the button is really small so it didn't make a very noticable difference in-game. I think I'll do as you've also suggested, I'll put "Make new buttons!" on my to-do list.
Offline Cero
« Reply #5 - Posted 2012-12-17 22:23:59 »

SRPG (Single Player RPG)
There is no such term. Just saying.
Because I mean, in video games most RPGs are primarily single player anyway

Offline tyeeeee1
« Reply #6 - Posted 2012-12-17 22:25:00 »

SRPG (Single Player RPG)
There is no such term. Just saying.
Because I mean, in video games most RPGs are primarily single player anyway

It's a made-up term that stuck with me from when I used to mod Warcraft 3, you were either making an SRPG or an ORPG (Online RPG). Hopefully nobody minds the term. =P
Offline Pickleninja

JGO Coder


Medals: 10
Projects: 1


I'm tired of working for someone else.


« Reply #7 - Posted 2012-12-18 01:59:37 »

I just did a little test with the blur tools in photoshop, the button is really small so it didn't make a very noticable difference in-game. I think I'll do as you've also suggested, I'll put "Make new buttons!" on my to-do list.


Sounds good! Can't wait to see more Smiley

Offline masteryoom

JGO Coder


Medals: 5
Projects: 2


If you look closely, you might see it turning...


« Reply #8 - Posted 2012-12-18 05:30:47 »

For your question about the JPanel, yes, you can, by using JLabel (on the image in the code, if you get what I mean Wink ).

Smiley
Offline tyeeeee1
« Reply #9 - Posted 2012-12-19 03:43:46 »

I did a little bit of work today, although I don't have anything new to show I do have a quick question. Is it acceptable for me to have a 'Global Variables' class such as the two below so that I can just use them whenever and wherever I want or will doing this create some obstacle, problem, etc... that I may run into later on?

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  
class GlobalVariables //Create variables here if you want to use them anywhere. To refrence the variable use GlobalVariables.variableName 
{
   public static String characterNAME = "", characterALIGNMENT = "";
   public static int characterLEVEL = 1;
   public static int characterSTR = 0, characterAGIL = 0, characterDEX = 0, characterINT = 0, characterCON = 0, characterCHAR = 0, characterSPWR = 0, characterHPWR = 0, characterXP = 0, characterHEALTH = 0, characterMANA = 0, characterGOLD = 0;
   
   public static JPanel gamePanel;
   public static Font abaddonFont;
   
   /*
   * A few of the main primitive data types.
   *
   * byte = -128 to 127
   * short = -32,768 to 32,767
   * int = -2,147,483,648 to 2,147,483,647
   * long = -9,223,372,036,775,808 to 9,223,372,036,775,807
   * boolean = true or false
   */

}

//All of the global formulas used in the game will be stored here.
class GlobalFormulas
{
   public double attackFormula(int mainAttribute, int weaponRoll, int passiveSkills, int baseDamage)
   {
      return ((mainAttribute/2) + weaponRoll + passiveSkills + baseDamage);
   }
   
   public double attackMagicFormula(int spellDamage, int intellect, int passiveSkills, int spellPower)
   {
      return (((intellect / 2) * passiveSkills) * spellPower);
   }
   
   public double healingMagicFormula(int spellDamage, int intellect, int passiveSkills, int healingPower)
   {
      return (((intellect / 2) * passiveSkills) * healingPower);
   }
   
   public double defenceFormula(int constitution, int armor, int passiveSkills)
   {
      return ((constitution / 3) + armor + passiveSkills);
   }
}


Edit: In other news I've finished what I currently need to do on the character creation screen so I've started to try and wrap my head around how to actually create the game. I'm currently reading up on various ways to display and update images but I probably won't have anything working for awhile.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #10 - Posted 2012-12-19 05:04:42 »

No, that's pretty much not good design at all, sorry.  Consider watching some of these:

http://www.youtube.com/playlist?list=PLDFD82161A2164D9D
Offline tyeeeee1
« Reply #11 - Posted 2012-12-19 17:23:06 »

No, that's pretty much not good design at all, sorry.  Consider watching some of these:

http://www.youtube.com/playlist?list=PLDFD82161A2164D9D


I'll check out those videos when I get a chance. Why is it not good design and what would be a better way to do it; The only other way I can think of using all my variables wherever I want would be an annoyance. I'd need to keep using something like:
1  
ClassName variableName = new MethodNameThatIsTheSameAsClassName(passATonOfVariablesHere);


Edit: That would be mainly for the menu screens, I'm not sure of the non-menu screens though.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #12 - Posted 2012-12-19 19:28:13 »

It's not good design because it's just not object-oriented at all.  I'll grant that OO is sometimes a little bit overblown, but if you're going to write in Java, it's really what the language is heavily geared toward.  In fact, throwing everything into a global isn't even good structured programming, OO or not.

I don't pretend to have the teaching skill to introduce OOP, which is why I pointed at those videos (I've not watched them, but I've seen them referred to before).  I'd at least consider a class like Player to collect things like name, alignment, level, stats, and so forth.  The formulas, I don't know enough about your game to say, but I'd consider a Weapon and Spell class, with
attack(Player attacker,Player target)
and
cast(Player caster,Player target)
methods.



Offline tyeeeee1
« Reply #13 - Posted 2012-12-19 20:00:16 »

Just so I can figure this out a bit more, here's an example I'm making up based on what I know and kinda-sorta know.

1.) The game is launched and the user creates a character.
2.) When the user clicks continue on the character creation screen a constructor in the 'character' class would be fed all of the stats and information from the various variables in the 'characterCreationMenu' class. If I use something along the lines of:
1  
Character referenceCreatedCharacter = new Character(str, agil, dex, int, con, alignment, name)


Would I be able to somehow pass around and get the variables from the referenceCreatedCharacter object and work with the variables that way?
 I'm pretty sure when I google around after I submit this question I'll find a way to do that but the one thing that might be hard to find is the type of object that referenceCreatedCharacter is, it's not declared as an int, byte, short or anything as far as I can see so I'm not sure how to pass it around.

BTW, thanks for the weapon/spell class idea. I think I'll try something similar when I get there after re-writing the program.


Edit: Oh and the formulas are just some simple equations that me and my friends figured out, it works for our table-top game so I'm trying them out in this game.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #14 - Posted 2012-12-19 22:13:37 »

I'm pretty sure when I google around after I submit this question I'll find a way to do that but the one thing that might be hard to find is the type of object that referenceCreatedCharacter is, it's not declared as an int, byte, short or anything as far as I can see so I'm not sure how to pass it around.

Objects are values like anything else, and you pass them like anything else.  I don't want to sound overly critical, but this is super-basic java programming knowledge that you need to get comfortable with, perhaps by following some tutorials or books.

As for wanting to avoid a constructor that takes a zillion args, that's understandable.  One thing you could investigate is the Builder Pattern, which would be very appropriate for something like a RPG character where you're literally building them up in pieces.  You need to get basic reference semantics under your belt first though.

Offline tyeeeee1
« Reply #15 - Posted 2012-12-20 03:08:49 »

I'm pretty sure when I google around after I submit this question I'll find a way to do that but the one thing that might be hard to find is the type of object that referenceCreatedCharacter is, it's not declared as an int, byte, short or anything as far as I can see so I'm not sure how to pass it around.

Objects are values like anything else, and you pass them like anything else.  I don't want to sound overly critical, but this is super-basic java programming knowledge that you need to get comfortable with, perhaps by following some tutorials or books.

As for wanting to avoid a constructor that takes a zillion args, that's understandable.  One thing you could investigate is the Builder Pattern, which would be very appropriate for something like a RPG character where you're literally building them up in pieces.  You need to get basic reference semantics under your belt first though.



Constructors and passing around variables was one of the two units in my CS course that I didn't understand at all so I'm somewhat clueless when it comes to working with them without some sort of googled reference. Also, thanks for the link!

Edit: I've looked into constructors a bit more and I'm going to try to re-write my program as to get rid of the global variables completely, I have one question before I'm able to re-write any of the menus. What type of variable would be created from:
1  
TestOneTwo tempReference = new TestOneTwo();

I need to know because I wont be able to pass the tempReference into the constructor for my actionlistiners to work without knowing the type; Well that's what I think I need to do anyways...
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #16 - Posted 2012-12-20 05:13:01 »

Be careful how you use that phrase - Java doesn't technically have global variables (I think).
They're called fields of a class. It's not that important though Wink
Offline Sammyster

Senior Newbie


Medals: 1



« Reply #17 - Posted 2012-12-20 11:22:41 »

You have to rethink this a bit, it's really not that hard Wink
Like Sproingie said objects are values like anything else. And in java everything is an object
So passing values around isn't difficult. There isn't really any difference between passing primitive data types and objects.

So if we want to pass a name of a person to a other person.

1  
2  
3  
4  
5  
6  
public String name;

/*constructor*/
public Person(Person otherPerson) {
     this.name = otherPerson.name;
}


Want to return a reference to a object?

1  
2  
3  
4  
5  
public Person aPerson;

public Person getPerson() {
    return aPerson;
}


But yeah this is basic so you should perhaps consider takeing some time learning. It won't take you much time before you get it under your belt
Hope I could help you a little Smiley


Take a look at this one.
http://docs.oracle.com/javase/tutorial/java/javaOO/index.html
Offline tyeeeee1
« Reply #18 - Posted 2012-12-20 15:11:19 »

Well, I just re-wrote everything and got rid of all the 'fields of a class' aka fake global variables. The entire unit in my CS class just somehow started to make sense after reading these comments although I'm not sure how. I've set up the shell of a character class which uses getters/setters as well so I made a lot of progress. ^.^

Thank's for the help!
Offline HeroesGraveDev

JGO Kernel


Medals: 310
Projects: 11
Exp: 3 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #19 - Posted 2012-12-22 02:57:05 »

I do hate to ask things like this, but if anyone has ten or so minutes to do a quick checkover of the code so-far and just make sure that I haven't done anything too badly it would be a great help. ^.^ There is one issue I've begun to notice, but it may be because of the insane amount of code being executed. Whenever I click "New Game" and it executes the 'CreateCharacterCreationMenu' class there will be about half a second or so of lag before the character creation screen will appear. If anyone can figure out a way to fix that little issue that would also help to!

Code:
http://pastebin.com/YqsFszBD

You can ignore the sections with a massive amount of comments in them, I still haven't had the time to go through and erase most of them.

Learn to find errors yourself, you won't be able to rely on other people forever.
I don't think there is anything wring with the code (I haven't actually read it yet), because my experience with swing taught me that it is unexpectedly slow at random times.
Just get on with the game and worry about it if it gets worse.

Offline tyeeeee1
« Reply #20 - Posted 2012-12-22 03:03:33 »

Learn to find errors yourself, you won't be able to rely on other people forever.
I don't think there is anything wring with the code (I haven't actually read it yet), because my experience with swing taught me that it is unexpectedly slow at random times.
Just get on with the game and worry about it if it gets worse.

I'll just do that then, since I don't see errors now I'll just wait until I find one. I haven't used swing enough to agree or disagree with what you've said, but I do think the large amount of code being executed has something to do with it either way.  ^.^
Offline masteryoom

JGO Coder


Medals: 5
Projects: 2


If you look closely, you might see it turning...


« Reply #21 - Posted 2012-12-22 03:18:42 »

The equivalent (not really) of global variables is static variables.
But you have to put the classes name in front like this:
1  
AClass.AVariable

Smiley
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #22 - Posted 2012-12-22 04:00:18 »

The equivalent (not really) of global variables is static variables.
But you have to put the classes name in front like this:
1  
AClass.AVariable

Static variables are used when using Static classes - they are values of the class and not of any specific class. The best explanation would just be that you put the class name because they don't belong to any (specific) object. Static variables are used like globals in some cases because of the accessibility in many places - as Wikipedia defines it accessible in every scope. Good discussion here: http://www.artima.com/forums/flat.jsp?forum=1&thread=39370
Offline sproingie

JGO Kernel


Medals: 202



« Reply #23 - Posted 2012-12-23 02:09:32 »

Even static classes have a separate instance per-classloader.  This is way way out of the scope of the OP's design questions though, and "stay away from globals" is still a good guiding principle to go by. 

As with all rules of thumb, there may be exceptions, but if you're experienced enough to know when to break the rule, you didn't have to ask the question.
Offline tyeeeee1
« Reply #24 - Posted 2012-12-23 02:38:16 »

Even static classes have a separate instance per-classloader.  This is way way out of the scope of the OP's design questions though, and "stay away from globals" is still a good guiding principle to go by. 

As with all rules of thumb, there may be exceptions, but if you're experienced enough to know when to break the rule, you didn't have to ask the question.


I don't see when I'd ever need to break the rule now that I have everything working as intended without them.
Offline ML-Deluxe

Senior Newbie


Medals: 1



« Reply #25 - Posted 2012-12-23 15:41:24 »

How did you get along with Swing when your Java skills are that basic?
Just wondering
Offline tyeeeee1
« Reply #26 - Posted 2012-12-23 15:58:09 »

How did you get along with Swing when your Java skills are that basic?
Just wondering

Because it's not that difficult. If I use something I remember it and if I don't I forget it, so they're only basic in the areas that I don't use.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 139
Projects: 4
Exp: 3 years



« Reply #27 - Posted 2012-12-23 17:05:07 »

How did you get along with Swing when your Java skills are that basic?
Just wondering
Swing is very easy, I'd say one of the easiest parts of Java. Very self explanatory - import javax.swing.*, make a frame, set the size, make it visible. Other subjects like IO are more difficult to learn imo because you have to choose between byte streams, object streams, etc.
Offline ML-Deluxe

Senior Newbie


Medals: 1



« Reply #28 - Posted 2012-12-24 02:33:42 »

I know it's easy, but it's very OOP, that's why I was wondering...
Offline tyeeeee1
« Reply #29 - Posted 2012-12-26 00:16:12 »

Thanks to a random post I was reading on this forum I figured out how to make a game loop, after that I searched on google for a way to change the code that I already had written for an applet project from my CS class so that it would work in this program. It works, but I ran into a 'freeze' effect which I kinda-sorta know the source of but I'm not sure how to fix it.

If anyone has a sec to help me figure this out then here is the explanation or something like that:

I have a game loop that, just for testing purposes, prints as message every time the thread runs. The code for the game loop is as follows:
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  
class TestRender implements Runnable
{
   private JPanel gamePanel;
   Thread thread = new Thread();
   
   public TestRender(JPanel gamePanel)
   {
      this.gamePanel = gamePanel;
   }
   
   public void startThread()
   {
      thread.start();
   }
   
   public void run()
   {
      Initialize(); //From what I can gather, this will run the below Initialize method when this method is run. I'll figure out the rest later.
     
      while(true)
      {
         try
         {
            Thread.sleep(1000);
            System.out.println("Test Successful, sleeping for 1000 milliseconds.");
         }
         
         catch(Exception e) //No idea what this does, a few of the examples I saw had it so I included it just in case.
         {
            e.printStackTrace();
         }
      }
   }
   
   private void Initialize()
   {
   }
}


The game loop is 'turned on' after the user finishes creating a character and clicks the 'Continue' button. The code for the continue button is:

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  
continueButton.addActionListener(new ActionListener() {  //Action listener for the continueButton
         public void actionPerformed(ActionEvent e)
         {
            if (tempPointsToSpend == 0 && characterNameTextField.getText().trim().isEmpty() == false) //Checks if the user has used all of the spendable points and if the user has entered a name.
            {
               PlayerCharacter characterReference = new PlayerCharacter(tempStr, tempAgil, tempDex, tempInt, tempCon, tempChar, tempSp, tempHp, tempXp, tempHealth, tempMana, tempGold);
               
               characterReference.strSetter(tempStr);
               characterReference.agilSetter(tempAgil);
               characterReference.dexSetter(tempDex);
               characterReference.intSetter(tempInt);
               characterReference.conSetter(tempCon);
               characterReference.charSetter(tempChar);
               characterReference.spwrSetter(tempSp);
               characterReference.hpwrSetter(tempHp);
               characterReference.healthSetter(tempHealth);
               characterReference.manaSetter(tempMana);
               characterReference.nameSetter(characterNameTextField.getText());
               characterReference.alignmentSetter(alignmentComboBox.getSelectedItem().toString());
               
               System.out.println(""+characterReference.strGetter()+"");
               System.out.println(""+characterReference.agilGetter()+"");
               System.out.println(""+characterReference.dexGetter()+"");
               System.out.println(""+characterReference.intGetter()+"");
               System.out.println(""+characterReference.conGetter()+"");
               System.out.println(""+characterReference.charGetter()+"");
               System.out.println(""+characterReference.spwrGetter()+"");
               System.out.println(""+characterReference.hpwrGetter()+"");
               System.out.println(""+characterReference.healthGetter()+"");
               System.out.println(""+characterReference.manaGetter()+"");
               System.out.println(""+characterReference.nameGetter()+"");
               System.out.println(""+characterReference.alignmentGetter()+"");
               
               
               gamePanel.remove(cancelButton); //Remove specified component from the JPanel.
               gamePanel.remove(continueButton);
               gamePanel.remove(strAddButton);
               gamePanel.remove(agilAddButton);
               gamePanel.remove(dexAddButton);
               gamePanel.remove(intAddButton);
               gamePanel.remove(conAddButton);
               gamePanel.remove(charAddButton);
               gamePanel.remove(spAddButton);
               gamePanel.remove(hpAddButton);
               gamePanel.remove(strMinusButton);
               gamePanel.remove(agilMinusButton);
               gamePanel.remove(dexMinusButton);
               gamePanel.remove(intMinusButton);
               gamePanel.remove(conMinusButton);
               gamePanel.remove(charMinusButton);
               gamePanel.remove(spMinusButton);
               gamePanel.remove(hpMinusButton);
               gamePanel.remove(strAttributeLabel1);
               gamePanel.remove(agilAttributeLabel1);
               gamePanel.remove(dexAttributeLabel1);
               gamePanel.remove(intAttributeLabel1);
               gamePanel.remove(conAttributeLabel1);
               gamePanel.remove(charAttributeLabel1);
               gamePanel.remove(spAttributeLabel1);
               gamePanel.remove(hpAttributeLabel1);
               gamePanel.remove(strAttributeLabel2);
               gamePanel.remove(agilAttributeLabel2);
               gamePanel.remove(dexAttributeLabel2);
               gamePanel.remove(intAttributeLabel2);
               gamePanel.remove(conAttributeLabel2);
               gamePanel.remove(charAttributeLabel2);
               gamePanel.remove(spAttributeLabel2);
               gamePanel.remove(hpAttributeLabel2);
               gamePanel.remove(pointsToSpendLabel1);
               gamePanel.remove(pointsToSpendLabel2);
               gamePanel.remove(pointsToSpendLabel3);
               gamePanel.remove(characterNameLabel1);
               gamePanel.remove(characterNameLabel2);
               gamePanel.remove(characterNameTextField);
               gamePanel.remove(alignmentComboBox);
               gamePanel.remove(characterAlignmentLabel1);
               gamePanel.remove(characterAlignmentLabel2);
               gamePanel.remove(classTypeComboBox);
               gamePanel.remove(characterClassTypeLabel1);
               gamePanel.remove(characterClassTypeLabel2);
               gamePanel.remove(characterManaLabel1);
               gamePanel.remove(characterManaLabel2);
               gamePanel.remove(characterManaLabel3);
               gamePanel.remove(characterHealthLabel1);
               gamePanel.remove(characterHealthLabel2);
               gamePanel.remove(characterHealthLabel3);
               
               gamePanel.repaint(); //Re-loads the JPanel, also known as gamePanel, so that the removed components disappear.
               TestRender  gameWindow = new TestRender (gamePanel);
               gameWindow.startThread();
               gameWindow.run();
            }
         }});



From what I can see, the thread is being started too quickly which is causing the 'gamePanel.repaint();' from the 'Continue' button to freeze before the components on the JPanel can be repainted. Although the repaint freezes the thread runs properly and that. Is there some way to stop everything for a around 500 milliseconds so the repaint can work properly?

When I say the repaint 'freezes' I mean that the whole JFrame, JPanel and all of the components become unresponsive so that the only way to stop the program is CTRL+C in the cmd and all of the components stay on the JPanel as they looked when the repaint was (called?) in the 'Continue' button's code.


Edit: I hardly know what I'm doing with the game loop other than some theory's on how I'll use it so if anyone has suggestions on how to change it, please say so!
Pages: [1] 2 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

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

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

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

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
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

List of Learning Resources
by SilverTiger
2014-07-31 16:29: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!