Anyone seen any sort of tutorials on a draggable game map similar to those flash games like Evony, Kingdom of Camelot - where the game world is a grid system, usually isometric 2d, and to move around you just click and drag instead of using a button to move arrows in each direction?
The map I am trying to refine is loaded on a grid of divs from a mysql database - I just cannot seem to find any resources on google/youtube anywhere that give a hint of this type of technique and the members here always have the answers!
Thanks!
Draggable Game Map?
Draggable Game Map?
if( $myGames != "Crap" ) {
- please_donate( $money );
- just_enjoy();
Re: Draggable Game Map?
I've used jQuery UI draggable (http://jqueryui.com/draggable/) in the past for some prototypes of draggable game maps. It was pretty simple in my experience, but I'm not sure if it suits your requirements, you'll have to test it for yourself.
Re: Draggable Game Map?
This effect is easy to achieve. The problem is how the browser renders the divs. Too many and your page becomes unusable even on the fastest machines. If this becomes a problem you'll need to look into canvas.
Fighting for peace is declaring war on war. If you want peace be peaceful.
Re: Draggable Game Map?
You could also lazy unload the divs when they're no longer in view.
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Draggable Game Map?
canvas ftw
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Draggable Game Map?
This is what Google Maps does, or at least used to do when the world was amazed by Google maps lol. When you scroll, it cleverly loads more grid cells of the map out of view by AJAX so they are ready when you scroll them into view (provided you aren't scrolling like a mad man), and then as you move away from a grid cell that is out of view, it unloads them.Winawer wrote:You could also lazy unload the divs when they're no longer in view.
If it didn't do this, Google Maps would grind to a halt after a few minutes of scrolling around.
The indelible lord of tl;dr
Re: Draggable Game Map?
I'm making itJackolantern wrote:This is what Google Maps does, or at least used to do when the world was amazed by Google maps lol. When you scroll, it cleverly loads more grid cells of the map out of view by AJAX so they are ready when you scroll them into view (provided you aren't scrolling like a mad man), and then as you move away from a grid cell that is out of view, it unloads them.Winawer wrote:You could also lazy unload the divs when they're no longer in view.
If it didn't do this, Google Maps would grind to a halt after a few minutes of scrolling around.
Fighting for peace is declaring war on war. If you want peace be peaceful.