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: .isKeyPressed Issue (I think) on: 2013-11-18 20:06:09
Here is the solution I have come up with so far that actually works flawlessly. What do you think?

1  
2  
3  
if(userInput.isKeyPressed(Input.KEY_ENTER)){
         userInput.clearKeyPressedRecord();
      }


I also added it to every nonessential if statement that just progresses the story line but doesn't contribute to data collection. I did a test where a variable is updated dependent on the user input and it worked while still not blocking or skipping the progression of the story line.

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  
//Description One update
     if(userInput.isKeyPressed(Input.KEY_Q)){
         userInput.clearKeyPressedRecord();
         twoDescription = false;
         threeDescription = false;
         oneDescription = true;
      }
      if(oneDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            oneDescription = false;
         }
      }
     
      //Description Two update
     if(userInput.isKeyPressed(Input.KEY_W)){
         userInput.clearKeyPressedRecord();
         oneDescription = false;
         threeDescription = false;
         twoDescription = true;
      }
      if(twoDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            twoDescription = false;
         }
      }
     
      //Description Three update
     if(userInput.isKeyPressed(Input.KEY_E)){
         userInput.clearKeyPressedRecord();
         oneDescription = false;
         twoDescription = false;
         threeDescription = true;
      }
      if(threeDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            threeDescription = false;
         }
      }


This is a quick fix that allows me to keep most the code I have already written. You all have shown me different approaches and I value them greatly. Thank you for the help guys!   Cheesy
2  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-17 02:45:47
Man was xsvenson right or what. I didn't realize there are so many different approaches to solve this issue, and I am sure there are more then what was presented here.

Thank you SHC for you input and idea, looks like I have some work to do  Smiley

I will be taking all these ideas and working them in this upcoming week, once I have found the solution I will report back to show you guys.
3  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-16 02:20:53
Thank you both!  Smiley

I will let you know how it goes with your example j, you will hear from me tomorrow when I have time to sit down and work on it.
4  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 22:03:05
Cool, I look forward to seeing what you have come up with.  Smiley
5  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 19:48:55
just out of curiousity.. is this the only place you actually change the state?

 //Third Scene update
      if(userInput.isKeyPressed(Input.KEY_ENTER)){
         sbg.enterState(3);
      }


if so then i would expect after the last suggestion ..
you would hit enter.. nothing happends
hit enter again nothing happends
and hit it again and it goes to 3rd state.

is this whats occuring ?


That is what has me puzzled, it only skips the firstScene in state 2 no matter how many times I hit enter when in state 1. I really appreciate your effort and help in this, means a lot!  Cheesy


Having lots of booleans gets fast out of hand.

I haven't really analyzed Your code but my suggestion is to have Your scenes as different objects.
Your main class will only have 1, the current active scene, also the scene itself knows what to do with the enter key.

Imagine it as a book, You are reading only 1 page, You can go back or forward or pick a arbitary page (via number or whatever). Your main class is the book and Your current scene is the current page etc

I think I am going to take this approach. From day 1 of this project having so many booleans really had me unsettled, I felt there was a better way to do it. I will take this advice and see what I can do with it, I am sure it will be a bit more challenging having them as objects but it seems to make more sense. Thank you for all your help xsvenson.  Cheesy

Also this is just for giggles, j I recorded this for you so you can see it play out in real time. I know you understand my issue so please don't take this as an insult, and xsvenson, my bad for forgetting your name during the recording.

<a href="http://www.youtube.com/v/sueNMidUOT8?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/sueNMidUOT8?version=3&amp;hl=en_US&amp;start=</a>
6  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 18:04:22
Same result j.  Sad

Would you guys recommend I avoid using booleans altogether? I can't think of another way of doing it though. From what I took from xsvenson, it seems using bool is a futile approach.
7  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 17:38:18
xsven is exactly correct.
 Grin

Thank you both for your help, a bit over my head at the current moment but that's why I asked so I can learn.  Smiley

How would you recommend I get around this, I unfortunately do not see an alternative. If enter is not pressed in state 1(plaerSelect) then it progresses as intended, firstScene loads every time.
8  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 17:23:04
I am sorry j but I do not follow what you are saying. Let me know if I missed what you said;

The state change from 1(selectPlayer) to 2(missionBriefing) should happen instantaneously, this is where you lost me. If I am in state 1(selectPlayer) and press enter then select the player and it loads state 2(missionBriefing) it will start off at secondScene instead of loading firstScene.

