CasiOo's Profile User Rating: *****

Reputation: 1458 Grandmaster
Group:
Mentors
Active Posts:
3,236 (2.27 per day)
Joined:
05-April 11
Profile Views:
15,341
Last Active:
User is offline Today, 02:29 AM
Currently:
Offline

Previous Fields

Country:
DK
OS Preference:
Who Cares
Favorite Browser:
Opera
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
225
Expert In:
Java

Latest Visitors

Icon   CasiOo has not set their status

Posts I've Made

  1. In Topic: Need Help with Key Listener

    Posted 2 Mar 2015

    x+=velY;
    
    

    Seems to me like you are changing x instead of y in your Player class :)
    Should be easy to fix
  2. In Topic: How can I reset cards to indicate no first click (Memory Game)

    Posted 1 Mar 2015

    You are making the same mistakes as most beginners
    The program is centralized around the gui, where instead the gui should be some pretty paint on top of a working game layer :)

    My advice would be for you to code your game without a gui first
    Make the game work as expected. This shouldn't be too difficult to test
    When you have the logic down, then start implementing the gui. Hopefully you'll then find it a lot easier to implement
    It is Always important to separate game/business logic from the presentation! Remember that!

    A good start would be a Card class
    Every memory game needs to show pairs of cards, so why not start by implementing the card
    In my mind it makes sense for a card to know if it is turned or not turned. It also makes sense to me, if the card class knows if it matches another card
    public class Card {
    	private String turnedIconPath;
    	private boolean turned;
    	
    	public Card(String turnedIconPath) {
    		//Check to make sure null isn't passed in
    		//This is only a check for ourselves, that we aren't doing any programming errors
    		checkIconPathNotNull(); 
    		this.turnedIconPath = turnedIconPath;
    		this.turned = false;
    	}
    	
    	public void flip() {
    		turned != turned;
    	}
    	
    	public boolean isTurned() {
    		return turned;
    	}
    	
    	public boolean matches(Card other) {
    		return turnedIconPath.equals(other.turnedIconPath);
    	}
    	
    	private void checkIconPathNotNull(String iconPath) {
    		if (iconPath == null)
    			throw new IllegalArgumentException("turnedIconPath");
    	}
    }
    
    


    Next? Well that's up to you
    Maybe implement a MemoryGame class? It could be responsible for progressing the game forward
    Remember to give your methods meaningful names such as
    public void turnCard(Card card) {
    	
    }
    
    
  3. In Topic: Dont understand why my code is wrong

    Posted 1 Mar 2015

    Looks like an angular problem. Moved to the Javascript forum :)
  4. In Topic: Messy code.

    Posted 1 Mar 2015

    Quote

    I have a problem when the input is 0

    What kind of a problem? Please try and explain it to us

    You have some redundant code in your while loop
    Try and minimize the copy-paste code :)
    		System.out.println("Enter an integer, the input ends if it is 0: ");
    		int userInput = input.nextInt();
    
    		while (userInput != 0) {
    			sum += userInput;
    			
    			if (userInput < 0) {
    				countNegatives++;
    			}
    			else {
    				countPositives++;
    			}
    			
    			System.out.println("Enter an integer, the input ends if it is 0: ");
    			userInput = input.nextInt();
    		}
    
    


    Your average is calculated using integers, which is why you won't be getting a decimal result
    A quick fix would be to change sum into a float. Java will then treat the calculation as a floating point instead of an integer
  5. In Topic: Help with code

    Posted 1 Mar 2015

    What error are you getting?

    Seems to be working fine for me

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
3
Programming Languages:
Java, C#, VB.NET, JavaScript, PL/SQL, PHP (Basic)

Contact Information

E-mail:
Private

Comments

Page 1 of 1
  1. Photo

    riperator Icon

    31 Jul 2013 - 10:33
    <3 you
  2. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    thank*
  3. Photo

    b.netana Icon

    23 Mar 2013 - 17:32
    wanted to that you for your help with my gui practice
  4. Photo

    raghav.naganathan Icon

    25 Nov 2012 - 21:15
    Hi dude...I would like to tell you that your rep(729) is a perfect cube :) Cheers :)
  5. Photo

    ubunta Icon

    30 Sep 2012 - 23:33
    hi hello
    hope will be fine and feeling well!!!!!!!!!!!!!!
  6. Photo

    Proshnobodhok Icon

    12 Oct 2011 - 12:31
    Hi CasiOo,
    I really didnt know the term. nyways seems like you can help me in at least telling me the way to get the related resources. but is it against the IT laws?
  7. Photo

    CasiOo Icon

    28 Jun 2011 - 04:11
    Thank you :)
  8. Photo

    smohd Icon

    26 Jun 2011 - 19:39
    Welcome to contributors group
Page 1 of 1