-
Jun 13th, 2020, 03:25 PM
#1
Thread Starter
Addicted Member
show a game tile (image) move from point a to point b
I'm sure this must be fairly straight forward.. but i haven't been able to find a solution (or even a starting point).. i'm probably just doing the wrong searches..
I have a game (several actually), all 'chess like'.. and i would like to add a bit of animation (not gifs) to show the tiles actually moving from point a to point b along a given path (usually not a straight line).
the tiles/board are all done as custom picture boxes (if that matters).
can anyone point me to a decent "how to".. or something?
TIA
-
Jun 13th, 2020, 04:07 PM
#2
Re: show a game tile (image) move from point a to point b
Use a timer with a small interval. At each tick of the timer, move your tile part of the way towards its destination...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 13th, 2020, 04:08 PM
#3
Re: show a game tile (image) move from point a to point b
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 13th, 2020, 04:15 PM
#4
Thread Starter
Addicted Member
Re: show a game tile (image) move from point a to point b
the picturebox needs to stay right where it is..(as it's the board too).
should i be making a virtual PB for this?.. or doing some kind of draw event thing on the form..?
-
Jun 13th, 2020, 04:33 PM
#5
Re: show a game tile (image) move from point a to point b
You can use a picturebox, but it will look untidy if your piece icon isn't square. I'd use a semi transparent image. draw your pieces to a blank copy of your board, then display the board Image...
Here's another graphical game example... https://social.technet.microsoft.com...rspective.aspx
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 13th, 2020, 04:40 PM
#6
Thread Starter
Addicted Member
Re: show a game tile (image) move from point a to point b
will go over that one.. see what i can do with it. (the previous one had so many errors it wasn't usable)
ty
Originally Posted by .paul.
You can use a picturebox, but it will look untidy if your piece icon isn't square. I'd use a semi transparent image. draw your pieces to a blank copy of your board, then display the board Image...
Here's another graphical game example... https://social.technet.microsoft.com...rspective.aspx
-
Jun 13th, 2020, 05:02 PM
#7
Re: show a game tile (image) move from point a to point b
Any errors are probably just due to vb versions, or else easily fixed, but as always, any errors are free of charge
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 13th, 2020, 05:08 PM
#8
Re: show a game tile (image) move from point a to point b
With your animations, anything 20frames per second or faster will be seen as fluent movement by the human eye...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Jun 22nd, 2020, 04:15 AM
#9
Lively Member
Re: show a game tile (image) move from point a to point b
HTML Code:
Dim Offset As Point
Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox1.MouseDown
Offset = New Point(-e.X, -e.Y)
End Sub
Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox1.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
Dim Pos As Point = Me.PointToClient(MousePosition)
Pos.Offset(Offset.X, Offset.Y)
PictureBox1.Location = Pos
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|