首页 新闻 搜索 专区 学院

用二维数组做个简单的地图编辑器----谁来救救我啊

0
悬赏园豆:10 [待解决问题]

老师给我个忒难的问题

用C#编个《魔塔》游戏

想必大家都玩过

但要用二维数组编辑地图

擦骨灰级菜鸟的主页 擦骨灰级菜鸟 | 初学一级 | 园豆:180
提问于:2010-11-03 21:44
< >
分享
所有回答(1)
0

做出一个小游戏,多长时间?你们老师也挺有创意啊,二维数组编辑地图,楼主可以参考数据结构中图的算法实现,其实核心就是这个,别的有兴趣大家可以一起研究!

雪莱·亨尼格 | 园豆:524 (小虾三级) | 2010-11-04 09:53
namespace MapEditor { public partial class Form1 : Form { private int picContent = 0; private Point currentPoint; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void panel1_Paint(object sender, PaintEventArgs e) { } private void panel1_Click(object sender, EventArgs e) { } private void panel1_MouseClick(object sender, MouseEventArgs e) { int xPoint = e.Location.X/50 ; int yPoint = e.Location.Y /50; currentPoint = new Point(xPoint*50 , yPoint*50); PictureBox tmpPic = new PictureBox(); tmpPic.Size = new Size(50, 50); tmpPic.BorderStyle = BorderStyle.None; tmpPic.Location = currentPoint; tmpPic.SizeMode = PictureBoxSizeMode.StretchImage; tmpPic.Margin = new Padding(0); if (picContent == 0) { tmpPic.Image = MapEditor.Properties.Resources.Route; } if (picContent == 1) { tmpPic.Image = MapEditor.Properties.Resources.backgroundImage; } this.panel1.Controls.Add(tmpPic); } private void pictureBox3_Click(object sender, EventArgs e) { this.picContent = 1; } private void pictureBox1_Click(object sender, EventArgs e) { this.picContent = 0; } private void button1_Click(object sender, EventArgs e) { Graphics g = this.panel1.CreateGraphics(); Bitmap bmp = new Bitmap(550, 550); // g.DrawImage(bmp, 550, 550); this.panel1.DrawToBitmap(bmp, new Rectangle(0,0,550,550)); if (File.Exists(@"D:\1.jpg&qu
支持(0) 反对(0) 擦骨灰级菜鸟 | 园豆:180 (初学一级) | 2010-11-04 15:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册