Reputation: 33
I am creating a rogue-like game. I would like to make it sort of like the game "The Ensign" if anyone is familiar with it. When I try to make North, East, South, and West buttons, I am having trouble making the character, move. Why doesn't this button change the position of the label? Any better ways to do this?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Rogue_Like2
{
public partial class Form1 : Form
{
public int _x;
public int _y;
public Form1()
{
InitializeComponent();
_x = lbl_char.Location.X;
_y = lbl_char.Location.Y;
}
private void btn_north_Click(object sender, EventArgs e)
{
_x -= 10;
}
private void btn_south_Click(object sender, EventArgs e)
{
_y += 10;
}
}
}
Upvotes: 1
Views: 531
Reputation: 91
if you want to move the label, try this
lbl_char.Location = new Point( x, y);
Upvotes: 1