Windows Phone 7 example game platformer practice 2-Preliminary Game Design

Source: Internet
Author: User


Platformer and "Mario" are very similar. The gameplay is basically the same, but many functions of the game are not yet implemented. Currently, platformer is mainly used to control heroes from all zombie monsters in the game. We need to collect the gems in the shortest time under the interference of these botnets. The shorter the time spent on each level, the more gems you collect, the higher your score in the game. The only pity is that platformer has no beauty waiting for us to save, but it doesn't matter. We can DIY one in the subsequent development process.



 



Platformer sounds simple and cannot be simple, but the so-called pyramid is not built in one day. Platformer is small but dirty. Most of our skills in game development are embodied in this game. animation processing, sound loading, touch, keyboard input, collision detection, game map parsing, and so on.



 



The main features of platformer are summarized as follows:


    1. Supports cross-platform Windows Phone 7, Xbox 360, and PC. games do not require anyCodeModifications can be seamlessly executed among the three.
    2. Supports the keyboard and game joystick to control the movement and beating of the game's main character. In addition, on the Windows Phone 7 platform, acceleration sensors and touch screens are used to control the movement and "jump up and down" of the main character ".
    3. It implements several simple scenario models, such as drop, jump, and dynamic collision, and initially implements real-world anti-authenticity.
    4. Load and parse audio, animated images, and map resources
    5. This function enables automatic conversion between high resolution and low resolution. Game images can adapt to devices of different screen sizes.


At present, Microsoft has added a lot of foreshadowing to this game, just waiting for further exploration and improvement. Xuanyuan finds that the zombie monster in platformer is not invincible. As long as some code is added, the hero can start the invincible transformer status after collecting a certain amount of gems, it is really "killing Buddha with Buddha and collecting ghosts with Hell ". As for the more abnormal implementation, we still hope that readers will be able to improve themselves, so we will not review the machine here.



 



Platformer Games consist of more than a dozen categories. Each function class does not involve inheritance and other relationships. Therefore, each class has its own independent function. Xuanyuan will further improve the Code in subsequent development to make the game more scalable. For example, the scenario rolling effect will be completed in subsequent courses. The following is the object parsing diagram of platformer:



 






 



 



The following describes the central ideas of the 13 classes in platformer:



 



1: platformergame is the control center of the entire game. In addition to notifying all objects in the game when to respond and display, it is also responsible for loading content pipelines and checkpoints, and updates of various objects in the game. It is hard work



2: level class, which is the card-off class of the game. Each level object contains a multi-dimensional array used to store scene tile information, hero, Game start and end coordinates, total score, game remaining time, a series of gems and zombie monster information.



3: The Player class is used to attach, draw, and update a hero.



4: enemy class, responsible for loading, drawing, and updating zombie monsters.



5: The Gem class implements a floating gem in the air in the game. The values of different types of gems are also different. The main task of a hero is to collect these gems. The gem class is also responsible for the loading, drawing, and updating of gems.



6: Tile structure. Like tiles in reality, tile can contain a game element in each tile so that it can be spliced into the expected game scenario. In the platformer game, we use these tile to form the scene map of the level.



7: The animation class is an indispensable animation class in the game. It mainly resolves the sprites images contained in the game to achieve animation frame decomposition.



8: The animationplayer class implements a coherent animation for each frame of the animated GIF image defined by the animation class.



9: The Circle class is used only for the gem class. It defines a circle surrounding the gem to realize collision detection between the protagonist and the gem.



10: rectangleextension is an extended static class of rectangle, also due to collision detection.



11: Program is the startup class for all xNa projects.Program.



12: The touchcollectionextensions class is an extension class for WP7 touch screen input to detect whether a touch screen has contacts.



13: the accelerometer class encapsulates the acceleration sensor in WP7. The mobile phone with the left and right sides can move the main character to the left or right.



 



Game execution process:



Before you start programming, let's outline the game execution process.



 



1. when starting a new level, all resources required for this level will be loaded, which can be implemented by platformergame. loadcontent and platformergame. loadnextlevel.



 



2. The status update process of each game is implemented by platformergame. Update and level. Update. If the hero is dead or the level time is exhausted, any input will be ignored and the game will be paused. If the player reaches the exit, the remaining time will be converted to the score bonus for the level. If there is still time remaining and the hero does not reach the exit, the time will gradually decrease. Various Objects (heroes, zombie monsters, and gems) in the level scenario will be updated using the update method. Various States must be considered before programming, so that the project will not be pushed back in future implementations.



 



3. The overall game screen is drawn by the platformergame. Draw method. In fact, the real painting process is subdivided, and each object in the scenario is drawn according to its own progress. For example, platformergame. Draw is subdivided into two methods: level. Draw and platformergame. drawhud. Level. Draw is only responsible for drawing tile tiles in the scenario. Heroes, zombie monsters, and gems themselves contain a draw method. All in all, platformergame. Draw only plays the role of scheduling and general control. Next, we will follow the scheduling level to complete the "Leadership" arrangement. It can be said to be a "Pull-and-pull ".





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.