| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 762 人关注过本帖
标题:新人弄的小游戏 求助~
只看楼主 加入收藏
wang4142
Rank: 2
等 级:论坛游民
帖 子:41
专家分:19
注 册:2010-3-27
结帖率:80%
收藏
已结贴  问题点数:20 回复次数:7 
新人弄的小游戏 求助~
新人 想做一个小游戏 练习下~
就是 一个 16个 格子
每点击一个格子 这个格子以及周围变成红色,知道全部变成红色~
自己写了一部分~ 希望 各位大大帮忙完善下~ 有些地方不会实现~
Samll_Game.rar (36.6 KB)
搜索更多相关主题的帖子: 新人 小游戏 
2010-03-27 17:03
Alar30
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:10
帖 子:988
专家分:1627
注 册:2009-9-8
收藏
得分:4 
没看明白。。。
既然是游戏
娱乐性体现的何处呢?
2010-03-27 17:42
ouxianzhi520
Rank: 8Rank: 8
来 自:重庆
等 级:蝙蝠侠
威 望:3
帖 子:245
专家分:932
注 册:2007-12-1
收藏
得分:4 
可以 实现 这个功能呀。不过你让点击两次了就让红色再变回了黑色

[url=http://blog./ouxianzhi520]csdn个人博客[/url]
2010-03-28 14:32
zhaorongzhen
Rank: 1
等 级:新手上路
帖 子:19
专家分:5
注 册:2009-3-21
收藏
得分:4 
我的版本太低,打不开,看不到了!
2010-03-30 18:16
ouxianzhi520
Rank: 8Rank: 8
来 自:重庆
等 级:蝙蝠侠
威 望:3
帖 子:245
专家分:932
注 册:2007-12-1
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

程序的源码没有查看,不过我发现了,目前你这个程序能达到要求的步骤:
第一步:依次点击 1,4,16,13
第二步:依次点击 2,3,8,12,15,14,9,5
第三步:依次点击 6,7,10,11.
其实只要在每一块上点击一次就能完成了。
注:你说的点击每块,相邻的都会由变色,但其中2,3,8,12,15,14,9,5 这几块好像并不能达到你的目的

[url=http://blog./ouxianzhi520]csdn个人博客[/url]
2010-04-06 22:25
wang4142
Rank: 2
等 级:论坛游民
帖 子:41
专家分:19
注 册:2010-3-27
收藏
得分:0 
以下是引用ouxianzhi520在2010-4-6 22:25:57的发言:


程序的源码没有查看,不过我发现了,目前你这个程序能达到要求的步骤:
第一步:依次点击 1,4,16,13
第二步:依次点击 2,3,8,12,15,14,9,5
第三步:依次点击 6,7,10,11.
其实只要在每一块上点击一次就能完成了。
注:你说的点击每块,相邻的都会由变色,但其中2,3,8,12,15,14,9,5 这几块好像并不能达到你的目的
对啊~  正是这样的~ .....  大侠能帮忙解决嘛?
2010-04-08 11:28
风云再现
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-4-8
收藏
得分:0 
很简单:

using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Samll_Game
{
    public partial class frmGame : Form
    {
        private bool[,] strArr = new bool[4, 4];
        private Color blockColor = Color.Red;

        public frmGame()
        {
            InitializeComponent();
        }

        private void frmGame_Load(object sender, EventArgs e)
        {
         
        }

        private void label1_Paint(object sender, PaintEventArgs e)
        {
            Graphics gp = e.Graphics;
            gp.Clear(Color.Black);

            Pen p = new Pen(Color.White);

            for (int i = 0; i <= 240; i = i + 60)
            {
                gp.DrawLine(p,0,i,240,i);
            }

            for (int i = 0; i <= 240; i = i + 60)
            {
                gp.DrawLine(p, i, 0, i, 240);
            }

            ////定义笔刷
            //SolidBrush s = new SolidBrush(blockColor);
            //for (int i = 0; i < 4; i++)
            //{
            //    for (int j = 0; j < 4; j++)
            //    {
            //        if (strArr[i, j])
            //        {
            //            gp.FillRectangle(s, 60 *i, 60 * j, 60, 60);
            //        }
            //    }
            //}
        }

        private void label1_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            int xPox = e.X / 60;
            int yPox = e.Y / 60;

            strArr[xPox, yPox] = !strArr[xPox, yPox];
            if (xPox > 0) strArr[xPox - 1, yPox] = !strArr[xPox - 1, yPox];
            if (xPox < 3) strArr[xPox + 1, yPox] = !strArr[xPox + 1, yPox];
            if (yPox > 0) strArr[xPox, yPox - 1] = !strArr[xPox, yPox - 1];
            if (yPox < 3) strArr[xPox, yPox + 1] = !strArr[xPox, yPox + 1];


            bool b = strArr[xPox, yPox];
            bool b1 = strArr[xPox - 1 < 0 ? 0 : xPox - 1, yPox];
            bool b2 = strArr[xPox + 1 > 3 ? 3 : xPox + 1, yPox];
            bool b3 = strArr[xPox, yPox - 1 < 0 ? 0 : yPox - 1];
            bool b4 = strArr[xPox, yPox + 1 > 3 ? 3 : yPox + 1];

            Graphics gp = label1.CreateGraphics();
            SolidBrush s = new SolidBrush(b ? blockColor : Color.Black);
            SolidBrush s1 = new SolidBrush(b1 ? blockColor : Color.Black);
            SolidBrush s2 = new SolidBrush(b2 ? blockColor : Color.Black);
            SolidBrush s3 = new SolidBrush(b3 ? blockColor : Color.Black);
            SolidBrush s4 = new SolidBrush(b4 ? blockColor : Color.Black);

            gp.FillRectangle(s, xPox * 60 + 1, yPox * 60 + 1, 59, 59);
            gp.FillRectangle(s1, (xPox - 1) * 60 + 1, yPox * 60 + 1, 59, 59);
            gp.FillRectangle(s2, (xPox + 1) * 60 + 1, yPox * 60 + 1, 59, 59);
            gp.FillRectangle(s3, xPox * 60 + 1, (yPox - 1) * 60 + 1, 59, 59);
            gp.FillRectangle(s4, xPox * 60 + 1, (yPox + 1) * 60 + 1, 59, 59);
            gp.Dispose();

        }
    }
}
2010-04-08 16:21
风云再现
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-4-8
收藏
得分:0 
绿色部分还需要,调试的时候注释掉啦!
2010-04-08 16:24
快速回复:新人弄的小游戏 求助~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017739 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved