Question, could possibly lead to content

This is the place to post your own creative works for other to play or give feedback on!
Forum rules
This forum is for posting and collaborating upon third party work. Please do not post request-threads, and avoid posting artwork that is not your own unless it is being used as a reference.

Re: Question, could possibly lead to content

Postby BlueLight » Wed Mar 20, 2013 9:08 am

Spoiler (click to show/hide):

Code: Select All Code
import javax.swing.*;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.*;
import java.util.Scanner;
public class Frame {

   public void frame(){
      //Begin frame set up
      JFrame frame = new JFrame("D-Day");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // this is important, you want this to be one of the first things to load.
      frame.setSize(600, 600);// this is important, you want this to be one of the first things to load.
      
      
       
      //Frame set up
      //Begin Menu Bar Set up
      JMenuBar menubar = new JMenuBar();
      frame.setJMenuBar(menubar);
     
      JMenu file = new JMenu("File");
      menubar.add(file);
         
         
      JMenuItem exit = new JMenuItem("Exit");
      file.add(exit);
      //Menu Bar is set up with file and exit
         //The class set up for making exit do something
      
      

   
      //adding an action to the exit button, making it exit
      exit.addActionListener(new exitaction());
   
      //I need a panel
   
      JPanel panel = new JPanel(new GridBagLayout());
      frame.getContentPane().add(panel, BorderLayout.WEST);   //Borderlayout west to put them on the left               
        //Using the grid bag layout to align my buttons
        //Constraints to help align the buttons
      GridBagConstraints c = new GridBagConstraints();
     
      /**
        * suggestion code for your JButtons
        *
        * panel.setLayout(new GridLayout(0, 3)); // this should provide the same result as gridbag but without the extra over head.
        * // it's better if you make the name of the object clear. That being said, i some times use the same naming convention.
        * JButton attackButton = new JButton("Attack");
        * JButton SpellsButton = new JButton("Spells'");
        * JButton fleeButton = new JButton("Flee \"wimp\"");
        *
        * panel.add(attackButton);
        * panel.add(SpellsButton);
        * panel.add(fleeButton);
        *
      **/
      
      //Begin button set up
   
      JButton button1 = new JButton("Attack");
      c.gridy = 1;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button1, c);
      
      JButton button2 = new JButton("Spells");
      c.gridy = 2;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button2, c);
      
      JButton button3 = new JButton("Flee");
      c.gridy = 3;
      c.gridx = 0;
      c.insets = new Insets(10,10,10,10);
      panel.add(button3, c);
   
      //Finished the start of my buttons
      //New panel to hold the HUD
      JPanel panel2 = new JPanel(new GridBagLayout());
      frame.getContentPane().add(panel2, BorderLayout.SOUTH);
      GridBagConstraints c2 = new GridBagConstraints();
      //Finished start of panel for HUD
     
      //Going to try and use labels for HP then add an output for the actual remaining HP
      JLabel label1 = new JLabel("Player HP");
      panel2.add(label1, c2);
         c2.gridy = 0;
         c2.gridx = 1;
         c2.insets = new Insets(10,10,10,10);
      //Same with MP
      JLabel label2 = new JLabel("Player MP");
      panel2.add(label2, c2);
         c2.gridy = 0;
         c2.gridx = 2;
         c2.insets = new Insets(10,10,10,10);
         
     
      JTextArea textarea = new JTextArea("example");

      frame.add(textarea);
    
      frame.setVisible(true); // You set visible to true once your done with adding components.
      frame.pack(); // this resizes everything to the smallest possible size.
     
     
     
   }
   
   
         
}   

// i didn't really see a good reason for this to be in the constructor. Not using eclipse so i don't know if i broke anything.
   class exitaction implements ActionListener{
     
      public void actionPerformed (ActionEvent e){
         System.exit(0);
      }// end method.
   }   //end of class
         
     
     


wow your a quick study. Then again it's not like you haven programmed before.
I don't understand why your having the inner class in your constructor so i moved it out side of the class all to gather.

setVistible is one of the last things you do, since that makes your GUI visible and you're likely still setting up your board (like you were in this case)

I gave some suggestions code for something simpler than gridbaglayout. I was doing this all in notepad++ so i don't know if i made mistakes. I did not run the code.

EDIT
The indenting was really sloppy and that is a big deal but from what i can tell it's the forum messing with the formatting.

anyways just remember that after a open bracket you indent a extra amount and after a close bracket you intent less.
I perfer using tab, but if your using space bar that's okay. (
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Wed Mar 20, 2013 5:01 pm

Well i must say, mad skillz! It works, though i'm still running into the problem that i had, while it shows the text area the screen is really small...but i suppose for now it doesn't have to be perfect, and the player can always resize the frame.

And now, since the frame has been trolling on my long enough i think i'm going to move on to start something else...maybe a save function so there is actually a way to save the game...or maybe the player...not sure yet...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Wed Mar 20, 2013 7:23 pm

Kagekaton Wrote:Well i must say, mad skillz! It works, though i'm still running into the problem that i had, while it shows the text area the screen is really small...but i suppose for now it doesn't have to be perfect, and the player can always resize the frame.

And now, since the frame has been trolling on my long enough i think i'm going to move on to start something else...maybe a save function so there is actually a way to save the game...or maybe the player...not sure yet...


