Concentration/Matching Game

My final project for my Java class is to make a card game. I chose matching (concentration). I've got the basic code almost finished except that I got stuck when trying to add an ActionListener to each card in the deck. The method called by the ActionListener needs to modify the card object when it is called, but I don't know how to make the reference for it. I've tried global variables, but BlueJ tells me that it can't use a reference from an inner class or something. Here's my code for the user interface (which also handles the shuffling and such):
* This is the user interface for the Matching game.
* This class also handles the variable number of cards to generate.
* ArrayList will be used to manage the cards within this class.
* @author Maarten deVriend
* @version May 28, 2008
import java.awt.*;
import javax.swing.*;
import java.awt.Toolkit;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
public class MatchingUI
    private JFrame frame;
    private JInternalFrame cardFrame;
    private JInternalFrame menuFrame;
    private ArrayList<Card> cards;
    private MatchingEngine engine;
     * Creates a user interface with cards, a New Game button, and a Quit button
     * The user may specify how many cards he/she would like to choose from.
    public MatchingUI(int row, int column)
        createFrame(row,column);
        engine = new MatchingEngine();
     * Creates the frame and buttons. The user may specify how many rows and
     * columns of cards to add to the grid.
     * The number of rows and number of columns cannot both be odd
    public void createFrame(int row, int column)
        cardFrame = new JInternalFrame("");
        Container cardContentPane = cardFrame.getContentPane();
            //Statement below ensures that the number of cards is even and positive.
            //There is NO check for rediculously large numbers.
            //Please be reasonable.
            if(row<=0 || column <=0)
                //Set defaults.
                cardContentPane.setLayout(new GridLayout(4,4));
                makeCards(4,4);
                Collections.shuffle(cards, new Random());
                for(Card card : cards)
                    card.addActionListener(new ActionListener()
                        public void actionPerformed(ActionEvent e)
                            cardListener();
                    cardContentPane.add(card);
                System.out.println("Negative numbers are not allowed. Setting defaults...");
            else if(row%2==1 && column%2==1)
                //Adjust row because odd multiplied by odd is always odd.
                cardContentPane.setLayout(new GridLayout(row+1,column));
                makeCards(row+1,column);
                Collections.shuffle(cards, new Random());               
                for(Card card : cards)
                    card.addActionListener(new ActionListener()
                        public void actionPerformed(ActionEvent e)
                            cardListener();
                    cardContentPane.add(card);
            else
                //The numbers are acceptable! There's hope afterall.
                cardContentPane.setLayout(new GridLayout(row,column));
                makeCards(row,column);
                Collections.shuffle(cards, new Random());
                //Add an ActionListener to each card in the deck.               
                for(Card card : cards)
                    card.addActionListener(new ActionListener()
                        public void actionPerformed(ActionEvent e)
                            cardListener();
                    cardContentPane.add(card);
        menuFrame = new JInternalFrame("");
        Container menuContentPane = menuFrame.getContentPane();
        JMenuBar menubar = new JMenuBar();
            JMenuItem newGame = new JMenuItem("New Game");
            menubar.add(newGame);
            JMenuItem quit = new JMenuItem("Quit");
            menubar.add(quit);
        menuContentPane.add(menubar, BorderLayout.NORTH);
        frame = new JFrame("Matching v1.0");
        Container contentPane = frame.getContentPane();
        contentPane.setLayout(new BorderLayout());
        contentPane.add(cardContentPane, BorderLayout.CENTER);
        contentPane.add(menuContentPane, BorderLayout.NORTH);
        frame.pack();
        frame.setVisible(true);
     * The iterator should be safe since the number is adjusted
     * in createFrame if it is negative. The compiler will give
     * an error, however.
     * Card extends JButton and has a couple extra reference fields.
    public void makeCards(int row, int column)
        //Sets up the ArrayList of Cards
        cards = new ArrayList<Card>();
        for(int i=0; i<(row*column); i++)
            Card c = new Card();
            c.setIndex(i%4);
            c.setCardIcon(new ImageIcon("card"+(i%4)+".jpg"));
            c.setIcon(new ImageIcon("cardDefault.jpg"));
            cards.add(c);
    public void cardListener()
        if(engine.getFirstCard().getFace()==false &&
        engine.getSecondCard().getFace()==false)
        //Both cards are face down. Flip the chosen card.                           
            //This is where I'm having problems.
            card.setFace(true);
            card.setIcon(getCardIcon());
            engine.setFirstCard(card);
        else
        //The first card is face up. Flip the second one and compare them.
            card.setFace(true);
            card.setIcon(getCardIcon());
            engine.setSecondCard(card);
            engine.compare();
}The MatchingEngine class handles the actual comparison of the two selected cards:
* MatchingEngine handles the process of matching the selected cards and
* eliminating them from the grid. For the most part, it contains methods
* that can be used by other classes (the MatchingUI in particular).
* @author Maarten deVriend
* @version June 3, 2008
public class MatchingEngine
    private Card firstCard;
    private Card secondCard;
    public MatchingEngine()
        //Empty, for the time being.
    public void setFirstCard(Card card)
        firstCard = card;
    public void setSecondCard(Card card)
        secondCard = card;
    public Card getFirstCard()
        return firstCard;
    public Card getSecondCard()
        return secondCard;
    public void compare()
        if((firstCard).equals(secondCard))
            //Remove the clickability of the cards.
            firstCard.setMatched();
            secondCard.setMatched();
        else
            //Flip the cards so they are face down again
            firstCard.setDefaultImage();
            secondCard.setDefaultImage();
}And finally, here is the Card class. It's a subclass of JButton with some extra flags added for the game:
* Write a description of class Card here.
* @author (your name)
* @version (a version number or a date)
import java.awt.*;
import javax.swing.*;
import java.awt.Toolkit;
import java.awt.event.*;
public class Card extends JButton
    int index;
    boolean isFaceUp;
    boolean matched;
    ImageIcon faceUp;
    public Card()
        super();
        index = 0;
        isFaceUp = false;
        matched = false;
        faceUp = new ImageIcon();
     * The following methods allow the other classes to minipulate
     * the fields in an individual Card
    public void setIndex(int i)
        index = i;
    public int getIndex()
        return index;
    public void isFaceUp()
        isFaceUp = true;
    public void isFaceDown()
        isFaceUp = false;
    public boolean getFace()
        return isFaceUp;
    public void setCardIcon(ImageIcon icon)
        faceUp = icon;
    public ImageIcon getCardIcon()
        return faceUp;
    public void setMatched()
        matched = true;
        setIcon(new ImageIcon("cardMatched.jpg"));
    public boolean getMatched()
        return matched;
    public void setDefaultImage()
        setIcon(new ImageIcon("cardDefault.jpg"));
}Any help I could get would be great. The main problem is resolving the reference to the individual card that is being modified by the ActionListener.

