what is myControl and another control?
which one is from the other form?
you need to specify those refrences.
sorry
Thank you for the reply although that does not answer my question. Let me discribe my problem better. I am creating a game. I have a couple classes for differnt things one is called Item.cs that inharets a PictureBox and i have a Player.cs. I want to be able to add items to the screen when a player enters a certain room, and when the player double clicks on the PictureBox, Item, i want it to dissapear and appear in the players inventory. Now i found out a way to add the controls, but only when the form is first loaded here is my method.
public void AddControls()
{
foreach (Weapon weapon in Program.player.GetCurrentRoom().Weapons)
{
pnlLevel.Controls.Add(weapon);
}
}
I have one more question aswell. I want to have the PictureBox, player, move smoothly across the screen mind you this is a 2D game. so this is what i have to move the player.
private void Amarix_KeyDown(object sender, KeyEventArgs e)
{
//One key is pressed
if (e.KeyCode == Keys.W || e.KeyCode == Keys.Up)
{
pbxPlayer.Top -= 8;
}
if (e.KeyCode == Keys.S || e.KeyCode == Keys.Down)
{
pbxPlayer.Top += 8;
}
if (e.KeyCode == Keys.A || e.KeyCode == Keys.Left)
{
pbxPlayer.Left -= 8;
}
if (e.KeyCode == Keys.D || e.KeyCode == Keys.Right)
{
pbxPlayer.Left += 8;
}
}
So i was wondering how to make it so if you pressed like the up key and the right key at the same time the player would go in a diagnal?
thank you again for your help!