public static Entity MakePlayerEntity(Game game,string name, string image, Vector2 position, Rectangle frame) { Entity e = MakeCharacterEntity(game, name, image, position, frame); e.Aspects.FindFirst<BoxCollisionAspect>().CollisionGroup = PlayerCollisionGroup; var input = new PlayerInputAspect() { Name = "input", CollisionAspect = "collider" }; e.Aspects.Add(input); var squirrels = new ProjectileAspect(); e.Aspects.Add(squirrels); return e; }
public static Entity NewPlayerEntity(Game game, string image, Vector2 position, Rectangle frame) { Entity e = NewStaticObjectEntity(game, "PLAYER", image, position, 0.3f, CoordinateType.World); e.Aspects.FindFirst<SpriteAspect>().ImageFrame = frame; e.Aspects.FindFirst<BoxCollisionAspect>().Dimensions = frame; e.Aspects.FindFirst<BoxCollisionAspect>().IsStatic = false; PlayerInputAspect input = new PlayerInputAspect(); input.Name = "input"; input.CollisionAspect = "collider"; e.Aspects.Add(input); ProjectileAspect squirrels = new ProjectileAspect(); e.Aspects.Add(squirrels); return e; }
protected override void InitSubclass() { orientation = Owner.Aspects.FindByName<BoxCollisionAspect>(boxColliderName); MoveSpeed = 500; sprite = Owner.Aspects.FindFirst<ISprite>(); projectileAttack = Owner.Aspects.FindFirst<ProjectileAspect>(); }