Skip to content

Commit

Permalink
arena text
Browse files Browse the repository at this point in the history
- changed files, added classes file
- added arena text label
- logic for label is in label system, each enemy has attribute being a string array containg possible messages to display and niternal logic for this
- system added to select text, system currently broken
- also no font lol
- added naptablook back ma boi
  • Loading branch information
beast4coder committed Jan 25, 2024
1 parent 133b1c8 commit 9d059d7
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 3 deletions.
38 changes: 35 additions & 3 deletions Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public GameForm()

//controls
Label lblPlayerHealth;
Label lblArenaText;

Label debug_label;

Expand Down Expand Up @@ -118,6 +119,27 @@ private void Arena_Setup()
Arena_Hitbox = new Rectangle((int)loc.X, (int)loc.Y, (int)size.X, (int)size.Y);
#endregion

//spawn arena text box
#region Spawn Arena Text Box
//make text appear in the top left corner of the arena when the arena is largest
loc = new PointF(23, loc.Y + 23);
Size font_size = new Size(20, 20);
lblArenaText = new Label
{
AutoSize = true,
ForeColor = Color.White,
BackColor = Color.Transparent,
Location = new Point((int)loc.X + 5, (int)loc.Y),
Name = "lblArenaText",
Size = font_size,
TabIndex = 1,
Text = "",
Font = new Font("Pixelated MS Sans Serif", 15, FontStyle.Regular)
};
Controls.Add(lblArenaText);
lblArenaText.BringToFront();
#endregion

//spawn enemy
#region Spawn Enemy
test_enemy = new Test_Enemy();
Expand Down Expand Up @@ -315,7 +337,7 @@ private void Update_System()
{
//refresh the picture box to update the sprite's position
pbBackground.Refresh();

Arena_Text_System();
//lblPlayerHealth.Text = player.GetHealth() + "/20";

//only runs if the players turn
Expand Down Expand Up @@ -375,14 +397,24 @@ private void Update_Arena_Hitbox()
//redefines the arena box
if (player.Get_TurnState())
{
Arena_Hitbox.X = 10;
Arena_Hitbox.Width = (int)flt_FORM_WIDTH - 20;
Arena_Hitbox.X = 18;
Arena_Hitbox.Width = (int)flt_FORM_WIDTH - 36;
}
else
{
Arena_Hitbox.X = (int)(flt_FORM_WIDTH - player.Get_Size().X) / 2;
Arena_Hitbox.Width = 180;
}
}

private void Arena_Text_System()
{
if(player.Get_TurnState())
{
float pos = player.Get_Turn_Position();
if(pos > -1 && pos < 4) lblArenaText.Text = "*" + test_enemy.Choose_Arena_Text();
}
else lblArenaText.Text = "";
}
}
}
10 changes: 10 additions & 0 deletions Resource1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Resource1.resx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@
<data name="Battle_Menu_Sprite_Sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Battle_Menu_Sprite_Sheet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Napstablook_and_Dummies_Sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Napstablook_and_Dummies_Sheet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Monsters_Ruins_Sheet" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\Monsters_Ruins_Sheet.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
Expand Down
4 changes: 4 additions & 0 deletions Classes.cs → classes/Classes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ public void Button_Selection_System()
}
}
}


#endregion
}

Expand All @@ -360,6 +362,8 @@ internal class Enemy
protected int Damage;
protected Sprite_Handler[] Sprites;
protected List<Projectile> Projectiles;
protected Thread Arena_Text_Thread;
protected string[] Arena_Text;

#region Get/Set methods
#region Name
Expand Down
18 changes: 18 additions & 0 deletions enemies/Test_Enemy.cs → classes/Test_Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@ public Test_Enemy()
PointF loc = new PointF((GameForm.flt_FORM_WIDTH - size.X) / 2, 20);
Sprites[0] = new Sprite_Handler(sheet, background_col, size, rows_cols, offset, padding, loc);
#endregion
//define arena text messages
#region Arena Text Messages
Arena_Text = new string[] {
"THIS IS FILLER TEXT",
"EVEN MORE FILLER TEXT",
"Regular case filler text.",
"Your mum",
};
#endregion
}

public string Choose_Arena_Text()
{
//selects arena text
//this enemy just chooses randomly from predefined options
Random rand = new Random();
int msg_num = rand.Next(Arena_Text.Length);
return Arena_Text[msg_num];
}
}
}
Expand Down

0 comments on commit 9d059d7

Please sign in to comment.