Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Game - Problems with movement 1

Status
Not open for further replies.

dwlerwill

Technical User
May 25, 2001
329
0
0
Hi All

I am making a game in VB and it is 90% completed but I am stuck on one aspect.

The movement, I want to move the players position from one square to another square on the board each square has a grid reference and they enter the square they want to move from and to and it moves them one square at a time to the destination.

The problem is the only way I can work out how to do this is via hundereds of case statments.

Sample of what I want to do.

Imagine this is a sample map

50
40 E
30
20
10 S
01 02 03 04 05


The start is square 1001 and the end is 4004

What would you guys think is the best way to move the person 1 square at a time to the End via the quickest route?

I know this is probably a bizarre and badly worded question but any help would be very welcome :)

David Lerwill
"If at first you don't succeed go to the pub"
 

You know the .Top and .Left property of the Start position, and (hopefully) .Top and .Left property of End position.

Why not use Timer to change gradually .Top and .Left property of a player? And you will have a little 'animation' on the way, too. That would be cool.

And – if you do it right – your player does not have to jump from square to square, they will smoothly move across the shortest route.




Have fun.

---- Andy
 
Thank you that is a good play :)

David Lerwill
"If at first you don't succeed go to the pub"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top