Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Xna.Framework;
  6.  
  7. namespace Game
  8. {
  9.     class Dolphin
  10.     {
  11.         private Vector2 _location = new Vector2(50, 200);
  12.         private int _move = 200;
  13.         private int _speed = 5;
  14.  
  15.         public Vector2 Location
  16.         {
  17.             get { return _location; }
  18.         }
  19.  
  20.         public void Move(int Height)
  21.         {
  22.             _move = Height;
  23.         }
  24.  
  25.         public void Update()
  26.         {
  27.             if (Math.Abs(_location.Y - _move) < _speed)
  28.                 _location.Y = _move;
  29.             else if (_location.Y < _move)
  30.                 _location.Y += _speed;
  31.             else
  32.                 _location.Y -= _speed;
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement