Design ideas for Tetris

Source: Internet
Author: User

Some time ago to help people write a Tetris demo, today there is time to share the design ideas.

Analysis:

There are 7 shapes in the game, each of which can be rotated in the game to form a new shape. Each shape is made up of square blocks of color.

Data classes:

Shape: A total of 7 shapes.

Block: Block class, in fact, there is only one map properties.

About Rotation:

Looking for a rotation point for each shape, the rotation point for each shape is fixed.

The red dots are the reference points and the rows are ( x, y )

The position of the rotated blocks relative to the red block is recorded in the shape's data, and the other positions are determined directly by the red block when rotating in the game, and the entire shape movement is done in this way.

The following is the data set in the order above.

Demo Source: http://bbs.tairan.com/thread-38448-1-1.html

Design ideas for Tetris

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.