public void act() 
    {
        // Add your action code here.
        try {
            if ( null != co ){
                 m = new Message("Check coin");
                 getWorld().addObject(m , getX(), getY());
                 Greenfoot.delay(delay);
                 getWorld().removeObject(m);                
                if ( co.isReal){
                    m = new Message("Coin is real");
                    getWorld().addObject(m , getX(), getY() );
                    Greenfoot.delay(delay);
                    getWorld().removeObject(m);
                    if ( co.getValue() == 25 ) {                    
                        m = new Message( "Thanks! Here is your gumball!");
                        getWorld().addObject( m , getX(), getY() );                    
                        if(Greenfoot.getRandomNumber(2) == 1){
                            gp.ejectGumball();
                        }else {
                            rp.ejectGumball();
                        }
                        Greenfoot.delay(100);
                    }else{                    
                        m = new Message( "Coin is less than quarter! Bye!" );
                        getWorld().addObject( m , getX(), getY() );               
                    }
                }else{
                    m = new Message( "Coin is fake! Bye!" );
                    getWorld().addObject( m , getX(), getY() );  
                }
                co = null;
            }
        } catch ( Exception e ){
            e.printStackTrace();
            m = new Message( "Something is Wrong");
            getWorld().addObject( m , getX(), getY() );
        }
    }