On the Create a new project window, search for Windows Forms. Then select Desktop from the All project types list. Select the Windows Forms App. NET Framework template, you can install it from the Create a new project window. In the Not finding what you're looking for? Select Modify in the Visual Studio Installer. You might be prompted to save your work. Next, select Continue to install the workload. In the Configure your new project window, name your project MatchingGame , then select Create.
Visual Studio creates a solution for your app. A solution is a container for all of the projects and files needed by your app. Click on the form to select the Windows Forms Designer. The tab reads Form1. In the Properties window, set the following form properties. Select the Toolbox tab on the left side of the IDE. Drag a TableLayoutPanel control from the Containers category in the toolbox or double-click it.
Set the following properties for the panel in the Properties window. Set the BackColor property to CornflowerBlue. To do set this property, select the arrow next to the BackColor property.
In the BackColor dialog box, select Web. If it works, great job! Now you can do this for the rest of the cards. Repeat the process, adding a trigger to all of the exit effects from the top cards, then dragging the entrances of the respective bottom cards underneath.
Now we have to repeat the process again with the bottom cards. Hit OK. Now with all of the top cards still selected or select them again if needed , right click and choose Send to Back, then Send to Back again. Now all the yellow cards should be showing. Note: An alternative way to do this is by using the Selection Pane and hiding all of the blue top cards so you can work with only the yellow bottom cards.
Select all of the yellow cards now by again holding CTRL and clicking on each one. Again, if you have an earlier version of PowerPoint, just add a Split exit effect instead. Now repeat the process of adding triggers. Every value represent a color, and a frame where to stop the color movieclip.
Lines : Loops to place 4 rows of 4 tiles each. Let's say four rows and four columns. Line 14 : Choosing a random number between zero and the length of colordeck array This means "choose a random tile". Line 15 : Creation of the tile. The type of the tile is colors , of course. Line 16 : Assigning an attribute to the tile called col that represent the color f the tile. Line 17 : Removing the element at the position found at line 14 from the colordeck array. It feels just like we drawn a tile.
Line 18 : Showing the 9th frame in the tile timeline. The 9th frame is the grey tile. Line 27 : Assigning to a variable called clicked the value of the tile just clicked, the one that called the function. Line 32 : If we already clicked on a tile and we are clicking on another tile, the second one This is a public function. It has to be public or no one would be able to use the class. The function keyword defines what we are writing.
Next is the name of the function. Since this is a constructor, it must have the same name as the class. This is where you would put any parameters you would need to execute the function. In this case, we are not returning any values so we declare it as void.
First thing we need to do is define our stage instance. The stage is where everything in your game happens. So our new constructor will look like this:. Here we set several values of our stage. The first is the width and height of the stage as defined by stageHeight and stageWidth. It can make your games not look right. So I set it to not scale here. Finally we set the frameRate. A memory match game does not need much in frame rates so I set it to You can increase this if you want to.
LEFT; playAgain. This means that this function cannot be accessed anywhere outside this class definition. Next we need to do one thing before we can use this and before I explain what is happening here.
We need to add a call to this function in the constructor of our class. So after we set the frame rate of the stage, we need to add the following line:.
We also need to add the following import statements to our package. So put the following line below the line where we import flash. So first we are creating Title Screen Image. We do this by first creating a new Loader object.
This Flash class allows us to load external resources into our game. Then we add this loader object as a child to the class. We need to do this before we try to manipulate it. We pass in a new URLRequest object with the url to the image. I am putting the full http path to the image here so that this game can be linked to from other websites without losing any data.
After loading the image, I shift it a bit to the right and bottom. This is not important if you have your game designed differently.
0コメント