Using templates can greatly simplify the process of creating or adding elements to a game. As such, this tutorial turns out to be trivial, but you may want to review it so you are aware of what is available.
- Open the File menu, and from the "New" pop-up menu, select "Scrolling Game Development Kit Sample Project".
- Save the project by selecting "Save Project" from the file menu. The environment needs to know where to put all the project-related files (including the compiled executable), so it's necessary to save the project to a particular location before running it in order to determine where the project's files will reside.
When you run the project, you will notice that you have the option to begin a single or multi-player game. If you begin a multi-player game, the controls for the second player (which can be seen and adjusted in the Tools->Options menu) will control a second player in the right-hand pane. You can define your own project templates that appear in the New menu by saving a project in the Library\Projects folder. It is recommended that source code that is the same as the default be deleted from the template project because the environment will automatically add the built-in source code when creating a project from a template.
Adding another player To demonstrate a bit more about how multi-player games work, consider the following steps that are required to change the "2 player game" option into a "3 player game" option:
- Change the 2 to a 3 on the menu screen
- In the main project tree view, expand "Maps", "Menu", "Layers", "Letters" and double-click on "Editor".
- Select the "3" tile in the "Tiles" tab.
- Click on the "2" to replace it with "3".
- Increase maximum number of players and views to 3.
- From the project tree, Expand "Counters" and select "Players".
- Edit the "Players" counter by selecting "Properties" from the view menu or "Edit" from the context menu, or by double-clicking "Players".
- Change "Maximum" from 2 to 3.
- Select the top/root node of the project tree. This node contains project-wide properties.
- Edit this node by selecting "Properties" from the view menu, selecting "Edit" fromt he context menu, or double-clicking it.
- Change MaxPlayers to 3.
- Change MaxViews to 4. (There is no 3-player view layout.)
- Create a graphic to split views horizontally
- Create a new graphic sheet by selecting "Graphic Sheets" in the project tree and selecting "New Object" from the File menu or "New" from the context menu or toolbar.
- Enter the name "HSplitter", and specify a CellHeight of 15, CellWidth of 128, Columns of 1 and Rows of 2.
- Add the graphic sheet and edit it.
- Select "Gradient Fill" from the Tools menu.
- Un-check "Anti-Alias" in the tools menu.
- Right-click on the color white in the color selector panel so select white as the "Solids" color.
- In the magnified view pane, drag the mouse from coordinate 0,7 to 0,15 and release.
- Select the bottom cell from "Cell Manager"
- Click the "Store to Selected Cell(s)" button in the Cell Manager pane.
- Add a new Frameset in the project tree.
- Enter the name "HSplitterFrames" for the new frameset.
- Select "HSplitter" the the "Graphic Sheet" dropdown list.
- Select both cells from the "HSplitter" graphic sheet and add them to the frameset by clicking the arrow button in the toolbar or selecting "Add Selected Cells to Frameset" from the "Frameset" menu.
- Add a new Tileset in the project tree.
- Enter the name "HSplitterTiles".
- Select "HSplitterFrames" in the "Frameset" dropdown list.
- Enter 128 as the tile width and 15 as the tile height.
- The graphics are now ready for use on a map. Close all the open child windows.
- Add a new layer with a horizontal splitter to the overlay map.
- In the project tree, under Maps->Overlay for 2 players, select the "Layers" node.
- Select "New" to add a new layer for this map.
- Enter a name of "HorizontalSplitter" for the new layer.
- Change "ScrollRateX" and "ScrollRateY" to 0.
- Select "HSplitterTiles" as teh value for "Tileset".
- Set OffsetY to 293 (half the height of the display minus half the height of the splitter graphic).
- Set SizeInTiles to 7,1.
- Set ZIndex to 1.
- Click the "Add" button to add the layer.
- When the layer editor appears, select the horizontal splitter graphic from the "Tiles" tab.
- Across the top of the layer, draw a horizontal splitter in all 7 tiles of the layer. (If you need help seeing where the layer is, select "Layer Edges" from the View menu.)
- The splitter is done. Close all child windows.
- Change rules on menu screen to correspond to 3-players instead of 2.
- Open the "Select Menu Items" plan from Maps->Menu->Layers->Letters->Plans.
- Expand "If down is pressed".
- Expand "Else if up is pressed".
- Expand "Else if Return/Enter is pressed".
- Expand "If 1 player game selected".
- Expand "Else if 2 player game selected".
- Select "Set 2 players".
- Change the Value parameter to "3" instead of "2".
- Optional: Change the names of all the rules that refer to 2 players to 3 instead.
- Change the 2 player overlay map to a 3 player overlay map.
- Select Maps->Overlay for 2 players.
- Edit the map parameters by double-clicking, by selecting Properties from the view menu, or selecting Edit from the context menu.
- Change the name of the map from "Overlay for 2 players" to "Overlay for 3 players".
- Click the Update button.
- Open the map editor from Layers->Inventory->Editor below the "Overlay for 3 players" node.
- Select "Snap to Tiles" from the Edit menu.
- Select "Add Plan" from the Edit menu.
- Select the new plan "Overlay for 3 players Plan 1" from the top listbox.
- Change the name of the plan in the property grid to "Player 3 Cherries".
- Move the mouse so the second status bar panel reads "Tile X,Y: 1,10" and click once.
- Move the mouse to Tile 11,11 and click once more.
- Add another plan by select "Add Plan" from the Edit menu, naming it "Player 3 Grapes" and adding corner points at tiles 1,11 and 11,12.
- Add a third plan with the name "Player 3 Ice Creams" and corners at tile 1,12 and 11,13.
- Add a fourth plan with the name "Player 3 score" and corners at tile 1,13 and 6,14.
- Add counters to track player 3's inventory.
- Select "Counters" in the project tree pane.
- Select "New Object" from the file menu or "New" from the context menu.
- Enter the name "Player 3 grapes", set the maximum to 10 and the value to 0.
- Select "New Object" from the file menu or "New" from the context menu.
- Enter the name "Player 3 cherries", set the maximum to 10 and the value to 0.
- Select "New Object" from the file menu or "New" from the context menu.
- Enter the name "Player 3 ice cream", set the maximum to 10 and the value to 0.
- Select "New Object" from the file menu or "New" from the context menu.
- Enter the name "Player 3 score", set the maximum to 10000000 and the value to 0.
- Draw player 3's inventory.
- In the project tree, locate and edit Maps->Overlay for 3 players->Layers->Inventory->Plans->Player 3 Grapes.
- Select "Add New Rule" from the Plan menu.
- Set the Rule name to "Draw player 3 grape inventory".
- Select "DrawCounterAsTile" from the rule function dropdown combo box.
- Set TileIndex to 55 (the grape tile), counter to Counter.Player_3_grapes (from the dropdown list), and style to PlanBase.DrawStyle.RepeatRightToCounter (from the dropdown list).
- In the project tree, locate and edit Maps->Overlay for 3 players->Layers->Inventory->Plans->Player 3 Cherries.
- Select "Add New Rule" from the Plan menu.
- Set the Rule name to "Draw player 3 cherry inventory".
- Select "DrawCounterAsTile" from the rule function dropdown combo box.
- Set TileIndex to 54 (the cherry tile), counter to Counter.Player_3_cherries, and style to PlanBase.DrawStyle.RepeatRightToCounter.
- In the project tree, locate and edit Maps->Overlay for 3 players->Layers->Inventory->Plans->Player 3 Ice Creams.
- Select "Add New Rule" from the Plan menu.
- Set the Rule name to "Draw player 3 ice cream inventory".
- Select "DrawCounterAsTile" from the rule function dropdown combo box.
- Set TileIndex to 56 (the ice cream tile), counter to Counter.Player_3_ice_cream, and style to PlanBase.DrawStyle.RepeatRightToCounter.
- In the project tree, locate and edit Maps->Overlay for 3 players->Layers->Inventory->Plans->Player 3 score.
- Select "Add New Rule" from the Plan menu.
- Set the Rule name to "Draw player 3 score".
- Select "DrawCounterWithLabel" from the rule function dropdown combo box.
- Set Label to "Score: " including the double-quotes, counter to Counter.Player_3_score, and color to System.Drawing.KnownColor.White.
- Add a sprite for player 3 to the map.
- In the project tree, locate and edit Maps->Level 1->Layers->Main->Editor.
- Select the "Sprites" tab.
- Select "Add Sprites".
- Select "<All>" from the dropdown list of sprite categories.
- Select the second sprite (the one that looks like the player sprite).
- Give the sprite a distinctive color by entering 128 into the ModulateGreen entry in the property grid.
- Set the "Active" property to "False" because player 3 should be inactive by default.
- Set the "ViewNum" property to 2. This tells the rules in the Player sprite definition that this sprite should appear in view number 2 (the third view of the 4-way split view).
- Select the value "Standard" as the value for the "Solidity" property.
- Select "Snap to Tiles" from the Edit menu.
- Move the mouse to position the new player sprite to the left of the existing 2 player sprites, and click once to add it. (Note the default name Player 3).
- Fix scroll margins for smaller views.
- Under Maps edit the "Level1" map parameters.
- Change ScrollMarginTop and ScrollMarginBottom from 256 to 128.
- Click Update.
- Change the Level 1 map initialization logic to initialize for 3 players.
- Edit the "ManagePlayers" plan from Maps->Level 1->Layers->Main->Plans.
- Expand "If map needs initialization".
- Select "If 2 players".
- Change the name to "If 3 players".
- Change the "right operand" parameter from "2" to "3".
- Select the "Activate second player" rule.
- Select "Add new rule" from the plan menu.
- Enter the name "Activate third player" for the new rule, and verify that the rule's function is ActivateSprite.
- Select "m_ParentLayer.m_Player_3" for the value of the "Target" parameter.
- Select the "Side by side view" rule. (Change the name to "Four corners view" to avoid confusion.)
- Change the "Layout" parameter to ViewLayout.FourCorners.
- Select the "Activate 2 player overlay" rule, (and change its name to "Activate 3 player overlay" to avoid confusion).
- Change the MapType parameter to typeof(Overlay_for_3_players_Map).
- Select the "Hello Player 2" rule.
- Select "Add new rule" from the Plan menu.
- Name the new rule "Hello player 3".
- In the "message" parameter, enter the value "Hello player 3" including the quotes.
- In the "options" parameter, select <Specify multiple Options values> and check the boxes for CustomObjects.Message.Options.Player3 and CustomObjects.Message.Options.Button2Dismiss to indicate that this message will appear in player 3's view and will be dismissed with player 3's button 2 input.
- Map the inputs for player 3 to the player 3 sprite.
- Under Level 1->Layers->Main->Plans, edit the "Player Inputs" plan.
- From the Plan menu, select "Add new rule". If no rule is selected, it should add at the end of the list. If you did not add it to the end of the rule list, make sure the rule gets moved to the end.
- Set the name of the new rule to "If player 3 is active".
- Change the rule type from "Do" to "If".
- Select ">=" as the rule function.
- Select "Counter.Players.CurrentValue" as the left operand and enter 3 for the right operand.
- Select "Add new rule" from the Plan menu.
- Enter the name "Read player 3 inputs" for the rule name.
- Select "CustomObjects.Message.MapPlayerToInputs" as the rule function. This customized version of MapPlayerToInputs prevents the player from moving while a message is displayed.
- Enter 3 as the value for PlayerNumber and select m_ParentLayer.m_Player_3 as the value for Target.
- Check the "End If/End While" box.
- Route player 3's inventory interactions to player 3's inventory counters.
- Under Sprite Definitions, edit "Player".
- On the Rules tab, expand "Tile Interactions" and expand "If player 1".
- Select "Player 1 take ice cream".
- Select "Add Rule" from the "Sprite Definition" menu to add a new rule between "Player 1 take ice cream" and "Else player 2 take grapes".
- Enter the name "Else if player 2".
- Change the rule type to "ElseIf".
- Select "==" as the rule function.
- Select "ViewNum" as the left operand and 1 as the right operand.
- Select "Else player 2 take grapes (the first rule inside "Else if player 2")
- Change the name to "Player 2 take grapes" and change the type to "Do".
- Select "Else if player 2"
- From the "Sprite Definition" menu, select Copy Rule->Copy Selected Rule Including Children.
- Select "Player 2 take ice cream"
- Un-check the "End If/End While" box.
- From the "Sprite Definition" menu, select Paste Rules->Paste Below Selected Rule.
- Select "Else if player 21" and select "Remove Rule" from the Sprite Definition menu. Note that this will only remove the parent rule, and will cause all the children to move up a level.
- Expand "Tile Interactions..."->"If Player 1"->"Else If Player 2"
- Select "Player 2 take grapes1"
- Change the name to "Else player 3 take grapes" and select "Else" as the rule type.
- Change the "Counter" parameter from "Counter.Player_2_grapes" to "Counter.Player_3_grapes".
- Select and expand "Get player 2 grape points1" (change the name to "Get player 3 grape points" to avoid confusion).
- Select "Add grape points to player 2 score1" (change the name to "Add grape points to player 3 score" to avoid confusion).
- Change both paremeters that refer to "Counter.Player_2_Score.CurrentValue" to refer to "Counter.Player_3_score.CurrentValue" instead.
- Repeat steps r through w for the rules relating to cherries (but this time without using "Else" -- Leave "Do" instead).
- Select "Player 2 take ice cream1" and select "Add Rule" from the "Sprite Definition" menu to add a new rule before "End Tile Interactions".
- Enter the name "End if player 1" and Select "End" as the rule type.
- Allow player 3 to use doors.
- Under Maps->Level1->Layers->Main->Plans, Edit "Door Left".
- Select "If player 1 is active".
- Select Copy Rules->Copy Selected Rule Including Children from the Plan menu.
- Expand "If player 2 is active".
- Select the last rule ("Transport player 2 to right door") and check the "End If" box for this rule if it is not checked.
- Select Paste Rules->Paste Below Selected Rule from the Plan menu.
- Select "If player 1 is active1" and change the name to "If player 3 is active".
- Change the Sprite parameter to "m_ParentLayer.m_Player_3".
- Select "And player 1 pressing up1" and change the name to "And player 3 pressing up".
- Change the Sprite parameter to "m_ParentLayer.m_Player_3".
- Select "And player 1 in front of door1" and change the name to "And player 3 in front of door".
- Change the Sprite parameter to "m_ParentLayer.m_Player_3".
- Select "Ensure up is now seen as an old keypress for player 11" and change the name to "Ensure up is now seen as an old keypress for player 3".
- Change the Sprite parameter to "m_ParentLayer.m_Player_3".
- Select "Transport player 1 to right door1" and change the name to "Transport player 3 to right door".
- Change the Sprite parameter to "m_ParentLayer.m_Player_3".
- Delete the tile "animation" for the vertical splitter. (The vertical splitter tile was set to be invisible when the number of players was an odd number so that no splitter would show up when there was only 1 player. This is not necessary and interferes with the ability to display the vertical splitter when 3 players are active.)
- In the project tree, expand "Tilesets" and edit the "ViewSplitterTiles" tileset.
- From the "Mapped Tiles" dropdown list, select tile number 1.
- Select "Delete/Reset Tile" from the Tileset menu, and confirm.
The following activities are left as exercises for the reader:
- Routing player 3 ice cream interactions to player 3's inventory.
- Correcting the remainder of the rule names.
- Allowing player 3 to use the other door.