Exemplo n.º 1
0
 private MultiCollider LeafCollider(Vector2 position, Size size, bool centered,Direction direction)
 {
     MultiCollider climbCollider = new MultiCollider(position, size, centered, direction);
     climbCollider.AddCollider(new Collider(new Rectangle(0, leafSize.Height / 2 - 10, leafSize.Width - 20, 20), false));
     climbCollider.AddCollider(new Collider(new Rectangle((int)(leafSize.Width * 0.2f), (int)(leafSize.Height * 0.1f), (int)(leafSize.Width * 0.5f), leafSize.Height / 4), false));
     return climbCollider;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position">Position of the collider on the screen</param>
 /// <param name="size">Initial size of the collider</param>
 /// <param name="centeredCollider">Defines if the position is in the middle or the top left (centered = middle)</param>
 public Collider(Vector2 position, Size size, bool centeredCollider)
 {
     CenteredCollider = centeredCollider;
     int posX = centeredCollider ? (int)position.X - size.Width / 2 : (int)position.X;
     int posY = centeredCollider ? (int)position.Y - size.Height / 2 : (int)position.Y;
     CollisionBounds = new Rectangle(posX,posY,size.Width,size.Height);
     InitBounds = CollisionBounds;
 }
Exemplo n.º 3
0
 private MultiCollider BananaCollider(Vector2 position, Size size, bool centered, Direction direction)
 {
     MultiCollider climbCollider = new MultiCollider(position, size, centered, direction);
     climbCollider.AddCollider(new Collider(new Rectangle(1, 20, 15, 14), false));
     climbCollider.AddCollider(new Collider(new Rectangle(2, 1, 22, 17), false));
     climbCollider.AddCollider(new Collider(new Rectangle(2, 35, 19, 14), false));
     climbCollider.AddCollider(new Collider(new Rectangle(8, 50, 23, 15), false));
     return climbCollider;
 }
Exemplo n.º 4
0
 public DrawableRotateEntity(Size size)
 {
     Rotation = 0.0f;
     Scale = 1.0f;
     SpriteEffects = SpriteEffects.None;
     FrameSize = size;
     sourceRect = new Rectangle(0, 0, FrameSize.Width, FrameSize.Height);
     Origin = new Vector2(0, 0);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position">Position of the multi collider on the screen</param>
 /// <param name="size">Initial size of the multi collider</param>
 /// <param name="centeredCollider">defines if the position is in the middle or the top left (centered = middle)</param>
 /// <param name="colliders">List off colliders each collider will be adjusted to the base position (coordinates of subcolliders need to start at 0/0)</param>
 /// <param name="direction">Direction in which the collider should be facing (used for finding the correct possition of subcolliders</param>
 public MultiCollider(Vector2 position, Size size, bool centeredCollider, List<Collider> colliders, Direction direction)
     : base(position, size, centeredCollider)
 {
     foreach (Collider col in colliders)
     {
         col.MoveToPoint(CalculateCurrentColPos(col));
     }
     this.colliders = colliders;
     this.direction = direction;
 }
Exemplo n.º 6
0
 public Animation(Texture2D texture, Size frameSize, float frameUpdateInterval, float scale,
     Color tintColor, float rotation, SpriteEffects spriteEffects, int layerDepth)
 {
     timer = 0f;
     CurrentFrame = 0;
     Texture = texture;
     FrameSize = frameSize;
     Interval = frameUpdateInterval;
     Scale = scale;
     TintColor = tintColor;
     Rotation = rotation;
     SpriteEffects = spriteEffects;
     LayerDepth = layerDepth;
 }
Exemplo n.º 7
0
 public Banana(Size s,Direction direction)
     : base(s)
 {
     bananaSize = s;
     Direction = direction;
 }
Exemplo n.º 8
0
 public Animation(Texture2D texture, Size frameSize, float frameUpdateInterval, float scale, float rotation)
     : this(texture, frameSize, frameUpdateInterval, scale, Color.White, rotation, SpriteEffects.None, 0)
 {
 }
Exemplo n.º 9
0
 public Animation(Texture2D texture, Size frameSize)
     : this(texture, frameSize, 100f, 1.0f, 0.0f)
 {
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="position">Position of the multi collider on the screen</param>
 /// <param name="size">Initial size of the multi collider</param>
 /// <param name="centeredCollider">defines if the position is in the middle or the top left (centered = middle)</param>
 /// <param name="direction">Direction in which the collider should be facing (used for finding the correct possition of subcolliders</param>
 public MultiCollider(Vector2 position, Size size, bool centeredCollider, Direction direction)
     : base(position, size, centeredCollider)
 {
     this.direction = direction;
 }
Exemplo n.º 11
0
 private MultiCollider CreateJumpCollider(Vector2 position, Size size, bool centered, Direction direction)
 {
     MultiCollider jumpCollider = new MultiCollider(position, size, centered, direction);
     jumpCollider.AddCollider(new Collider(new Rectangle(0, monkeySize.Height / 2 - 25, monkeySize.Width, 40), false));
     return jumpCollider;
 }
Exemplo n.º 12
0
 private MultiCollider CreateClimbCollider(Vector2 position, Size size, bool centered,Direction direction)
 {
     MultiCollider climbCollider = new MultiCollider(position, size, centered, direction);
     climbCollider.AddCollider(new Collider(new Rectangle(monkeySize.Width / 2 - 20, 0, 40, monkeySize.Height), false));
     return climbCollider;
 }