• 我罗斯方块1


    这个作业属于哪个课程 2020年面向对象程序设计
    这个作业要求在哪里 我罗斯方块汇报(1)
    这个作业的目标 汇报进度及开发难题
    仓库 仓库
    小组成员 031902643赵威威 031902642谢敬琪 031902635陈诗昀
    其他参考文献 https://blog.csdn.net/qq_28634403/article/details/102957866

    开发进度

    大框架是四个类:玩家类,方块类,游戏类,渲染类
    方块类:完成了一部分
    游戏类:完成了一部分,同时也正在学习中
    渲染与玩家类并未开始

    开发难题

    玩家类需要继续学习相关操作。
    目前处于分工阶段,所以最终的整合估计也是一大困难。
    在最基础的四大类上还有许许多多的小功能需要我们继续思考,学习,查资料

    开发情况

    方块

    写方块类时学习了大佬的方法

    class Block 
    {
    	private:
                    int x;   //横坐标
                    int y;  //纵坐标 
    		int type; // 方块类型 
    		int director; // 旋转方向 
    		int shape[4][4]; // 格子大小 
    		int shapes[8][4][4]; 
    	public:/* 设置方块 */ 
    		void set(int _x, int _y, int _shape){
    			x = _x;
    			y = _y;
    			if(_shape != -1){
    				for(int i = 0; i < 4; i++)
    					for(int j = 0; j < 4; j++)
    						shape[i][j] = shapes[_shape][i][j];	
    				type = _shape;
    				director = 0;
    			}
    		}
    		void generate(){
    			for(int i = 0; i < 8; i++)
    				for(int j = 0; j < 4; j++)
    					for(int k = 0; k < 4; k++)
    						shapes[i][j][k] = 0;
    			shapes[0][1][1] = 1;	/* 石头 */
    			shapes[1][1][0] = shapes[1][1][1] = shapes[1][1][2] = shapes[1][1][3] = 1;/* 棍子 */
    			shapes[2][0][0] = shapes[2][0][1] = shapes[2][1][1] = shapes[2][2][1] = 1;/* 七 (左)*/
    			shapes[3][0][1] = shapes[3][0][2] = shapes[3][1][1] = shapes[3][2][1] = 1;/* 七 (右) */
    			shapes[4][0][1] = shapes[4][1][0] = shapes[4][1][1] = shapes[4][2][1] = 1;/* 凸 */
    			shapes[5][1][1] = shapes[5][1][2] = shapes[5][2][1] = shapes[5][2][2] = 1;/* 田*/
    			shapes[6][0][0] = shapes[6][0][1] = shapes[6][1][1] = shapes[6][1][2] = 1;/* Z(左)*/
    			shapes[7][0][2] = shapes[7][0][1] = shapes[7][1][1] = shapes[7][1][0] = 1;/* Z(右)*/
    		}
     }; 
    

    画方块

    
    void drawBlock(Block block){
    	int x = block.x; // 获取方块左上角的坐标
    	int y = block.y;
    	for(int i = 0; i < 4; i++){
    		for(int j = 0; j < 4; j++){
    			post(y + j, x + i); // 这里的x和y的位置倒置,上面讲pos这个函数时有讲述原因。
    			if(block.shape[i][j] == 1 && x + i >= 0 && x + i < height - 1 && y + j < width - 1 && y + j > 0){
    				std::cout << "■";
    			}
    		}
    	}
    	post(0,height); // 绘制完成后,需要将位置定位到最低行.
    }
    

    游戏

    画地图

    void drawMap(int **map){;
    	pos(0, 0);
    	for(int i = 0; i < height; i++){
    		for(int j = 0; j < width; j++){
    			if(map[i][j] == 1){
    				cout << "■";	// 背景
    			}else{
    				cout << "□"; 	// 可移动区域 
    			}
    		}
    		cout << endl;
    	} 
    	return;
    }
    
    

    这是目前的阶段的内容,关于我罗斯方块其他一些不是很成熟的东西就不展示了,继续学习!

  • 相关阅读:
    BigBlueButton的安装
    Css学习总结(3)——CSS布局解决方案
    Git学习总结(14)——Git使用前的注意事项
    Java基础学习总结(83)——Java泛型总结
    ios-ASIHTTPRequest的Reachability可以监听网络,网络出现状况来不同的处理
    ios-ASIHTTPRequest下载与进度条以及用观察者模式来监听进度条属性
    iOS 常用英语翻译
    ZT 类模板的声明和实现是不能分离的
    ZT Shell 排序
    Java基础 之软引用、弱引用、虚引用 ·[转载]
  • 原文地址:https://www.cnblogs.com/XINJIUXJ/p/12939260.html
Copyright © 2020-2023  润新知