R
Ryda Mortajil
Guest
Hi,
I really need help, because of my code. Let me explain... I want to make a kind of Mario Game and I did all the stuff like add arrows to make the character move , add the mario character , add a ground and I am working on a block that mario will jump. that stupidly dont work, it is bizzare because the ground is working but not the block I let you see just under. I know there is some codes that is useless, but ill remove them after.
namespace Pong_Test12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
int x = pictureBox1.Location.X;
int y = pictureBox1.Location.Y;
if (e.KeyCode == Keys.Right)
{
x += 10;
Refresh();
}
else if (e.KeyCode == Keys.Left)
{
x -= 10;
Refresh();
}
else if (e.KeyCode == Keys.Up)
{
y -= 20;
Refresh();
}
else if (e.KeyCode == Keys.Down)
{
y += 10;
Refresh();
}
pictureBox1.Location = new Point(x, y);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
//e.Graphics.FillRectangle(Brushes.ForestGreen, x, y, 75, 100);
//e.Graphics.DrawImage(new Bitmap("WIN_20190119_16_59_10_Pro.jpg"), x, y, 100, 100);
//graphics = e.Graphics;
//SolidBrush bleu = new SolidBrush(Color.Red);
//graphics.FillRectangle(bleu, x, y, 75, 100);
}
private void Blockwall()
{
}
private void timer1_Tick(object sender, EventArgs e)
{
}
private void gravity()
{
if (pictureBox1.Location.Y == 165 || pictureBox1.Location.Y == 14)
{
tmrgravity.Stop();
}
else if (pictureBox1.Location.Y != 165 && pictureBox1.Location.Y != 14)
{
tmrgravity.Start();
}
}
private void tmrgravity_Tick(object sender, EventArgs e)
{
int x = pictureBox1.Location.X;
int y = pictureBox1.Location.Y;
y += 10;
pictureBox1.Location = new Point(x, y);
}
private void tmrvalidater1_Tick(object sender, EventArgs e)
{
gravity();
}
}
}
So it is in the section of private void gravity()
PS - I am 12 years old pls dont give me a code of 100k
Continue reading...
I really need help, because of my code. Let me explain... I want to make a kind of Mario Game and I did all the stuff like add arrows to make the character move , add the mario character , add a ground and I am working on a block that mario will jump. that stupidly dont work, it is bizzare because the ground is working but not the block I let you see just under. I know there is some codes that is useless, but ill remove them after.
namespace Pong_Test12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
int x = pictureBox1.Location.X;
int y = pictureBox1.Location.Y;
if (e.KeyCode == Keys.Right)
{
x += 10;
Refresh();
}
else if (e.KeyCode == Keys.Left)
{
x -= 10;
Refresh();
}
else if (e.KeyCode == Keys.Up)
{
y -= 20;
Refresh();
}
else if (e.KeyCode == Keys.Down)
{
y += 10;
Refresh();
}
pictureBox1.Location = new Point(x, y);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
//e.Graphics.FillRectangle(Brushes.ForestGreen, x, y, 75, 100);
//e.Graphics.DrawImage(new Bitmap("WIN_20190119_16_59_10_Pro.jpg"), x, y, 100, 100);
//graphics = e.Graphics;
//SolidBrush bleu = new SolidBrush(Color.Red);
//graphics.FillRectangle(bleu, x, y, 75, 100);
}
private void Blockwall()
{
}
private void timer1_Tick(object sender, EventArgs e)
{
}
private void gravity()
{
if (pictureBox1.Location.Y == 165 || pictureBox1.Location.Y == 14)
{
tmrgravity.Stop();
}
else if (pictureBox1.Location.Y != 165 && pictureBox1.Location.Y != 14)
{
tmrgravity.Start();
}
}
private void tmrgravity_Tick(object sender, EventArgs e)
{
int x = pictureBox1.Location.X;
int y = pictureBox1.Location.Y;
y += 10;
pictureBox1.Location = new Point(x, y);
}
private void tmrvalidater1_Tick(object sender, EventArgs e)
{
gravity();
}
}
}
So it is in the section of private void gravity()
PS - I am 12 years old pls dont give me a code of 100k
Continue reading...