Being that they are different states I am assuming to treat them as if they are different classes. In state 2 I have firstScene, secondScene and thirdScene all set to private so I am unsure how state 1 can access the info and process the firstScene without actually being there yet.
9  Game Development / Newbie & Debugging Questions / Re: .isKeyPressed Issue (I think) on: 2013-11-15 16:48:02
Actually the logic you described is exactly how I intended it to be. This is an intro sequence that has a bit of text that I spread out over 3 key strokes, this way the player doesn't have a short story to read on a single page.

The if/else will display one or the other, I am looking for a sequence from first to second then to third.

Thank you for your help, my experience level is quite low so your response could contain merit that I have missed  Smiley
10  Game Development / Newbie & Debugging Questions / .isKeyPressed Issue (I think) on: 2013-11-15 16:01:39
I am running into an issue with keyboard inputs.

Example; In the SelectPlayer state it does not give you the option to press enter. If enter is not pressed then the game proceeds as intended to the IntroMissionBriefing state and load firstScene, but if enter is pressed during the SelectPlayer state then it will proceed to IntroMissionBriefing and load secondScene completely skipping firstScene altogether.

I have also ran into this issue with a state further in the game but it is around 1000 lines of code and didn't want this post to be too big (this issue is localized within a single state so I am unsure if the issue is identical or not, let me know if you want me to post the code for this issue as well).

I have posted all the code I thought would be relevant to finding the cause. The way I have the game coded right now is the only way I knew how to get this to work, but obviously it doesn't. Please critique my code, only way I can learn  Smiley

P.S. if you guys/gals would like me to post a video of what is happening to actually get a visual please let me know.

Main Game 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  
package game;


import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Game extends StateBasedGame{
   
   public static final String gameName = "SSC Fizzle";
   public static final int menu = 0;
   public static final int selectPlayer = 1;
   public static final int missionBriefing = 2;
   public static final int selectCrew = 3;
   public static final int launchSite = 4;
   
   public Game(String gameName){
      super(gameName);
      this.addState(new Menu(menu));
      this.addState(new IntroLaunchSite(launchSite));
      this.addState(new SelectPlayer(selectPlayer));
      this.addState(new IntroMissionBriefing(missionBriefing));
      this.addState(new SelectCrew(selectCrew));
   }
   
   public void initStatesList(GameContainer gc) throws SlickException{
      this.getState(menu).init(gc, this);
      this.getState(launchSite).init(gc, this);
      this.getState(selectPlayer).init(gc, this);
      this.getState(missionBriefing).init(gc, this);
      this.getState(selectCrew).init(gc, this);
      this.enterState(menu);
   }

   public static void main(String[] args) {
      AppGameContainer appgc;
      try{
         appgc = new AppGameContainer(new Game(gameName));
         appgc.setDisplayMode(1280, 720, false);
         appgc.start();
      }catch(SlickException e){
         e.printStackTrace();
      }

   }

}


