Small but interesting "view" example
Posted: Thu Sep 09, 2010 2:06 pm
I don't know exactly, maybe somebody already uploaded something like this.
But here I want to show you interesting example of navigating "view" actor in game. View will be always between player and cursor. I think it can be useful for some kinds of TDS games.
How it works? It is simple mathematics, let me explain. We need to find coordinates of actor, that locating right between player and cursor.
First, we find a coordinates of vector "player-cursor" = cursor.x-player.x ( the same for .y). Then we need to find a vector for point between player and cursor. = (cursor.x-player.x)/2. And then we need to find coordinates of that point = ((cursor.x-player.x)/2 + player.x)
If you can't understand what I mean, just download example and see!
I hope it would be useful for somebody.
I would be glad to see some comments!
Enjoy!
But here I want to show you interesting example of navigating "view" actor in game. View will be always between player and cursor. I think it can be useful for some kinds of TDS games.
How it works? It is simple mathematics, let me explain. We need to find coordinates of actor, that locating right between player and cursor.
First, we find a coordinates of vector "player-cursor" = cursor.x-player.x ( the same for .y). Then we need to find a vector for point between player and cursor. = (cursor.x-player.x)/2. And then we need to find coordinates of that point = ((cursor.x-player.x)/2 + player.x)
If you can't understand what I mean, just download example and see!
I hope it would be useful for somebody.
I would be glad to see some comments!
Enjoy!