Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 1 of 1

Setting up the State Identification Game

This is a discussion on Setting up the State Identification Game within the MP2K Magazine Articles forums, part of the Map Forums category; The "State Identification Game" was released in 2012 and has gotten a lot of attention from both gamers and developers. ...

  1. #1
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Setting up the State Identification Game

    The "State Identification Game" was released in 2012 and has gotten a lot of attention from both gamers and developers.

    The concept is the game is very simple. The game shows the outline of a random U.S. state and asks you to identify the state. The outline of the state and surrounding states as well as water bodies (major lakes and oceans) can all be used as clues to identify the state. It sounds simple, but I did in fact miss a few before practicing a little bit.


    The compiled game can be downloaded here --

    State Identification Game Using MapPoint - Can You Do It? - Blogs - MapPoint Forums

    In this article, we will publish the code used to set up the game as well as the code for the game itself.

    Game Setup

    There were two main steps involved in setting up the game and making sure it would work. 1) Figuring out the MapFeatures layers & codes to turn off labels and extraneous symbols. (Obviously the purpose of the game would be defeated if the name of the state was prominently displayed on the map!) and 2) Ensure that the map zooms to the correct geography for all states. There were a couple states such as "New York" for which MapPoint would zoom to the city of the same name rather than the state.

    So, the first thing I tackled was the MapFeatures layer names and code. MapFeatures is MapPoint's internal object name for controlling the map layers which is done in the interface via the Map Settings pane introduced with MapPoint 2010 ( Cool MapPoint 2010 Maps! ).

    This is the code used to list all the layers and the current detail level.

    Code:
    Private Sub EnumerateMapFeatures()
      Set APP = CreateObject("MapPoint.Application")
      APP.Visible = True
      Set MAP = APP.ActiveMap
      Dim MF As MapFeature
      Stop 'to set some detail levels
      For Each MF In MAP.MapFeatures
        Debug.Print MF.Name & "|" & MF.Index & "|" & MF.DetailLevel
      Next
      '1 = default, 2 = more, 3 = none
    End Sub
    I pasted the list into an Excel worksheet to view the list. I realized that to turn off all "label" layers, I would simply need to see if the last six characters in the layer names is "Labels". Also, the map looks better with city points turned off, so the resulting code to actually manipulate the labels is:

    Code:
    Private Sub TurnOffAllLabels()
      Dim MF As MapFeature
      For Each MF In MAP.MapFeatures
        If Right(MF.Name, 6) = "Labels" Or MF.Name = "Populated Places - Town/Other Place (0 - 99,999) - Symbols" Then MF.DetailLevel = 3
      Next
    End Sub
    For more information on programming with the MapFeatures collection, see: http://www.mp2kmag.com/a158--mapfeatures.mappoint.html

    To loop over a list of the U.S. states to test to make sure the program zooms to the correct geography, the code is below. You can see the code to wait three seconds before going to the next state.

    Code:
      Do While Cells(row, 1) <> ""
        Set loc = MAP.FindPlaceResults(Cells(row, 1) & ", United States")(1)
        loc.Goto
        
        newHour = Hour(Now())
        newMinute = Minute(Now())
        newSecond = Second(Now()) + 3
        waitTime = TimeSerial(newHour, newMinute, newSecond)
        Application.Wait waitTime
        
        row = row + 1
      Loop
    Download the spreadsheet with source code discussed above here http://www.MapForums.com/MapPoint_Game_Setup.zip

    You can see there is also a worksheet listing countries. The game could easily be adapted as a Country Identification Game! Both the Country list and the U.S. State list data were copied from Wikipedia.

    In the next article we will discuss the actual code for the game.
    Last edited by Eric Frost; 01-07-2013 at 11:39 AM.
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. State Identification Game Using MapPoint & Excel
    By Eric Frost in forum Development
    Replies: 0
    Last Post: 11-01-2012, 04:51 PM
  2. State Identification Game Using MapPoint
    By Eric Frost in forum News and Announcements
    Replies: 0
    Last Post: 10-05-2012, 08:46 AM
  3. Developing with MapPoint and Excel - Getting Started
    By Eric Frost in forum MP2K Magazine Articles
    Replies: 19
    Last Post: 11-22-2010, 09:18 PM
  4. Shall We Play A Game? UMapper’s Virtual Earth Game
    By VirtualEarth MSDN Blog in forum Bing Maps Blogs & Tweets
    Replies: 0
    Last Post: 06-02-2009, 01:30 PM
  5. Shall We Play A Game? UMapper’s Virtual Earth Game
    By VirtualEarth MSDN Blog in forum Bing Maps Blogs & Tweets
    Replies: 0
    Last Post: 05-12-2009, 10:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66