SelectPlayer
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  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
package game;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class SelectPlayer extends BasicGameState{
   
   private boolean firstScene = true;
   private boolean quit = false;
   private boolean oneDescription = false;
   private boolean twoDescription = false;
   private boolean threeDescription = false;
   
   Image backdropOne;
   Image backdropTwo;
   Image blurBackground;
   Image escBackdrop;
   
   public SelectPlayer(int state){
     
   }
   
   public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
     
      backdropOne = new Image("res/BackdropOne.png");
      backdropTwo = new Image("res/BackdropTwo.png");
      blurBackground = new Image("res/IntroBlurOne.png");
      escBackdrop = new Image("res/EscMenu.png");
   }
   
   public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
     
      g.drawImage(blurBackground, 0, 0);
     
      if(firstScene == true){
         
         //Player One - Military Commander
        g.drawImage(backdropOne, 210, 110);
         g.drawImage(Player.playerOne().picture, 223, 120);
         g.drawString(Player.playerOne().name, 390, 125);
         g.drawString(Player.playerOne().position, 390, 150);
         g.drawString(Player.playerOne().traitOne, 390, 175);
         g.drawString(Player.playerOne().traitTwo, 390, 200);
         g.drawString(Player.playerOne().traitThree, 390, 225);
         g.drawString("Background (Q)", 390, 250);
         
         //Player Two - Scientist
        g.drawImage(backdropOne, 210, 300);
         g.drawImage(Player.playerTwo().picture, 223, 310);
         g.drawString(Player.playerTwo().name, 390, 315);
         g.drawString(Player.playerTwo().position, 390, 340);
         g.drawString(Player.playerTwo().traitOne, 390, 365);
         g.drawString(Player.playerTwo().traitTwo, 390, 390);
         g.drawString(Player.playerTwo().traitThree, 390, 415);
         g.drawString("Background (W)", 390, 440);
         
         //Player Three - Pilot
        g.drawImage(backdropOne, 210, 490);
         g.drawImage(Player.playerThree().picture, 223, 500);
         g.drawString(Player.playerThree().name, 390, 505);
         g.drawString(Player.playerThree().position, 390, 530);
         g.drawString(Player.playerThree().traitOne, 390, 555);
         g.drawString(Player.playerThree().traitTwo, 390, 580);
         g.drawString(Player.playerThree().traitThree, 390, 605);
         g.drawString("Background (E)", 390, 630);
         
         if(firstScene == false){
            g.clear();
         }
      }
     
      //Description One render
     if(oneDescription == true){
         g.drawImage(backdropTwo, 670, 160);
         g.drawString(Player.playerOne().history, 680, 180);
         g.drawString("Backspace to Return", 780, 520);
         if(oneDescription == false){
            g.clear();
         }
      }
     
      //Description Two render
     if(twoDescription == true){
         g.drawImage(backdropTwo, 670, 160);
         g.drawString(Player.playerTwo().history, 680, 180);
         g.drawString("Backspace to Return", 780, 520);
         if(twoDescription == false){
            g.clear();
         }
      }
     
      //Description Three render
     if(threeDescription == true){
         g.drawImage(backdropTwo, 670, 160);
         g.drawString(Player.playerThree().history, 680, 180);
         g.drawString("Backspace to Return", 780, 540);
         if(threeDescription == false){
            g.clear();
         }
      }
     
      //Quit Menu render
     if(quit == true){
         g.drawImage(escBackdrop, 0, 0);
         if(quit == false){
            g.clear();
         }
      }
   }
   
   public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
      Input userInput = gc.getInput();
     
      //Choose Player One
     if(userInput.isKeyPressed(Input.KEY_1)){
         Player.player = Player.playerOne();
         sbg.enterState(2);
      }
     
      //Choose Player Two
     if(userInput.isKeyPressed(Input.KEY_2)){
         Player.player = Player.playerTwo();
         sbg.enterState(2);
      }
     
      //Choose Player Three
     if(userInput.isKeyPressed(Input.KEY_3)){
         Player.player = Player.playerThree();
         sbg.enterState(2);
      }
     
      //Quit Menu
     if(userInput.isKeyPressed(Input.KEY_ESCAPE)){
         quit = true;
      }
      if(quit == true){
         if(userInput.isKeyPressed(Input.KEY_R)){
            quit = false;
         }
         if(userInput.isKeyPressed(Input.KEY_Q)){
            System.exit(0);
         }
      }
     
      //Description One update
     if(userInput.isKeyPressed(Input.KEY_Q)){
         twoDescription = false;
         threeDescription = false;
         oneDescription = true;
      }
      if(oneDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            oneDescription = false;
         }
      }
     
      //Description Two update
     if(userInput.isKeyPressed(Input.KEY_W)){
         oneDescription = false;
         threeDescription = false;
         twoDescription = true;
      }
      if(twoDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            twoDescription = false;
         }
      }
     
      //Description Three update
     if(userInput.isKeyPressed(Input.KEY_E)){
         oneDescription = false;
         twoDescription = false;
         threeDescription = true;
      }
      if(threeDescription == true){
         if(userInput.isKeyPressed(Input.KEY_BACK)){
            threeDescription = false;
         }
      }
   }
   
   public int getID(){
      return 1;
   }
}


