Чинил мультик с движением прямо

This commit is contained in:
Arsenee 2018-04-13 17:10:31 +03:00 committed by GitHub
parent f780509b66
commit efb493f629
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 22 deletions

View file

@ -15,7 +15,9 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, "struct Person" + Environment.NewLine);
File.AppendAllText(filename, "{" + Environment.NewLine);
File.AppendAllText(filename, " double x;" + Environment.NewLine);
File.AppendAllText(filename, " double x2;" + Environment.NewLine);
File.AppendAllText(filename, " double y;" + Environment.NewLine);
File.AppendAllText(filename, " double y2;" + Environment.NewLine);
File.AppendAllText(filename, " double angle;" + Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra;" + Environment.NewLine);
File.AppendAllText(filename, " HDC texture;" + Environment.NewLine);

View file

@ -33,6 +33,7 @@ namespace WindowsFormsApplication1
this.LabelName = new System.Windows.Forms.Label();
this.nazvanieTextBox = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.PictureBoxBackground = new System.Windows.Forms.PictureBox();
this.LabelBackground = new System.Windows.Forms.Label();
@ -60,7 +61,6 @@ namespace WindowsFormsApplication1
this.ButtonAddChar = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit();
this.panel2.SuspendLayout();
@ -120,6 +120,16 @@ namespace WindowsFormsApplication1
this.panel1.Size = new System.Drawing.Size(297, 380);
this.panel1.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 274);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(259, 13);
this.label1.TabIndex = 24;
this.label1.Text = "number name state view delete";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label13
//
this.label13.AutoSize = true;
@ -312,6 +322,7 @@ namespace WindowsFormsApplication1
this.TextBoxWall2.Name = "TextBoxWall2";
this.TextBoxWall2.Size = new System.Drawing.Size(100, 20);
this.TextBoxWall2.TabIndex = 3;
this.TextBoxWall2.TextChanged += new System.EventHandler(this.TextBoxWall2_TextChanged);
this.TextBoxWall2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxWall1_KeyPress);
//
// TextBoxWall1
@ -371,16 +382,6 @@ namespace WindowsFormsApplication1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(14, 274);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(259, 13);
this.label1.TabIndex = 24;
this.label1.Text = "number name state view delete";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -392,6 +393,7 @@ namespace WindowsFormsApplication1
this.Name = "MainForm";
this.RightToLeftLayout = true;
this.Text = "Свойства персонажа";
this.Load += new System.EventHandler(this.MainForm_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).EndInit();

View file

@ -22,6 +22,11 @@ namespace WindowsFormsApplication1
public int nomer;
public String coord;
public String coord2;
//Dobavit polya
public String x1;
public String y1;
public String x2;
public String y2;
public String adress;
public String time1;
public String time2;
@ -170,6 +175,20 @@ namespace WindowsFormsApplication1
persons[nomerPersa].moveside = ComboBoxMove.Text;
persons[nomerPersa].nomer = nomerPersa;
String[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyNachala.Length > 1)
{
persons[nomerPersa].x1 = coordinatyNachala[0];
persons[nomerPersa].y1 = coordinatyNachala[1];
}
String[] coordinatyKonza = TextBoxWall2.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyKonza.Length > 1)
{
persons[nomerPersa].x2 = coordinatyKonza[0];
persons[nomerPersa].y2 = coordinatyKonza[1];
}
nomerPersa++;
yPersa = yPersa + 30;
openSpace.Image = null;
@ -183,28 +202,46 @@ namespace WindowsFormsApplication1
persons[pNomer].sprite = SpriteNumberTextBox.Text;
persons[pNomer].moveside = ComboBoxMove.Text;
persons[pNomer].nomer = pNomer;
String[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyNachala.Length > 1)
{
persons[pNomer].x1 = coordinatyNachala[0];
persons[pNomer].y1 = coordinatyNachala[1];
}
String[] coordinatyKonza = TextBoxWall2.Text.Split(new String[] { "," }, StringSplitOptions.None);
if (coordinatyKonza.Length > 1)
{
persons[pNomer].x2 = coordinatyKonza[0];
persons[pNomer].y2 = coordinatyKonza[1];
}
}
String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None);
//MessageBox.Show(arr[0]);
//sohranit v massiv
//proverit, chto est arr[1]
}
private void circle_create_person(string filename, string name)
{
File.AppendAllText(filename, " HDC texture = txLoadImage(\"Pictures\\Personaj.bmp);" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " double textureX = 50;"+ Environment.NewLine);
File.AppendAllText(filename, " double per.textureX = 50;"+ Environment.NewLine);
File.AppendAllText(filename, " double textureY = 50;"+ Environment.NewLine);
File.AppendAllText(filename, " double angle = 0;"+ Environment.NewLine);
File.AppendAllText(filename, " double nomer_kadra = 0;"+ Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
}
private void old_place(string filename, string name)
private void old_place(string filename, string name, Person p)
{
File.AppendAllText(filename, " " + name + ".x = " + TextBoxWall1.Text + "; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".y = " + TextBoxWall1.Text + "; " + Environment.NewLine);
//ctrl-c ctrl-v texture n_sprites x2 y2
File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " " + name + ".x = " + p.x1 + "; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".y = " + p.y1 + "; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".nomer_kadra = 0; " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\" + Path.GetFileName(p.adress) + "\"); " + Environment.NewLine);
File.AppendAllText(filename, " " + name + ".gr_dvigx = 1000; " + Environment.NewLine);
}
@ -218,7 +255,6 @@ namespace WindowsFormsApplication1
File.AppendAllText(filename, " " + name + ".nomer_kadra = 0;" + Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
File.AppendAllText(filename, Environment.NewLine);
File.AppendAllText(filename, " }" + Environment.NewLine);
}
private void circle(string filename, string name)
@ -278,8 +314,7 @@ namespace WindowsFormsApplication1
if (ComboBoxMove.Text == "Прямо")
{
Sinus.CreatePerson(filename, "per", TextBoxWall1.Text);
old_place(filename, "per");
old_place(filename, "per", persons[nomerPersa-1]);
Files.OpenWhile(filename);
go_pryamo(filename, "per");
close_while(filename);
@ -304,7 +339,7 @@ namespace WindowsFormsApplication1
else if (ComboBoxMove.Text == "Диагонально")
{
Sinus.CreatePerson(filename, "per", TextBoxWall1.Text);
old_place(filename, "per");
old_place(filename, "per", persons[nomerPersa - 1]);
Files.OpenWhile(filename);
go_pryamo(filename, "per");
close_while(filename);
@ -348,6 +383,11 @@ namespace WindowsFormsApplication1
{
openSpace.Image = null;
}
MessageBox.Show(persons[nomer].x1);
MessageBox.Show(persons[nomer].y1);
MessageBox.Show(persons[nomer].x2);
MessageBox.Show(persons[nomer].y2);
}
}
}
@ -375,10 +415,20 @@ namespace WindowsFormsApplication1
{
char c = e.KeyChar;
if (!(char.IsDigit(c) || c == '\b' || c == ' '))
if (!(char.IsDigit(c) || c == '\b' || c == ','))
{
e.Handled = true;
}
}
private void MainForm_Load(object sender, EventArgs e)
{
}
private void TextBoxWall2_TextChanged(object sender, EventArgs e)
{
}
}
}