Source Code
In chapter five I learned about user input. There are many different ways of getting input from a user, but I learned about the most common three that XNA supports, the mouse, keyboard, and the Xbox 360 controller. To demonstrate my ability to interpret user input, I created a Cat and Mouse project. It is a two player game with two inputs, the cat moving around using the keyboard WASD inputs, and the mouse using the mouse to go to wherever the mouse is pointed. The mouse can also left click to randomly teleport around on the screen. There is no win state so nothing happens when the mouse collides with the cat.
Source Code
0 Comments
In chapter 4 I learned all about sprites. Sprites are two dimensional images that can be used for a myriad of different purposes, such as drawing a background or an object in a game. It is much more complicated then I initially thought it would be to use sprites, compared with what I am used to in GameMaker. First, you have to add the sprites you wish to use to the XNA Content Pipeline, and then you have to use a huge chunk of code to draw the sprite. You use this chunk of code to declare to the program the position of the sprite, whether you want the sprite to be scaled, or rotated, what color you want the sprite to be, and much more. It seems unefficent and complicated compared to a more GUI based engine like GameMaker. I think you will agree with me when you see the source code for this activities chapter, Starry Night. The goal here is to have stars rotate around a specific point in the scene. I would send you a video if I could find a working screen recorder. I can't believe you need to write that much code to create such a simple scene! You can't even interact with it, it is just a scene running in the XNA engine.
Source Code In this chapter I made a screen toggle program. It lets you switch between fullscreen and windowed mode, also changing colors in the process. Green is fullscreen, and red is windowed. The course told me to make the fullscreen resolution 1024x768, but I just changed those numbers to my desktop resolution, 1920x1080. I also specified the windowed mode resolution to 300x300. For some reason capturing my screen in fullscreen mode just makes the screen gray so I wasn't able to a shot of fullscreen mode.
Source Code In chapter 2, I learned how to make a window that would flash specified colors of my choice every second. Instead of running properly, all I saw was a blank window. I compared the solutions code to mine and ran the solution, but it didn't work. I asked my mentor for help, and I asked the Teencoder company for help. They said to change the interval to something other then 1.0s and that worked! The only difference is that the colors flash every 2 seconds instead of 1 second. Source Code In chapter 1, I learned that installing XNA Studio is just a library and a structure based off of Visual C. The layout is exactly the same, except there is no form design to design how my form looks, just the code editor and a slightly different starting layout. The entire lesson was just installing the program, so there is nothing to show.
This is the final chapter for my project where I am supposed to recreate a very crude version of Chess. It was by far the most challenging thing I have worked on in this entire course. I thought I was almost finished, but I had formatted my PC and installed Windows 8.1. I backed up all my Teencoder files to Dropbox, and after I tried running the program, it did a build error and couldn't detect any of my classes for the pieces. I was confused and worried, but than I realized I hadn't actually set any movement rules for the pieces. The movement rules I had created in the previous chapter were not there. So after adding those in, I got the game working, and all the pieces work as intended. I learned that I can simulate just about anything I want to in software programming, the possibilities are endless. Weather simulations, farming simulations, water simulations, and other countless opportunities. Source code: ChessForm.cs: http://pastebin.com/sTEEaDtc ChessPieces.cs: http://pastebin.com/uBtE3hEk ChessBoard.cs: http://pastebin.com/ruPHZksU In chapter 16, I learned about inheritance and polymorphism, two important concepts for object oriented programming. Inheritance means that a class can inherit shared behavior and data from another class. Polymorhpism means that you can use an object as a generic type and it will actually behave differently, according to its actual type. For this activity, I began setting up for a chess project, so the only thing my project does at the moment is display information about the different chess pieces, such as the abbreviations, the positions of the pieces on the chessboard, and whether or not they have moved.
Source Code: http://pastebin.com/18fDuf7h In Chapter 10, I learned about one of the central and classic uses of technology, that is to create, save and edit text. This is done through file input and output. This allowed me to save data and then reload that same data, allowing me to make changes to the data and then saving it again. While building the program, I accidentally forgot to put in the input and output controls in my form, which would pop up the dialog asking the user to save or load a file. At first I also created a listbox instead of a textbox for my program, throwing an error that it didn't understand the *.Clear(). I think this is the coolest program I have done so far. Source Code: http://pastebin.com/25Fj2YXe In chapter 14, I learned how to make a sorting program using a basic sort method. It sorts numbers starting from top to bottom sorting from smallest to biggest. There are 4 buttons on the side, add, remove, sort, and clear. They all do what you would expect. It is my most complex program yet. I learned about two simple sorting algorithms, the Bubble Sort and the Insertion Sort. I can see many many uses for being able to sort, such numbers, sorting text alphabetically. If I ever wanted to make my own file browser for fun, then this would be very useful for allowing the user to sort files in what order they desire. Source Code: http://pastebin.com/nkjpbsXP In Chapter 11 I have learned about collections. I have made a simple to-do list program that can add or remove items, as well as clearing all the items on the list. It is pretty straightforward, but it is a good way to test my knowledge of collections. Source Code: http://pastebin.com/J9gMF3GK |
AuthorI'm just a beginner programmer learning C#. I have set this archive up to see what I have learned over the years. Archives
June 2015
Categories |