IntroMissionBriefing
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  
package game;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class IntroMissionBriefing extends BasicGameState{
   
   private boolean firstScene = true;
   private boolean secondScene = false;
   private boolean thirdScene = false;
   private boolean quit = false;
   
   Image blurBackground;
   Image escBackdrop;
   
   public IntroMissionBriefing(int state){
     
   }
   
   public void init(GameContainer gc, StateBasedGame sbg) throws SlickException{
     
      blurBackground = new Image("res/IntroBlurOne.png");
      escBackdrop = new Image("res/EscMenu.png");
   }
   
   public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
     
      g.drawImage(blurBackground, 0, 0);
     
      //First Scene of the Mission Briefing render
     if(firstScene == true){
         g.drawString("Explain the mission, going to space to spy on\n"
               + "the **** party. The year is 1933, Sectrete Space Command\n"
               + "Send the SSC Fizzel into space to spy on the Germans\n"
               + "be very detailed to setup the game", 500, 200);
         g.drawString("press enter", 500, 300);
         if(firstScene == false){
            g.clear();
         }
      }
     
      //Second Scene of the Mission Briefing render
     if(secondScene == true){
         g.drawString("More detail for mission briefing if needed", 500, 200);
         g.drawString("press enter", 500, 300);
         if(secondScene == false){
            g.clear();
         }
      }
     
      //Third Scene of the Mission Briefing render
     if(thirdScene == true){
         g.drawString("additional space if needed for Mission Briefing", 500, 200);
         g.drawString("press enter", 500, 300);
         if(thirdScene == false){
            g.clear();
         }
      }
     
      //Quit Menu render
     if(quit == true){
         g.drawImage(escBackdrop, 0, 0);
         if(quit == false){
            g.clear();
         }
      }
   }
   
   public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
      Input userInput = gc.getInput();
     
      //Quit Menu update
     if(userInput.isKeyPressed(Input.KEY_ESCAPE)){
         quit = true;
      }
      if(quit == true){
         if(userInput.isKeyPressed(Input.KEY_R)){
            quit = false;
         }
         if(userInput.isKeyPressed(Input.KEY_M)){
            sbg.enterState(0);
         }
         if(userInput.isKeyPressed(Input.KEY_Q)){
            System.exit(0);
         }
      }
     
      //First Scene update
     if(firstScene == true && userInput.isKeyPressed(Input.KEY_ENTER)){
         firstScene = false;
         secondScene = true;
         thirdScene = false;
      }
     
      //Second Scene update
     if(secondScene == true && userInput.isKeyPressed(Input.KEY_ENTER)){
         firstScene = false;
         secondScene = false;
         thirdScene = true;
      }
     
      //Third Scene update
     if(userInput.isKeyPressed(Input.KEY_ENTER)){
         sbg.enterState(3);
      }
   }
   
   public int getID(){
      return 2;
   }
}
11  Games Center / WIP games, tools & toy projects / Re: SSC Fizzle on: 2013-09-29 18:33:43
Thank you Drenius!
12  Games Center / WIP games, tools & toy projects / Re: SSC Fizzle on: 2013-09-29 04:19:03
Thats a good way to manage the diplomatical part!
But will there always be the same dialogues (or whatever)?

Yes and no, the dialog will be static for each decision end point, but your choice could send you to A, B, C and so on which will result in a seemingly fluid dialog that could change every time you play (that is the goal at least). If you play the game through one way and play again with different choices another time then you will receive different results with the story line. Now with that said, if you played it through the second time the exact same way you played it through the first time then the odds are you "could" go through the same sequences.

Now that brings me to my next point, the reason why I said "could". Once you have made your decision, lets say you choose to be friendly and offer an Alien species a trade agreement. This will look at your Players traits such as his Charisma trait, then a Random number will be generated that will act as the Aliens trait which will be compared to your trait. So even if you choose to be nice but your Player choice has bad Charisma or even good Charisma, your negotiations could fail which could lead towards a fight or just a move along please. My thought in having this style of setup will eliminate the game being 100% pre-scripted, which results in exactly that. Even I want to be able to lose while playing, even if I know the best path (which I am trying to avoid having a "best path").

This is obviously the goal haha, always seems easier said than done but I must say that the decision system I have setup so far is actually working perfectly.  Smiley
13  Games Center / WIP games, tools & toy projects / Re: SSC Fizzle on: 2013-09-29 01:41:34
Sounds interesting.
Do you already know how you keep the program adding new events counting in former decisions?

I have it working by setting each Alien species as an object which is tied to a variable, if your choice is to engage in a fight it will change the variable to X and if your choice is to negotiate and be friendly then it will be set to Y. That way if a you run across another Alien species and they are allies or foes with the other Alien species you encountered, then it will check the variable and give the proper reception.

This is the only way that I have come up with that works.
14  Games Center / WIP games, tools & toy projects / Re: SSC Fizzle on: 2013-09-29 00:15:26
Story?

(I put this at the top as well, you have prompted a very good question)

The story line is being worked out currently. The next update I put here will have the beginnings of the story line in the game, both in text and artwork.

