Pathfinding
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
10 posts
Page 1 of 1
Hello guys,
Well lately i have been trying to make an isometric game with pathfinding ( explained later in post ) but i have resorted to making the user click to move a tile. When the user clicks a tile ( highlighted red ) i want the box shape to make a rout from tile to tile, the fastest way, until it has reached the specified location, All help will be great, if you need any more info please put it bellow.
Lewis
current source:
Well lately i have been trying to make an isometric game with pathfinding ( explained later in post ) but i have resorted to making the user click to move a tile. When the user clicks a tile ( highlighted red ) i want the box shape to make a rout from tile to tile, the fastest way, until it has reached the specified location, All help will be great, if you need any more info please put it bellow.
Lewis
current source:
Code: Select all
Public Class Form1
Private Sub PictureBox4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox4.Click
PictureBox1.Location = New Point(PictureBox1.Location.X - 28, PictureBox1.Location.Y + 14)
PictureBox2.Location = New Point(PictureBox2.Location.X - 28, PictureBox2.Location.Y + 14)
PictureBox3.Location = New Point(PictureBox3.Location.X - 28, PictureBox3.Location.Y + 14)
PictureBox4.Location = New Point(PictureBox4.Location.X - 28, PictureBox4.Location.Y + 14)
PictureBox5.Location = New Point(PictureBox5.Location.X - 28, PictureBox5.Location.Y + 14)
End Sub
Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
PictureBox1.Location = New Point(PictureBox1.Location.X + 28, PictureBox1.Location.Y - 14)
PictureBox2.Location = New Point(PictureBox2.Location.X + 28, PictureBox2.Location.Y - 14)
PictureBox3.Location = New Point(PictureBox3.Location.X + 28, PictureBox3.Location.Y - 14)
PictureBox4.Location = New Point(PictureBox4.Location.X + 28, PictureBox4.Location.Y - 14)
PictureBox5.Location = New Point(PictureBox5.Location.X + 28, PictureBox5.Location.Y - 14)
End Sub
Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
PictureBox1.Location = New Point(PictureBox1.Location.X + 28, PictureBox1.Location.Y + 14)
PictureBox2.Location = New Point(PictureBox2.Location.X + 28, PictureBox2.Location.Y + 14)
PictureBox3.Location = New Point(PictureBox3.Location.X + 28, PictureBox3.Location.Y + 14)
PictureBox4.Location = New Point(PictureBox4.Location.X + 28, PictureBox4.Location.Y + 14)
PictureBox5.Location = New Point(PictureBox5.Location.X + 28, PictureBox5.Location.Y + 14)
End Sub
Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
PictureBox1.Location = New Point(PictureBox1.Location.X - 28, PictureBox1.Location.Y - 14)
PictureBox2.Location = New Point(PictureBox2.Location.X - 28, PictureBox2.Location.Y - 14)
PictureBox3.Location = New Point(PictureBox3.Location.X - 28, PictureBox3.Location.Y - 14)
PictureBox4.Location = New Point(PictureBox4.Location.X - 28, PictureBox4.Location.Y - 14)
PictureBox5.Location = New Point(PictureBox5.Location.X - 28, PictureBox5.Location.Y - 14)
End Sub
End Class
You do not have the required permissions to view the files attached to this post.
Maybe you could move the shape with 2 for loops until it is where it needs to be?
Code: Select all
Dim xBlocks As Integer = 2
Dim yBlocks As Integer = 3 'example to move right by 2 blocks, down by 3
Dim blocksize As Integer = 28
For x As Integer = 0 To xBlocks * blocksize Step blocksize
PictureBox1.Left += x
Next
For y As Integer = 0 To yBlocks * blocksize Step blocksize
PictureBox1.Top += y
Next
Mandai that code diddnt work as it went off path and diddnt go on the tile correctly, Also i want it to like "animate" itself to each tile (slide)
For animation you can add in delays and have the loop running inside a different thread like in a backgroundworker, you could also decrease the step amount in each loop.
You might have to adjust the blocksize to the amount needed for it to work in isometric bounds.
Edit: Sorry this isn't my area of expertise maybe someone else can help?
You might have to adjust the blocksize to the amount needed for it to work in isometric bounds.
Edit: Sorry this isn't my area of expertise maybe someone else can help?
Last edited by mandai on Wed Jul 28, 2010 10:42 am, edited 1 time in total.
Bump 's head on the forum because I still need help.
Last bumped by Lewis on Wed Jul 28, 2010 9:40 am.
10 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023