Advertisement
Cieslin

GR_Oceniane_2

Nov 7th, 2019
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.78 KB | None | 0 0
  1. //BALL
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using Microsoft.Xna.Framework;
  9. using Microsoft.Xna.Framework.Graphics;
  10.  
  11. namespace Oceniane_2
  12. {
  13.     public class Ball
  14.     {
  15.         public Rectangle Body { get; set; }
  16.  
  17.         private Texture2D _texture;
  18.         private Texture2D _animatedTexture;
  19.         private int _animationTime;
  20.         private int _ballTextureOffset ;
  21.         private int _lastFrameTime;
  22.         private Rectangle _ballCurrentFrame;
  23.  
  24.         public void AnimateFrame(GameTime time)
  25.         {
  26.             _lastFrameTime += time.ElapsedGameTime.Milliseconds;
  27.             if (_lastFrameTime > _animationTime)
  28.             {
  29.                 NextAnimationFrame();
  30.                 _lastFrameTime -= _animationTime;
  31.             }
  32.         }
  33.  
  34.         private void NextAnimationFrame()
  35.         {
  36.             if(_ballCurrentFrame.X + )
  37.         }
  38.     }
  39. }
  40.  
  41. //Paddle
  42.  
  43. using System;
  44. using System.Collections.Generic;
  45. using System.Linq;
  46. using System.Text;
  47. using System.Threading.Tasks;
  48. using Microsoft.Xna.Framework;
  49. using Microsoft.Xna.Framework.Graphics;
  50.  
  51. namespace Oceniane_2
  52. {
  53.     public class Paddle
  54.     {
  55.         public Rectangle Body { get; set; }
  56.  
  57.         private Texture2D _texture;
  58.         private int _speed;
  59.         private bool _isHitted;
  60.         private char _positionOnScreen;
  61.         private Vector2 _startPosition;
  62.         private Rectangle _topOuterFragment, _topInnerFragment, _innerFragment, _botInnerFragment, _botOuterFragment;
  63.  
  64.         public Paddle(Texture2D texture, Vector2 startPosition, char positionOnScreen)
  65.         {
  66.             _texture = texture;
  67.             _startPosition = startPosition;
  68.             _positionOnScreen = positionOnScreen;
  69.             Body = new Rectangle((int)_startPosition.X,(int)_startPosition.Y, _texture.Width, _texture.Height);
  70.         }
  71.  
  72.         private void SetFragments()
  73.         {
  74.             if (_positionOnScreen == 'l')
  75.             {
  76.                
  77.             }
  78.             if (_positionOnScreen == 'r')
  79.             {
  80.                 _topOuterFragment = new Rectangle(body.X, body.Y, body.Width + fragmentXOffset, body.Height / 5);
  81.                 _topInnerFragment = new Rectangle(body.X, body.Y + 1 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
  82.                 _innerFragment = new Rectangle(body.X, body.Y + 2 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
  83.                 _botInnerFragment = new Rectangle(body.X, body.Y + 3 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
  84.                 _botOuterFragment = new Rectangle(body.X, body.Y + 4 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
  85.             }
  86.         }
  87.     }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement