Note - this documentation uses the SpriteGrid class which is now obsolete. The concepts of movement still apply, but the backing SpriteGrid is not recommended.
Tile based movement is a control system common in classic RPGs like Dragon Warrior and many of the early Final Fantasy games. While it was used in some very early games, tile based movement is not as simple as free movement which can be applied as follows:
Tile based movement can be applied in a variety of ways, but the most common is using instructions. The following code creates a tile map and a keyboard-controlled Sprite which moves using tile based movement.
Sprite blueprint =newSprite();// Give the tiles a ColorOperation to make them look differentblueprint.ColorOperation=FlatRedBall.Graphics.ColorOperation.Modulate;blueprint.Green=1;blueprint.Red=.5f;blueprint.Texture=FlatRedBallServices.Load<Texture2D>("redball.bmp");SpriteGrid spriteGrid =newSpriteGrid(SpriteManager.Camera,SpriteGrid.Plane.XY, blueprint);spriteGrid.XLeftBound=-10;spriteGrid.XRightBound=10;spriteGrid.YTopBound=10;spriteGrid.YBottomBound=-10;spriteGrid.PopulateGrid();Sprite character =SpriteManager.AddSprite("redball.bmp");character.CustomBehavior+= TileBasedMovement;