But to elaborate on what we have so far. The game is set in the early 1930s with an experimental space program, the SSC stands for Secret Space Command. The SSC is a rouge branch of the American government and sends the Fizzle into space to spy on the party lead by Hitler (it *'ed out the word, hmm interesting. Well you know, it starts with an N and ends with azi). Something happens to the Fizzles engine while orbiting Earth and they are hurled out of our solar system. The story line up to this point is pretty solid but once you go past this point in the game the story line will differ depending on the direction you head. Throughout the game you will need to negotiate with Alien species that you meet for food, fuel, or you can choose to fight them and take the supplies, obviously risking losing the fight and damaging your ship or possible Game Over. The goal of the game is to ultimately make it back to Earth BUT there are other endings as well, you could choose to stay out there to continue the exploration.

Throughout the game there is always a possibility for you crewr members to die, which if they do you will not be able to utilize their skills anymore. Their is always a chance of a mutiny if crew moral gets too low. You can run out of fuel mid journey and have to figure out a different way of getting your ship moving, also you can run out of food and everyone will starve. I wanted to make this game have different possible ways of losing and winning.

The game is meant to be pretty cheesy and have a touch of classic sifi. We want people playing to have an innocent laugh but still not so corny to where it is not taken seriously.

Cheers  Cheesy
15  Games Center / WIP games, tools & toy projects / Re: SSC Fizzle on: 2013-09-27 06:14:15
Any Gameplay? How will the game be? Also you only need the id of the video, not entire link. For example,

Thank you SHC for the youtube tip, it was driving me nuts haha. No game play as of yet, still working on the Intro sequence. The only way I can describe how it will play is similar to a Text Based Adventure, but I know that is very vague and probably really inaccurate. Pretty much you will be given a decision to make and it will lead you to your next destination based on your decision. There will be no animations or moving parts in the game.
16  Games Center / WIP games, tools & toy projects / SSC Fizzle on: 2013-09-27 06:01:27
Just a brief background of this project and me. I am very new to Java and programming in general, started learning about 4 months ago. I decided I needed an outlet to express some creativity and the SSC Fizzle kinda fell into place. This game is based off a comic book I was writing a couple years back and the style of the game is influence by The Oregon Trail, such a good little game. When I say we in the video below I am referencing my close friend, him and I are developing the story line and character design. As for the code and art work, that is me which is such a fantastic learning experience with Slick2D, LWJGL and Java in general.

Currently the structure for the Intro sequence is setup which is what you will see in the video. I am posting this at such an early stage in development because I want you guys to see it as everything unfolds. Also I will be able to look back in a year or two and get a good laugh Smiley.

The story line is being worked out currently. The next update I put here will have the beginnings of the story line in the game, both in text and artwork.

But to elaborate on what we have so far. The game is set in the early 1930s with an experimental space program, the SSC stands for Secret Space Command. The SSC is a rouge branch of the American government and sends the Fizzle into space to spy on the party lead by Hitler (it *'ed out the word, hmm interesting. Well you know, it starts with an N and ends with azi). Something happens to the Fizzles engine while orbiting Earth and they are hurled out of our solar system. The story line up to this point is pretty solid but once you go past this point in the game the story line will differ depending on the direction you head. Throughout the game you will need to negotiate with Alien species that you meet for food, fuel, or you can choose to fight them and take the supplies, obviously risking losing the fight and damaging your ship or possible Game Over. The goal of the game is to ultimately make it back to Earth BUT there are other endings as well, you could choose to stay out there to continue the exploration.

Throughout the game there is always a possibility for you crew members to die, which if they do you will not be able to utilize their skills anymore. Their is always a chance of a mutiny if crew moral gets too low. You can run out of fuel mid journey and have to figure out a different way of getting your ship moving, also you can run out of food and everyone will starve. I wanted to make this game have different possible ways of losing and winning.

The game is meant to be pretty cheesy and have a touch of classic sifi. We want people playing to have an innocent laugh but still not so corny to where it is not taken seriously.

The video explains pretty much everything so far, 2D 8bit space adventure game. Please keep in mind the terrible audio quality is due to the broken mic I was using, have to use what you have sometimes.



<a href="http://www.youtube.com/v/jc3TOTGIflw?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/jc3TOTGIflw?version=3&amp;hl=en_US&amp;start=</a>
17  Games Center / Showcase / Re: F.T.W on: 2013-09-08 19:03:00
Fun little game, nice job Smiley

One thing I noticed, I hit the red square 2 times and it did not count as a death. It was fairly large at this time as well. Even with it not counting as a death I still only made it to 16 haha.
18  Game Development / Newbie & Debugging Questions / Re: [solved] if statement producing unusual results on: 2013-09-02 20:08:13
Thank you both for your replies, they are very helpful. Nerb thank you for the braces insight, also I thought my understanding of operators was sound but you are correct that I am very new at this, so I will go back and review.

Side note, this for loop will continually run producing winner and loser as desired but I need it to only run a single random number to compare it to the traitOneID. I will do my research into this, as I thought my for loop understanding was sound as well. Maybe a for loop isn't the best option.
19  Game Development / Newbie & Debugging Questions / Re: if statement producing unusual results on: 2013-09-02 08:46:50
I figured out the solution. Needed the >= operator for this to function properly instead of just >. Newb move by a newb programmer  Wink

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
      for (int i = 1; i <= 10; ++i)
      if(Player.player.traitOneID >= randomInt){
         System.out.println("winner");
      }else{
         System.out.println("loser");
      }
     
   }
20  Game Development / Newbie & Debugging Questions / [solved] if statement producing unusual results on: 2013-09-02 08:25:00
I have a very newbish problem that I am sure will give you all a nice chuckle.  Smiley  This is the first time I have posted on a Dev forum, kinda nervous. haha

The issue I am running into is with the if statement within the Intro Class. With the current setup this if statement will always return "winner" 100% of the time but if I use the == operator it will provide different results dependent on the Player.player.traitOneID and the argument value. I need the > operator to work correctly to produce the desired results but it is not.

The traitOneID is setup almost like the players level, this is so I can run a random number against the traitOneID and it will give a conclusion dependent on how high the level is. I was originally using this particular if statement to see if the variable player in the Player Class was actually being updated, which it is, and then ran across this issue which left me puzzled. Side note, I am reaching this if statement by only pressing the 1 key on the keyboard

Player 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  
public class Player {
   
   public static Player player;

   public String name;
   public String position;
   public String history;
   public String traitOne;
   public String traitTwo;
   public int traitOneID;
   public int traitTwoID;  

   
   public static Player playerOne(){
      Player playerOne = new Player();
      playerOne.name = "1. Player One";
      playerOne.position = "Science Officer";
      playerOne.history = "A brief background of Player One";
      playerOne.traitOne = "Intelligence";
      playerOne.traitOneID = 75;
      playerOne.traitTwo = "Courage";
      playerOne.traitTwoID = 25;
      return playerOne;
   }
   
   public static Player playerTwo(){
      Player playerTwo = new Player();
      playerTwo.name = "2. Player Two";
      playerTwo.position = "Pilot";
      playerTwo.history = "A brief background of Player Two";
      playerTwo.traitOne = "Intelligence";
      playerTwo.traitOneID = 50;
      playerTwo.traitTwo = "Courage";
      playerTwo.traitTwoID = 50;
      return playerTwo;
   }
   
   public static Player playerThree(){
      Player playerThree = new Player();
      playerThree.name = "3. Player Three";
      playerThree.position = "Combat Officer";
      playerThree.history = "A brief background of Player Three";
      playerThree.traitOne = "Intelligence";
      playerThree.traitOneID = 25;
      playerThree.traitTwo = "Courage";
      playerThree.traitTwoID = 75;
      return playerThree;
   }
}


PlayerSelect Class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
      Input userInput = gc.getInput();
      if(userInput.isKeyPressed(Input.KEY_1)){
         Player.player = Player.playerOne();
         sbg.enterState(2);
      }
      if(userInput.isKeyPressed(Input.KEY_2)){
         Player.player = Player.playerTwo();
         sbg.enterState(2);
      }
      if(userInput.isKeyPressed(Input.KEY_3)){
         Player.player = Player.playerThree();
         sbg.enterState(2);
      }
   }


Intro Class (here is the if statement in question)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
      Random randomGenerator = new Random();
      int randomInt = randomGenerator.nextInt(100);
       for (int i = 1; i <= 10; ++i)
      if(Player.player.traitOneID > randomInt){
         System.out.println("winner");
      }else{
         System.out.println("loser");
      }
     
   }

I hope I have included all the code needed and explained thoroughly so you can understand my issue, any help in furthering my knowledge would be greatly appreciated.
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 (75 views)
2014-04-15 18:08:23

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

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

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

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

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

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

tom_mai78101 (261 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!