This site requires JavaScript, please enable it in your browser!
Greenfoot back
Biq_Boi
Biq_Boi wrote ...

2013/10/25

Card Matching Game, need help!

Biq_Boi Biq_Boi

2013/10/25

#
im making a school project on green-foot, its like card matching game. u click on a card on the world witch is backwards then when clicked the card turns the other side on its position, no movements. plz help, im like begginer for green foot. this is what i have done import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class CardTableGame here. * * @author (your name) * @version (a version number or a date) */ public class CardTableGame extends World { /** * Constructor for objects of class CardTableGame. * */ public CardTableGame() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(2500, 2500, 1); addObject(new CardBack(),120,160); } } public class CardBack extends Actor { public void CardTableGame() { { super(800, 800, 1); shuffleCards(); } } public void shuffleCards() { int x = 100; int y = 100; for(int i = 0; i < 10; i++) { addObject(new CardBack("KingSpades.png"), x, y); } x = 100; y = y + 100; } } fix any problems if there is one, because im getting errors XD
Biq_Boi Biq_Boi

2013/10/25

#
import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class CardTableGame here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class CardTableGame extends World
{

    /**
     * Constructor for objects of class CardTableGame.
     * 
     */
    public CardTableGame()
    {    
        // Create a new world with 600x400 cells with a cell size of 1x1 pixels.
        super(2500, 2500, 1);
        
        addObject(new CardBack(),120,160);
    }


}

public class CardBack extends Actor






{ public void CardTableGame()
{
 
     {
        super(800, 800, 1); 
        shuffleCards();
       
     

    }
}
 
public void shuffleCards()

    {
        int x = 100; int y = 100;
        
        for(int i = 0; i < 10; i++)
        {
            addObject(new CardBack("KingSpades.png"), x, y);
            
      
    }    
            x = 100;
            y = y + 100;
}
} 
       
     
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class CardTableGame here. * * @author (your name) * @version (a version number or a date) */ public class CardTableGame extends World { /** * Constructor for objects of class CardTableGame. * */ public CardTableGame() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(2500, 2500, 1); addObject(new CardBack(),120,160); } } public class CardBack extends Actor { public void CardTableGame() { { super(800, 800, 1); shuffleCards(); } } public void shuffleCards() { int x = 100; int y = 100; for(int i = 0; i < 10; i++) { addObject(new CardBack("KingSpades.png"), x, y); } x = 100; y = y + 100; } }
danpost danpost

2013/10/25

#
2500 x 2500 for a world size is extremely huge. Unless you are going to use a scrolling engine, I would recommend a world size of no more than 1000 x 650, as very few users would be able to view a world much larger than that. If you have to, scale down the size of the images for the cards. You can use one class for the cards and alternate between the two images for each card (the back and the front).
You need to login to post a reply.