what i normally do is make a game class that has every variable related to the game. Then i could in theory save the entire file or send command to different variables to save. Right now your basically on your own since i have done IO based stuff in forever.
Youtube can be very helpful in this instance. I think i have a few subs that have IO based videos.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Thu Mar 21, 2013 6:52 am

Yea i'm having some trouble finding any that i can really follow...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Thu Mar 21, 2013 1:02 pm

This is a start i guess but doesn't look like it will help you
http://www.youtube.com/watch?v=KVOCMPZX ... 84&index=4
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby BlueLight » Thu Mar 21, 2013 2:00 pm

http://www.youtube.com/playlist?list=PLBB0977A1BB269DC7 /eh just a playlist. I remembered him having better stuff.
http://www.youtube.com/watch?v=maz4VDM18mA Wont help you but it's awesome.


These should be the basics of what you're looking for. You should maybe want to start looking for a book. I know it sounds strange but their are just somethings that videos and guides wont cover like the inner workings of your computer while your doing some things. Think of it this way, you could look up a video on how to find the X intercepts of a quadratic functions but it wont explain why you set it to 0 (LIES, yes it will!) or the concept behind making one factor equal to zero.
http://www.youtube.com/watch?v=1xARUx2VUzw
http://www.youtube.com/watch?v=DW6uCh6VP5U

didn't see it here but still a good place to check.
http://www.youtube.com/course?list=ECFE2CE09D83EE3E28
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Fri Mar 22, 2013 7:35 am

That is actually my plan...was going to do it tomorrow when i got paid but there were...complications...with my check (they put the wrong SS number in my info) and now i'm poor again
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Fri Mar 22, 2013 11:09 am

I know this price is steep but here's the book i suggest.
http://www.amazon.com/Java-Program-earl ... 0132575663
I believe i got it for about about 80 at a barns and noble.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby BlueLight » Sat Mar 23, 2013 8:49 am

I feel like a idiot. If you want a test of your skill, i'll have my source files up tomorrow (likely with little to no comments... :? ) and my program keeps throwing a error.
If you want to try to figure out what i did wrong, then i think you have your self a challenge. I think i figured out what happened and i feel stupid for it.
I was basically moving methods and variables from one class to a brand new class and some how i messed it up.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby BlueLight » Sat Mar 23, 2013 7:53 pm

Donate2013.zip
(113.26 KiB) Downloaded 20 times


This is my entire project file since the source isn't enough.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Sun Mar 24, 2013 2:27 am

so i haven't been able to even open my computer in days, feels like i got hit by a truck, messed up my knee at work now i think i have the flu...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby Kagekaton » Wed May 15, 2013 9:52 pm

So i lost internet shortly after we had this little conversation, but to sum up everything i've done,

-Rage quit Java with really no reasoning
-Went back to Python for another look
-Am currently sitting at 150 lines of code
-Semi-functional "Game"

When i say Semi-functional i mean i have some navigation around a small area, a help command, gold system, and am currently working out getting some real items into the game. All in all i think i'm picking up on python with some ease, still working out how to manage classes and i don't really have an extensive understanding of a lot of the things i can really do, but youtube is helping tons with that.

As soon as i figure out how i can share this with everyone here i will give everyone a sneak peek, though i can't promise it will be any time soon, that little bit isn't high on my list of things to learn, right now i want to get to a point that says, "Hey, i actually have something for you to look at!" and not, "So you can walk around a house and pick up items that don't exist and put them in an inventory in your imagination!"

On that note, i'm returning to youtube...
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby BlueLight » Wed May 15, 2013 11:41 pm

Well if you were doing java i could help you more.
so how do you deal with the gold?
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Question, could possibly lead to content

Postby Kagekaton » Thu May 16, 2013 3:00 pm

That was really the big reason i was considering going back over to java at some point, when i have a little bigger grasp on coding lol,


as for the gold i just used a global thingie,

global gold
gold = 0

def currentgold():
print "Gold -" gold

gold = (gold + (however much i want to add))


i was going to define it as an item, but then i came into the issue of it possibly taking up space in the inventory if i make an inventory size limit, didn't want to fuss with it too much
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Re: Question, could possibly lead to content

Postby Kagekaton » Wed Jul 24, 2013 6:28 am

I HAVE RETURNED!

Seeing as how it has been a while since i've been here, to anyone who cares at all this is what has taken place since my last visit!

-Threw out the game i was working on
-Started a new one

That's about it really, though i have made much better progress this time! Enough to honestly say that i could use a hand! I shall give a list of things that i could use help on and if anyone would want to take a stab at any of it then please feel free!

-Descriptions of rooms/anywhere you can visit
-Ideas for places mentioned above
-Race ideas/descriptions (by that i mean any sort of race you would want to play as/meet in the game
-Main plot "quest" ideas
-Side plots


While i would be able to come up with and write all of these things myself, it is very time consuming and even then it would all be what i like and what i want to see...this game is by no means for me, it is for all of you :D and i want you guys to enjoy playing it!


On a side note, if anyone knows how to build a GUI that is compatible with python could you throw me a message? Currently everything runs in command prompt and it just really is no fun to look at XD
Kagekaton
 
Joined: Fri Aug 19, 2011 1:30 am

Previous

Return to Creative Corner



Who is online

Users browsing this forum: Google Feedfetcher