DimitriV's Profile User Rating: ****-

Reputation: 561 Enlightened
Group:
Authors
Active Posts:
2,681 (2.68 per day)
Joined:
24-July 11
Profile Views:
25,540
Last Active:
User is offline Today, 05:56 AM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Mac
Favorite Browser:
Who Cares
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
150

Latest Visitors

Icon   DimitriV working on a game in Java with libGDX.

Posts I've Made

  1. In Topic: Usage of Lights in directx .?

    Posted 19 Apr 2014

    There are some explanations and links to more explanations on Specular, Ambient and Diffuse lighting available here:
    http://msdn.microsof...8(v=vs.85).aspx
    It contains some brief descriptions and implementations in Direct3D 9.
  2. In Topic: Can someone help me with this simple hangman game

    Posted 19 Apr 2014

    I had a bit of a fiddle with it and I think I fixed it:
    boolean failed = false;
    
    			for(x=0; x<n.length(); x++)
    			{
    				if(guess==word2[x])
    				{
    					//System.out.println(guess + " " + word2[x]); never mind this, it was for testing.
    					System.out.println("\n      Letter already entered!");
    					failed = true;
    				}
    			}
    			
    			if (!failed){
    				for(x=0; x<n.length(); x++)
    				{
    					if(guess==n.charAt(x))
    					{
    						hit++;
    						word2[x]=guess;
    						correct++;
    					}
    				}
    
    				if(hit==0)
    					lives--;
    
    				System.out.printf("\n\n");
    				System.out.printf("      ");
    
    				for(x=0; x<n.length(); x++)
    				{
    					System.out.printf("%c ",word2[x]);
    				}	
    			}
    

    First, I added a boolean failed. Your original code looked like this:
    if(guess==word2[x])
                    {
                     System.out.println("\n      Letter already entered!");
                     break;
                    }
    

    You see what could happen here? If I entered t, and the loop was checking index 0 of the word2 array (e), would this evaluate true or false? It would be false and the code would go on regardless. What I did was let the loop continue, flag if there was anything found, and if there was, don't execute what's in the if (!failed) block.
  3. In Topic: Practice assignment due soon! Please help with infinite loop error

    Posted 18 Apr 2014

    Dude, what happened here?
    int equipmentCode = Integer.parseInt("4");//...
    

    It's just as easy to set it to 4 by saying = 4;
    And here:
    equipment = sc.nextLine(); //grab input line
    

    Here is where you need to be parsing input into equipmentCode…
    equipmentCode = Integer.parseInt(equipment);
    
    
  4. In Topic: Simple sprite, don't get it?

    Posted 18 Apr 2014

    I think that where you load your images in the CSS it should look more like this:
    background-image:url('buttons-index.png');
    
  5. In Topic: How to create multiple threads of ball

    Posted 18 Apr 2014

    It's because you only render one ball!
        public void paintComponent(Graphics g)
        {
            //super.paintComponent(g);
            cb.paintComponent(g);
        }
    
    

    I would suggest the use of an ArrayList to store your balls, that way they can be removed and added at any time. Once you have an ArrayList you need to modify your code to look like:
    public void paintComponent(Graphics g){
    super.paintComponent(g);
    for (CreateBall cb : arraylistthatcontainsmaballs){
    cb.paintComponent(g);
    }
    }
    
    

    Suddenly you have an easy way to iterate over as many balls you want and render them all.

My Information

Member Title:
>not activating your almonds
Age:
15 years old
Birthday:
May 24, 1998
Gender:
Programming Languages:
Java, some C++.

Contact Information

E-mail:
Private