示例#1
0
        public Slime(World world, Play play)
        {
            _play = play;
            _sprite = new Sprite(_animation)
            {
                FramesPerSecond = 10,
                Flip = SpriteEffects.FlipHorizontally,
                Body = {Scale = new Vector2(Scale)},
                Key = "walk"
            };

            _body = BodyFactory.CreateCircle(world: world,
                radius: .5f, density: .5f,
                position: play.Entities.Player.Body.TopMiddle - new Vector2(20, 0));

            _body.BodyType = BodyType.Dynamic;
            _body.LinearVelocity = new Vector2(play.Entities.Player.Body.Motor.MotorSpeed * .5f, 0);
            _body.OnCollision += _body_OnCollision;
        }
示例#2
0
 public Debug(Game game, World world, Play play)
 {
     _physicsDebug = new DebugViewXNA(world);
     _physicsDebug.LoadContent(game.GraphicsDevice, game.Content);
     _physicsDebug.AppendFlags(DebugViewFlags.DebugPanel);
 }
 public ResetCommand(Play play)
 {
     _play = play;
 }
 public Entities(World world, Play play)
 {
     Player = new Player(world, play);
     Coins = new Coins();
     Slimes = new Slimes(world, play);
 }
示例#5
0
 public Slimes(World world, Play play)
 {
     SlimeList = new List<Slime>();
     Wait.Until(time =>
     {
         if (time.Alive >= 2f)
             if (InfiniteIsland.Random.Next(4) == 0)
             {
                 SlimeList.Add(new Slime(world, play));
                 return true;
             }
         return false;
     }, null, -1);
 }