Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //BALL
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- namespace Oceniane_2
- {
- public class Ball
- {
- public Rectangle Body { get; set; }
- private Texture2D _texture;
- private Texture2D _animatedTexture;
- private int _animationTime;
- private int _ballTextureOffset ;
- private int _lastFrameTime;
- private Rectangle _ballCurrentFrame;
- public void AnimateFrame(GameTime time)
- {
- _lastFrameTime += time.ElapsedGameTime.Milliseconds;
- if (_lastFrameTime > _animationTime)
- {
- NextAnimationFrame();
- _lastFrameTime -= _animationTime;
- }
- }
- private void NextAnimationFrame()
- {
- if(_ballCurrentFrame.X + )
- }
- }
- }
- //Paddle
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Graphics;
- namespace Oceniane_2
- {
- public class Paddle
- {
- public Rectangle Body { get; set; }
- private Texture2D _texture;
- private int _speed;
- private bool _isHitted;
- private char _positionOnScreen;
- private Vector2 _startPosition;
- private Rectangle _topOuterFragment, _topInnerFragment, _innerFragment, _botInnerFragment, _botOuterFragment;
- public Paddle(Texture2D texture, Vector2 startPosition, char positionOnScreen)
- {
- _texture = texture;
- _startPosition = startPosition;
- _positionOnScreen = positionOnScreen;
- Body = new Rectangle((int)_startPosition.X,(int)_startPosition.Y, _texture.Width, _texture.Height);
- }
- private void SetFragments()
- {
- if (_positionOnScreen == 'l')
- {
- }
- if (_positionOnScreen == 'r')
- {
- _topOuterFragment = new Rectangle(body.X, body.Y, body.Width + fragmentXOffset, body.Height / 5);
- _topInnerFragment = new Rectangle(body.X, body.Y + 1 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
- _innerFragment = new Rectangle(body.X, body.Y + 2 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
- _botInnerFragment = new Rectangle(body.X, body.Y + 3 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
- _botOuterFragment = new Rectangle(body.X, body.Y + 4 * body.Height / 5, body.Width + fragmentXOffset, body.Height / 5);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement