Tile-Based Movement
object.XVelocity = InputManager.XBoxController[0].LeftStick.Position.X;
object.YVelocity = InputManager.XBoxController[0].LeftStick.Position.Y;using FlatRedBall;
using FlatRedBall.Instructions;
using FlatRedBall.ManagedSpriteGroups;Sprite blueprint = new Sprite();
// Give the tiles a ColorOperation to make them look different
blueprint.ColorOperation = FlatRedBall.Graphics.ColorOperation.Modulate;
blueprint.Green = 1;
blueprint.Red = .5f;
blueprint.Texture =
FlatRedBallServices.Load<Texture2D>("redball.bmp");
SpriteGrid spriteGrid = new SpriteGrid(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;
Last updated
Was this helpful?