A couple other thoughts:
1) Do you need to override the equals( ) method in the Card class? It would seem like you do, that you would want to compare indexes or icons or something of that sort.
2) Your firstCard and secondCard will be initially set to null, and you must check for that in the button's actionlistener. This isn't a bad thing and can be used to test the current state of the program: has a firstCard been set yet or not. If no firstCard, then set it to the card pressed, and likewise if firstCard is not null but secondCard is null, then set the secondCard and compare them. If you use this, then your compare method should set the engine's first and second cards back to null after comparison.
3) You may wish to use some sort of delay mechanism when the cards don't match to give the user time enough to memorize what is held by both cards. Two possible ways to do this include to show a JOptionPane stating that there was no match. Then the two cards can be shown until the user clicks the option pane's OK button. Another way is to use a Swing Timer. If you opt for this, you'll have to temporarily inactivate your program's response to clicking while the two cards are shown.
4) Do you need to test somewhere for game over?

Similar Messages

  • Creating a matching game.

    So I would like to create a matching game in captivate using advanced action.
    The goal is for the learner to on click;
    Reveal a card then reveal another card, if it does not match hide both.
    If they do match they stay revealed and their actions disable so that other cards do not affect them.
    The process is then repeated with the other cards until all are matched

    Hello and welcome to the forum,
    Is this what you want?
    http://blog.lilybiri.com/concentration-game-created-exclusively-with-c
    I created this with CP5.5, now it is a lot easier in 6/7 with groups and shapes. Look at this video:
    http://www.youtube.com/watch?v=Sy09xPoP69A
    And in 7, with the shared actions, even easier. No documentation written for that (yet)
    Lilybiri

  • Matching game help

    im making a concentration type game, where you have a number of cards, and you have to find matchign cards by flippign them over (you can only view 2 at a time).
    i am having problems actually drawing the cards so that when a user clicks on one of the card backs it 'flips' and displays the random card...any ideas on how to do that?
    here is what i have so far:
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.applet.Applet;
    import java.util.*;
    public class Match extends Applet implements MouseListener, MouseMotionListener
         boolean gameOver;
         Image picArray[]=new Image[12];
         Image picUser[]=new Image[12];
         int numsUsed[]=new int[12];
         int choose, bgchoose,m,cards=0,card1,card2;
         Image back,firstCard,secondCard;
         public void init()
              addMouseMotionListener(this);
              addMouseListener(this);          
              picArray[0]=getImage(getCodeBase(),"1.GIF");
              picArray[1]=getImage(getCodeBase(),"2.GIF");
              picArray[2]=getImage(getCodeBase(),"3.GIF");
              picArray[3]=getImage(getCodeBase(),"4.GIF");
              picArray[4]=getImage(getCodeBase(),"5.GIF");
              picArray[5]=getImage(getCodeBase(),"6.GIF");
              picArray[6]=getImage(getCodeBase(),"1.GIF");
              picArray[7]=getImage(getCodeBase(),"2.GIF");
              picArray[8]=getImage(getCodeBase(),"3.GIF");
              picArray[9]=getImage(getCodeBase(),"4.GIF");
              picArray[10]=getImage(getCodeBase(),"5.GIF");
              picArray[11]=getImage(getCodeBase(),"6.GIF");     
              back=getImage(getCodeBase(),"back.gif");
         public void paint(Graphics g)
              setBackground(Color.black);
              bgchoose=(int)Math.round(Math.random()*5);
              g.drawImage(back,0,0,this);
              g.drawImage(back,200,0,this);
              g.drawImage(back,400,0,this);
              g.drawImage(back,600,0,this);
              g.drawImage(back,0,200,this);
              g.drawImage(back,200,200,this);
              g.drawImage(back,400,200,this);
              g.drawImage(back,600,200,this);
              g.drawImage(back,0,400,this);
              g.drawImage(back,200,400,this);
              g.drawImage(back,400,400,this);
              g.drawImage(back,600,400,this);
              //initializes all to 0 in array numsUsed
              for(m=0;m<12;m++)
                   numsUsed[m]=0;
              //generates random pic array
              for(int k=0;k<12;k++)
                   int i=(int)(Math.random()*12);
                   if(numsUsed==0)
                        picUser[k]=picArray[i];
                        numsUsed[i]++;
                   else if(numsUsed[i]!=0)
                        k--;
         public void mousePressed(MouseEvent e){}
         public void mouseMoved(MouseEvent e){}
         public void mouseExited(MouseEvent e){}
         public void mouseClicked(MouseEvent e){

    yeah, i have clickability working now
    i DO have two arrays, picUser and picArray. picArray randomly transfers its images over to picUser, then I put this under mouseclicked():
         public void mouseClicked(MouseEvent e){
              int x=e.getX();
              int y=e.getY();
              Graphics g;
              g=this.getGraphics();
              g.setColor(Color.white);
              if ((x>=0&&x<=200)&&(y>=0&&y<=200))
                   g.drawImage(picUser[0],0,0,this);
    //there are 11 others just like above, so all images
              // end up beign defined too
    the problem I have now though, the code above allows u to click the upperleft hand card. sometimes, if you click it once, it wont flip. but if you click it again, it shows the card. any ideas? thanks for the help

  • Matching game for flex

    Hi! I am doing a memory game in flex.problem i faced is how to compare 2 images? I got 16 images with 8 pairs of the same. Example,if image1 is clicked and image 2 is clicked,the image will flipped back because its different. However,if image1 is clicked and another image1 is clicked,both image will stay flipped open.
    <mx:Image id="image1" x="480" y="177" width="100" height="100" source="assets/card_2.JPG" scaleContent="false" click="test.source = 'assets/torres.JPEG';setTotalClicks();"/>
    <mx:Image id="image2" x="623" y="438" width="100" height="100" source="assets/card_2.JPG" scaleContent="false" click="tests.source = 'assets/torres.JPEG';setTotalClicks();"/>

    Because i need to store those images in an array.The image path for the images is stored in an xml file.I want to know how to compare the cards(i mean the images). Something like if-else statement. If image1 is clicked and image2 is clicked, then this is wrong.So the cards will flipped back Because it is two different images. If both images is the same,both images will stay open. I am stuck in this and i am in serious help. Hope someone can assist and clarify me doubts. Thanks for the help.
    What i meant for the comparing of cards is something like this(but this is a concept of what i meant)
    private function reveal():void
        if(image1 == image1)
            cardFlipped = true;
        else(image1 == image2)
         cardFlipped = false;
    Below is how i declare the strings(the images of the card) in array.
    private function Image():void {
    gameArray.push("assets/pat.jpg");
    gameArray.push("assets/hunt.jpg");
    gameArray.push("assets/ger.jpg");
    gameArray.push("assets/ars.jpg");
    gameArray.push("assets/lamps.jpg");
    gameArray.push("assets/kaka.jpg");
    gameArray.push("assets/torres.jpg");
    gameArray.push("assets/vidic.jpg");
    gameArray.push(test.source);
    gameArray.push(tests.source);
    gameArray.push(kaka.source);
    gameArray.push(kaka1.source);
    gameArray.push(vidic.source);
    gameArray.push(vidic1.source);
    gameArray.push(gerrard.source);
    gameArray.push(gerrard1.source);
    gameArray.push(ars.source);
    gameArray.push(ars1.source);
    gameArray.push(lampard.source);
    gameArray.push(lampard1.source);
    gameArray.push(hunt.source);
    gameArray.push(hunt1.source);
    gameArray.push(pato.source);
    gameArray.push(pato1.source);

  • How can I save information (game variables) onto a computer? (cookies?)

    I have a "death match" game that I have hosted on freewebs.com (that is working perfectly). I want the game to store information on the computer that visits my site, including player experience and money so they can close out of their browser and then come back and have everything still there. How can I do this?

    coopkev2 wrote:
    Currently, I save a text file to my computer when it runs that contains the information I need. Is it possible to include that file inside the JAR and simply edit that?Not really. For one thing, editing the jar would require the same permissions as editing any other file. Secondly, it makes deployment really complicated when the contexts of jars are changed by the users. Third, the jar might get overwritten when the user downloads the page again later. If you're going to save the data in a file on the user's computer, it's easier just to make it a plain text or properties file (or XML if you really want to make it more complicated) in the user's home directory or a similar location (for example, if the user is using Windows, you could put it in home/Application Data/ or whatever it's called.
    I suspect that cookies are easier still though, but I haven't tried it either.
    In the past when I've had to do things like this, I found it easier to store the data on the web server using a CGI script, but I don't know if freewebs even allows that.

  • Drag and Drop Games

    I'm interesting in creating some simple games which require
    drag and drop and gives some results/points
    is this possible with captivate 3? I read somewhere in some
    reviews that it is possible with matching games.
    Has anyone any experience or knowledge in this area?

    Hi edumacator and welcome to our community
    Certainly the Captivate Question type of Matching offers the
    ability to click and drag, but that is limited to the text used.
    There is another Captivate Question type of Sequence that may be
    used, but it too is limited to the text.
    The bottom line is that there is no way I'm aware of with
    Captivate alone, that you may create a drag and drop using images.
    (I'm guessing that you don't wish to offer simple text and would
    prefer images that would be clicked and dragged)
    You would have to resort to Flash for something like that.
    Cheers... Rick

  • How do I find games for iPod 5.5 80GB in the iTunes Store?

    How do I find games for iPod 5.5 80GB in the iTunes Store?

    The german iTunes Support has informed me that I am also under the Apps matching games for my iPod 5.5 80GB.

  • For my game's better performance, should i use Starling?

    I heard that using Starling gives better performance than just using Flash pro Native (GPU mode??) when playing flash games on smartphones.
    However, according to this article, there is not much difference between GPU mode and Starling although its recorded in late 2012.
    http://esdot.ca/site/2012/runnermark-scores-july-18-2012
    My game is tile matching game that uses vectors and many different tile pictures. also upto 64 tiles can be present at the same time.
    I don't know how much more performance Starling would provide, but if starling would give more performance, i don't know if its worth the time and effort to learn how to use Starling and change my current codes to use Starling?

    This is a test between multiple frameworks that all use Stage3D, which is basically the means to get any hardware benefits from the GPU.
    These frameworks do nothing else than helping to streamline your game development and doing some optimizing (object pooling etc.) under the hood.
    The basic concept is to have spritessheets (for 2D) , that are also called "Textureatlas`" instead of the "old" method of having  separated MovieClips/sprites.
    If you dont use this method in your game, then you will have indeed no benefit from Starling or any other Stage3D framework.
    So if you your game is coded "like in the old days" you would have to rewrite some parts of it and convert all MovieClips to Spritesheets to benefit from the GPU.
    The real Performance-comparison reads like this:
    CopyPixels (the PreStage 3D method) had a Perfomance gainof 500%/ SpriteSheet (Stage3D) 4000% compared to the "old way".
    It all depends if you`re unhappy with your games curretn performance on current mobile devices or not.

  • Arraying a series of colors

    hi all, i'm facing a problem working on a matching game and wonder if anybody could point me in the right direction.
    see, i have a 9x10 gridboard with 90 pieces to match, and there're 45 pairs of pieces of the same Oval look, except with different colors. i am implementing 9 different colors, so that each piece will have 5 pairs to match up when the player plays the game, meaning a total of 10 pieces for each different color. the thing is, i'm not sure if there is any way to array my colors (the basic ones, like white, red, magenta, cyan etc.) so that I can run a loop to allow the computer to place each piece behind a grid on the board.
    so far, my coding looks like:
    final int SETS = 10;
    final int COLORS = 9;
    for(int draw = 0; draw < SETS; draw++)
         for(int max = 0; max < COLORS; max++)
              int x = (int) (java.lang.Math.random()*GRIDCOLS);
              int y = (int) (java.lang.Math.random()*GRIDROWS);
              if(position[x][y] == EMPTY)
                   g.setColor(Color.white);
                   shape(x,y); //calls the shape to be drawn
                   position[x][y] = FILLED;
              else if(position[x][y] != EMPTY)
                   max--;
    the part in question lies in that bolded sentence. i do not know how to change colors for that part so that the loop creates one piece of each different color, before looping that 10 times.
    can anybody help me a little?

    There is a Color c'tor, which uses a single int value. If you write the colors as hex its similar to the way you specify colors in html or drawing applications.
    The format is 0xRRGGBB (red, green, blue).
    Eg 0xFF0000 = red, 0xCCCCCC=some light gray etc.
    You can easily put those numbers into one array and use those numbers for constructing the color object.
    int []col={0xFF0000,0x00FF00,0x0000FF};
    g.setColor(new Color(col[x]));Easy, ne? :)

  • Third Party X-Fi Mode Switching Softw

    I recently ran across an issue which is documented in this thread:
    http://forums.creative.com/creativelabs/board/message?board.id=soundblaster&message.id=53809
    What I found out raised an interesting possibility: it should fairly easy to make software to switch modes with X-Fi sound cards. The community only needs to work together to make some third party software to get the job done.
    When modes are switched for the X-Fi, the following folder is utilized (on XP, at any rate):
    C:\Documents and Settings\All Users\Application Data\Creative\Spi\
    {00000005-00000000-00000007-000002-00000005-00202}\Modes
    The files which are involved are named as such:
    CTXFICMu.ini
    CTXFICMu.rfx
    CTXFIEMu.ini
    CTXFIEMu.rfx
    CTXFIGMu.ini
    CTXFIGMu.rfx
    The two 'CTXFICMu' files correspond to Audio Creation Mode, while the 'CTXFIEMu' files match Entertainment Mode and the 'CTXFIGMu' files match Game Mode.
    The *.ini files are text files containing mixer information for each mode, and the *.rfx files are binary files. I suspect the *.rfx files may be related to the programmable nature of the audio chip, but I haven't messed around with them too much since it is outside the scope of my abilities.
    The CTXFISPI.EXE process is making the reads and writes to these files, which seems to indicate that it does the dirty work when it comes to changing the modes of the card.
    If the community can determine how to encourage CTXFISPI.EXE to switch modes (or if Creative decides to be forthcoming with the details), then third party apps can be developed to make the switch easier (tray app menu), faster (no animations), more efficient, and seamless (a scriptable method for changing modes would be great!).
    Additionally, it shouldn't be too hard to make software which allows for per user mixer settings with the X-Fi. It is only a matter of switching in a particular user's *.ini and *.rfx files to the Modes directory before CTXFISPI.EXE loads them at log in, and then saving the same files again at log off.
    So, I have a request for Creative: would you please release some documentation about how to switch modes programmatically or even from the command line?
    I'm also throwing out this challenge to the community: if Creative is unable or unwilling to release the information needed, then let's get under the hood of the X-Fi and decode mode switching ourselves. If someone can expose how mode switching works, then I would be more than happy to whip up an interface for it.
    Drailex_Mauder

    I have created a quick fix for the lack of mode switching options currently available. I would like to program something more feature rich in C, but for now VBScript is better than nothing. If we don't get a leg up from Creative, it may be a while as I will have to look into reverse engineering the software. This would require learning some new skills on my part.
    These scripts work by loading the Creative Audio Console and pushing the appropriate keystrokes to change the mode. It is a dirty way to get the job done, but until more is known about how to change modes through CTXFISPI.EXE these scripts will have to do.
    I am releasing these scripts under a BSD licence, which appears at the end of this message. Kinda silly for such small blocks of code, but it's there more to cover my assets with the legal disclaimer than anything else.
    Copy each block of code into a separate text file and make sure that the file name ends in a VBS extension. Any up to date 2000 or XP machine should run these scripts no problem. I have placed shortcuts to the scripts in my Quick Launch Toolbar so that I can quickly change modes.
    You could also add them to a script which switches to game mode, runs your game, and then switches back to entertainment mode.
    VERY IMPORTANT: The Creative Audio Console must not be running when you run one of these scripts, otherwise the script will randomly change your settings.
    And once again, if anyone can assist in determining how to coax CTXFISPI.EXE into switching modes, this will take things a long way to creating 3rd party mode switching software which meets the goals of my original post in this thread.
    ----- Start Of "Entertainment Mode.vbs" -----
    Option Explicit
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell" )
    ' Start up the Audio Console
    WshShell.CurrentDirectory = "C:\Program Files\Creative\AudioCS"
    WshShell.Run("CTAudCS.exe" )
    ' On slower machines the Sleep value may need to be increased.
    WScript.Sleep(500)
    ' Send the keystrokes to change the mode
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{RIGHT}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{ENTER}" )
    WScript.Quit(0)
    ----- End Of "Entertainment Mode.vbs" -----
    ----- Start Of "Game Mode.vbs" -----
    Option Explicit
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell" )
    ' Start up the Audio Console
    WshShell.CurrentDirectory = "C:\Program Files\Creative\AudioCS"
    WshShell.Run("CTAudCS.exe" )
    ' On slower machines the Sleep value may need to be increased.
    WScript.Sleep(500)
    ' Send the keystrokes to change the mode
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{RIGHT}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{DOWN}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{ENTER}" )
    WScript.Quit(0)
    ----- End Of "Game Mode.vbs" -----
    ----- Start Of "Audio Creation Mode.vbs" -----
    Option Explicit
    Dim WshShell
    Set WshShell = CreateObject("WScript.Shell" )
    ' Start up the Audio Console
    WshShell.CurrentDirectory = "C:\Program Files\Creative\AudioCS"
    WshShell.Run("CTAudCS.exe" )
    ' On slower machines the Sleep value may need to be increased.
    WScript.Sleep(500)
    ' Send the keystrokes to change the mode
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{RIGHT}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{UP}" )
    WshShell.SendKeys("{DOWN}" )
    WshShell.SendKeys("{DOWN}" )
    WshShell.SendKeys("{TAB}" )
    WshShell.SendKeys("{ENTER}" )
    WScript.Quit(0)
    ----- End Of "Audio Creation Mode.vbs" -----
    * Copyright (c) 2006 Breen Ouellette
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions are met:
    * . Redistributions of source code must retain the above copyright notice,
    * this list of conditions, and the following disclaimer.
    * 2. Redistributions in binary form must reproduce the above copyright notice,
    * this list of conditions, and the following disclaimer in the documentation
    * and/or other materials provided with the distribution.
    * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
    * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Message Edited by Drailex_Mauder on 03-4-20060:35 PM
    Message Edited by Drailex_Mauder on 03-4-20060:56 PM

  • Need Help with VB

    Hi everyone,
    I´m new to Visual Basic and I need some help here developing a matching game, I can´t get the two equal images to stay enabled, and the the ones who aren´t the same to turn around again... If someone could please help me with that, I would be very much apreciated
    Here is my code so far...
    Public Class Form2
    Dim clicou As Boolean = False
    Dim Image1, Image2 As String
    Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click
    If clicou = False Then
    clicou = True
    PictureBox1.Image = My.Resources._127543_0055
    Image1 = "a"
    Else
    clicou = False
    PictureBox1.Image = My.Resources._127543_0055
    Image2 = "a"
    End If
    End Sub
    Private Sub PictureBox2_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox2.Click
    If clicou = False Then
    clicou = True
    PictureBox2.Image = My.Resources._127543_0055
    Image1 = "a"
    Else
    clicou = False
    PictureBox2.Image = My.Resources._127543_0055
    Image2 = "a"
    End If
    End Sub
    Private Sub PictureBox3_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox3.Click
    If clicou = False Then
    clicou = True
    PictureBox3.Image = My.Resources._377438_1266099892543_full
    Image1 = "b"
    Else
    clicou = False
    PictureBox3.Image = My.Resources._377438_1266099892543_full
    Image2 = "b"
    End If
    End Sub
    Private Sub PictureBox4_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox4.Click
    If clicou = False Then
    clicou = True
    PictureBox4.Image = My.Resources._377438_1266099892543_full
    Image1 = "b"
    Else
    clicou = False
    PictureBox4.Image = My.Resources._377438_1266099892543_full
    Image2 = "b"
    End If
    End Sub
    Private Sub PictureBox5_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox5.Click
    If clicou = False Then
    clicou = True
    PictureBox5.Image = My.Resources.timon_i_pumba2
    Image1 = "c"
    Else
    clicou = False
    PictureBox5.Image = My.Resources.timon_i_pumba2
    Image2 = "c"
    End If
    End Sub
    Private Sub PictureBox6_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox6.Click
    If clicou = False Then
    clicou = True
    PictureBox6.Image = My.Resources.timon_i_pumba2
    Image1 = "c"
    Else
    clicou = False
    PictureBox6.Image = My.Resources.timon_i_pumba2
    Image2 = "c"
    End If
    End Sub
    Private Sub PictureBox7_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox7.Click
    If clicou = False Then
    clicou = True
    PictureBox7.Image = My.Resources.recess_wall1_1024
    Image1 = "d"
    Else
    clicou = False
    PictureBox7.Image = My.Resources.recess_wall1_1024
    Image2 = "d"
    End If
    End Sub
    Private Sub PictureBox8_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox8.Click
    If clicou = False Then
    clicou = True
    PictureBox8.Image = My.Resources.recess_wall1_1024
    Image1 = "d"
    Else
    clicou = False
    PictureBox8.Image = My.Resources.recess_wall1_1024
    Image2 = "d"
    End If
    End Sub
    Private Sub PictureBox9_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox9.Click
    If clicou = False Then
    clicou = True
    PictureBox9.Image = My.Resources.lilo_n_stitch_by_chocolatecherry_d337mnv
    Image1 = "e"
    Else
    clicou = False
    PictureBox9.Image = My.Resources.lilo_n_stitch_by_chocolatecherry_d337mnv
    Image2 = "e"
    End If
    End Sub
    Private Sub PictureBox10_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox10.Click
    If clicou = False Then
    clicou = True
    PictureBox10.Image = My.Resources.lilo_n_stitch_by_chocolatecherry_d337mnv
    Image1 = "e"
    Else
    clicou = False
    PictureBox10.Image = My.Resources.lilo_n_stitch_by_chocolatecherry_d337mnv
    Image2 = "e"
    End If
    End Sub
    Private Sub PictureBox11_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox11.Click
    If clicou = False Then
    clicou = True
    PictureBox11.Image = My.Resources.Jake_Long__13__by_dannyandoxeld
    Image1 = "f"
    Else
    clicou = False
    PictureBox11.Image = My.Resources.Jake_Long__13__by_dannyandoxeld
    Image2 = "f"
    End If
    End Sub
    Private Sub PictureBox12_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox12.Click
    If clicou = False Then
    clicou = True
    PictureBox12.Image = My.Resources.Jake_Long__13__by_dannyandoxeld
    Image1 = "f"
    Else
    clicou = False
    PictureBox12.Image = My.Resources.Jake_Long__13__by_dannyandoxeld
    Image2 = "f"
    End If
    End Sub
    Private Sub PictureBox13_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox13.Click
    If clicou = False Then
    clicou = True
    PictureBox13.Image = My.Resources.Disney_Movies_Brother_Bear
    Image1 = "g"
    Else
    clicou = False
    PictureBox13.Image = My.Resources.Disney_Movies_Brother_Bear
    Image2 = "g"
    End If
    End Sub
    Private Sub PictureBox14_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox14.Click
    If clicou = False Then
    clicou = True
    PictureBox14.Image = My.Resources.Disney_Movies_Brother_Bear
    Image1 = "g"
    Else
    clicou = False
    PictureBox14.Image = My.Resources.Disney_Movies_Brother_Bear
    Image2 = "g"
    End If
    End Sub
    Private Sub PictureBox15_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox15.Click
    If clicou = False Then
    clicou = True
    PictureBox15.Image = My.Resources.brandy_and_mr__whiskers_by_camisanhueza12_d5e8a8u
    Image1 = "h"
    Else
    clicou = False
    PictureBox15.Image = My.Resources.brandy_and_mr__whiskers_by_camisanhueza12_d5e8a8u
    Image2 = "h"
    End If
    End Sub
    Private Sub PictureBox16_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox16.Click
    If clicou = False Then
    clicou = True
    PictureBox16.Image = My.Resources.brandy_and_mr__whiskers_by_camisanhueza12_d5e8a8u
    Image1 = "h"
    Else
    clicou = False
    PictureBox16.Image = My.Resources.brandy_and_mr__whiskers_by_camisanhueza12_d5e8a8u
    Image2 = "h"
    End If
    End Sub
    End Class
    Atenciously, lotok97 

    Made a small matching game example for you to look at, I have no doubt that the true experts here will probably laugh at my ineptitude, but it works and can maybe give you some ideas.
    (Made this in 10 minutes, so no error checking what so ever)
    If you add a tablelayoutpanel, a button,  a numeric updown, and an imagelist  to a form, and fill the imagelist with your pictures (Unique), you can just paste this code and it should work
    Public Class Form8
    Dim Images As New List(Of Integer)
    Dim FirstPic As myPicturebox
    Dim first As Boolean = True
    Dim BasePic As Image
    Private Sub Form8_Load(sender As Object, e As EventArgs) Handles Me.Load
    BasePic = Image.FromFile("c:\temp\moi.jpg") 'Insert your backside picture here
    NumericUpDown1.Increment = 2
    TableLayoutPanel1.AutoSize = True
    TableLayoutPanel1.AutoSizeMode = Windows.Forms.AutoSizeMode.GrowAndShrink
    End Sub
    Private Sub Shuffle(Of T)(list As IList(Of T))
    Dim r As Random = New Random()
    For i = 0 To list.Count - 1
    Dim index As Integer = r.Next(i, list.Count)
    If i <> index Then
    Dim temp As T = list(i)
    list(i) = list(index)
    list(index) = temp
    End If
    Next
    End Sub
    Private Sub ClearNoDisabled(firstselect As myPicturebox)
    For Each pb As myPicturebox In TableLayoutPanel1.Controls
    If pb.disabled = False Then
    pb.Image = BasePic
    End If
    Next
    End Sub
    Private Sub PictureBox_Click(sender As Object, e As EventArgs)
    Dim mypb As myPicturebox = DirectCast(sender, myPicturebox)
    If mypb.disabled = True Then Exit Sub
    If first = False Then
    mypb.Image = ImageList1.Images(mypb.ImageIndex)
    If FirstPic.ImageIndex = mypb.ImageIndex Then
    FirstPic.disabled = True
    mypb.disabled = True
    End If
    first = True
    Else
    ClearNoDisabled(mypb)
    mypb.Image = ImageList1.Images(mypb.ImageIndex)
    FirstPic = mypb
    first = False
    End If
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim rnd As New Random()
    Dim rndIm As Integer
    While Images.Count < (NumericUpDown1.Value / 2)
    rndIm = rnd.Next((NumericUpDown1.Value / 2))
    If Not Images.Contains(rndIm) Then
    Images.Add(rndIm)
    End If
    End While
    Images.AddRange(Images.ToArray)
    Shuffle(Images)
    TableLayoutPanel1.ColumnCount = Int(NumericUpDown1.Value / 4)
    TableLayoutPanel1.RowCount = ((NumericUpDown1.Value - TableLayoutPanel1.ColumnCount) / 2) + 1
    For x As Integer = 0 To NumericUpDown1.Value - 1
    Dim y As New myPicturebox
    y.Image = BasePic
    y.SizeMode = PictureBoxSizeMode.StretchImage
    y.ImageIndex = Images(x)
    AddHandler y.Click, AddressOf PictureBox_Click
    Me.TableLayoutPanel1.Controls.Add(y)
    Next
    End Sub
    End Class
    Public Class myPicturebox
    Inherits PictureBox
    Public Property Disabled As Boolean = False
    Public Property ImageIndex As Integer
    End Class

  • Switch conditionals

    Hello all i'm working on a homework assignment in where we created a match game.  It's up to me to figure out how to tell the action script which difficulty the user play the game at.  There are 3 buttons easy, mediym, hard.  Each one lays out an increased number of cards say 4 for easy 8 for medium etc. 
    we are supposed to use the switch conditional to do this.  My problem is how does the switch know which button was clicked? 
    here is the code so far, it is only set up for the easy at the moment.  It works fine until I tried to set up the switch.
    Thanks for any help you might be able to give.
    package {
              import flash.display.MovieClip;
              import flash.display.Sprite;
              import flash.events.*;
              import flash.text.TextField;
              import flash.utils.Timer;
              import flash.utils.getTimer;
              import flash.media.Sound;
              public class Match extends MovieClip {
                        var showingCard:Card = null;
                        const DELAY_TIME=1000;
                        public function Match() {
                                  trace( "Match" );
                                  //introscreen.btnMenu.btnEasy.addEventListener
                                  addChild(introScreen);
                        // if a card is showing showingCard refers to it
                        //otherwise card
                        introScreen.btnMenu.btnEasy.addEventListener(MouseEvent.CLICK, onClickButton);
                        }// constructor end
                        function onClickButton(e:MouseEvent):void{
                                  trace("onClickButton");
                                  switch(e.target.level){
                                  case "Easy":
                                  layoutCards( 2 );
                                  break;
                        function layoutCards(gridSize:int):void{
                                  trace("layoutCards");
                                  //put gameScreenOnTop
                                  addChild(gameScreen);
                                  //creat deck of valid faceValues
                                  var deck:Array=[];
                                  var lastFrame:int = gridSize*gridSize/2+1;
                                  for (var k:int=2; k<=lastFrame;k++){
                                            deck.push(k,k);
                                  trace(deck);
                                  //layout cards
                                  for (var i:int=0; i<gridSize; i++){
                                            for (var j:int=0; j<gridSize; j++){
                                                      trace(i,j);
                                                      var card:Card = new Card();
                                                      //size
                                                      card.width = stage.stageWidth/gridSize;
                                                      card.height= stage.stageHeight/gridSize;
                                                      //location
                                                      card.x= i*card.width;
                                                      card.y= j*card.height;
                        //********** moi importante  assign a face value, drawn from the deck randomly
                                                      //card.faceValue=randomInteger(2,19);
                                                      card.faceValue=deck.splice(randomInteger(0, deck.length-1),1);
                                                      //listen
                                                      card.addEventListener(MouseEvent.CLICK, onClickCard);
                                                      //add
                                                      card.gotoAndStop(1)
                                                      gameScreen.addChild(card);
                                            }//j
                                  }//i
                        }// end of layout Cards method
                        //makecard clickable start
                        function onClickCard (e:MouseEvent){
                                  trace("onClickCard");
                                  var clickedCard:Card = Card(e.target);
                                  //flip clicked card over
                                  //clickedCard.visible=false;
                                  //Click on first card in pair
                                  //3 cases
                                  // 1 clicked card is the first in the pari
                                  //show card and remomber it
                                  //make it not clickable for now
                                  if ( showingCard==null){
                                            trace("firstcard")
                                            clickedCard.gotoAndStop(clickedCard.faceValue);//external
                                            showingCard = clickedCard; // internal
                                            clickedCard.removeEventListener(MouseEvent.CLICK, onClickCard);
                                  //2 a - clicked Card is a second in pair, and mathces the firstmatch
                                  //take both away
                                  else if ( clickedCard.faceValue == showingCard.faceValue){
                                  trace("match")
                                  gameScreen.removeChild(clickedCard);
                                  gameScreen.removeChild(showingCard);
                                  showingCard=null;
                                  //2b - clickedCard is second, and not a match for first.
                                  //turn both over
                                  else {
                                            clickedCard.gotoAndStop(clickedCard.faceValue);
                                            //freex for a short period of time
                                            addChild(blockScreen);
                                            var timer:Timer = new Timer(DELAY_TIME,1);
                                            timer.addEventListener(TimerEvent.TIMER,
                                                      function onTimer(e:Event){          //annonymus function
                                            //delay this code
                                            clickedCard.gotoAndStop(1);
                                            showingCard.gotoAndStop(1);
                                            //make showing Card clickable
                                            showingCard.addEventListener(MouseEvent.CLICK, onClickCard);
                                            showingCard=null;
                                            addChild(gameScreen);
                                  timer.start();
              } // class Match
    }  // package
    when I click the easy button in the swf file I get this message.
    ReferenceError: Error #1069: Property level not found on flash.display.SimpleButton and there is no default value.
              at Match/onClickButton()

    The switch statement is checking the "e.target.level" to see which option was selected, the level portion of that being the word "Easy" or whatever else.  e.target is pointing to the object that dispatched the event, which appears to be a SimpleButton object.  But a SimpleButton object cannot have properties created for it like a movieclip can, so to be checking for its "level" property is looking for something it cannot normally have.
    Where do you assign the level property, to what object do you assign it?
    (hindsight: didn't mean to jump on Dave's response.  This answers one wondering of mine though... I always check before submitting a post to see if someone has answered while I was devising an answer, and normally go back out to the forum to check that... if so, I don't post unless there's a stark difference is responses  This time I just went back one level and saw no responses, so I figured none were given... it looks like going back to forum is the right way to go)

  • New Qos and Firewalls URL Options for gamers for Win10

    This is more of a gamer thing.
    I'm wondering if there's a way to implement URLs ( instead of IPs ) with ports into Firewalls and QoS? Naturally I don't want to open ports for all IPs and determining all IPs for some sites, when there exist are multiple worlds, can't always be determined.
    It would be nice to say, for all *.SomeGame.com allow this port to be open.
    Additionally, if this rule is active, give it higher priority than video or voice....
    I have seen some gamer systems where their router and firewall have an open port for their games :\ Also, usually most gamers will have Skype/Twitch/Netflix/Hulu open whilst gaming. Naturally, they don't want lag for their games, and would prefer their gaming
    to have priority over any voice or video.

    You do not need to setup anything like that in any windows for gaming application...even if I running torrent + dc++ client I have no lags or freezes so on. So if you want to setup QoS just find appropriate guide for specific application. And
    btw URL's doesn't match game server IP's & port's ranges, so it is never been released under QoS development. Cause QoS is about how to manage your existing LAN bandwidth for applications on your OS installation.

  • How to use iPad in a Spanish Classroom?

    Hello,
    My mom is a high school Spanish teacher and is thinking about getting an iPad for her to use in her classroom. Since it is a significant investment in a device, I would like to know the most useful ways that she might be able to use it to teach Spanish.
    Helpful details:
    -We are thinking about getting the black 32 GB Wi-Fi only iPad 2 (is 32 GB enough if you want to do a lot of video recording?)
    -Her classroom computer is Windows XP and she might be able to bring in her laptop (Windows 7)
    -Her classroom has a projector with a VGA input (can you do video mirroring with that?)
    Also, does anybody know of any apps that would be useful? I have found a few on my iPod touch, but I want to know if there are any iPad-only apps (like a Spanish newspaper) that I otherwise wouldn't be able to access on my iPod touch. In addition, she wants to find a programmable concentration/memory game app since she hasn't found any by searching the App Store on my iPod touch.
    Thank you for any suggestions,
    O.C.

    Owen-
    With regard to video, the iPad 2 does mirroring with both the HDMI and VGA adapters.  One problem i"ve noticed, is that the weight of the cable tends to unplug the adapter from the iPad.  This might be a problem when walking around holding the iPad.  Someone suggested duct tape!
    Fred

  • Sound in Java Program - Tetris

    Hello, I am a student and I just completed my final assignment for my Java class, I was supposed to make a tetris program, im sure you guys have heard of these types of assignments, anyways I would like to add some extra stuff to the assignment, namely, sound, a background song, and a click noise when blocks drop/a line is cleared, I already know how I will implement these things, I just dont know how to work with sound in Java, so if you guys could link to a few tutorials I would really appreciate it, I don't want to use anything outside of the api though so no 3rd party stuff.
    I also am wondering about how to implement some cool things I was thinking about doing, for instance:
    Its been said that there is no way to win tetris because your destined to lose eventually, for that reason most people add a scoreboard to their game so that they can have high scores as a way for making up for not winning, im adding a second element to that, this is something that I already know how to implement, as soon as the game ends, if you are on the high score table, you are presented with a new death match game which is played at the hardest level and if you are able to score half of the points that you scored on the original game you are a winner at which point comes the hard part:
    I was thinking about adding some effects like when you win solitaire in windows and those firework style things go off, except taking that to a new level, I dont know if this is possible, I don't know how to do the fireworks style thing, also I wanted to do it so that the fireworks encompass the whole screen not just the original game screen, for this I was thinking maybe a fully transparent frame that is auto maximized and closes after the animation is done, if anyone could help me with implementing something like this I would really appreciate it.

    if anyone could help me with implementing something like this I would really appreciate it.This forum is conducive for providing help where one asks a specific question about some aspect of Java development. Up to this point, you've described your project and some high-level ideas about it, but you're not clear on what help you need. If it's general end-to-end project assistance, you'd do better to find a helpful peer or start up an open-source project, as this forum is not appropriate for such a thing. If you ho have a specific question or problem, please feel free to ask, but be sure to post the necessary detail for others to help.
    ~

Maybe you are looking for

  • Script error for IE7 on WD Abap development

    Hi, My browser is IE 7.0. I'm developing wdb dynpro abap application. When i select a view and press Show/Hide Layout Preview, script error occures and ie error page is displayed. How can i solve this problem? Thanks.

  • Bridge CS5 corrupts CR2 files when extracting thumbnails (Win8.1 64bit)

    I'm using Design Premium CS5 on two computers -  Lenovo T510 with Windows 7 (64 bit) and a Lenovo Yoga 2 Pro with Windows 8.1 (64 bit).  Everything works fine on the Win 7 machine.  On the Yoga, if I download Raw files, they look fine until Bridge be

  • Formatting HD

    My Laptop is trashed but I want to Format the HD before I discard it. How do I go about doing this I went into Disk Utility but erase is grayed out is there some special technique I'm missing???

  • Named Destinations intermittent

    Greetings all, In lieu of a full online help system, we are using links in the product interface to open a FrameMaker9 sourced PDF at the location of hypertext markers. This generally works well, except I now have the following problem: The first 10

  • N70 ME functions problem

    I am using Nokia N70 MusicEdition. but it functions very slowly. can anyone of you plz tell me that is there any way to make it faster? then plz let me know about the way. Thanks.