Hi,
I'm trying to make a visual bank system for my RPG game, but I have some issues.
as you see on the image if have 9 columns and 4 rows
when you click on a item area (the pokeball with black background) it should select that item by drawing a rectangle around it.Code:Public Const BANK_COLUMNS As Integer = 8 Public Const BANK_ROWS As Integer = 3
how will I make a script like this? I can't figure out how I'll make it. I've tried alot of things but I failed. (look my script below)
Code:Private Sub picBank_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles picBank.MouseDown Dim X As Integer = CInt(Math.Floor(e.X / 32)) Dim Y As Integer = CInt(Math.Floor(e.Y / 32)) ' Label1.Text = String.Format("{0} - {1}", X, Y) For column = 0 To BANK_COLUMNS For row = 0 To BANK_ROWS '15 + column * 48 / 32 If X > (15 + (column * 48) / 32) Then Label1.Text = column.ToString DrawRectangle(New Rectangle(0, 0, 32, 32) End If Next Next End Sub




Reply With Quote