Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Audio;
- namespace GameTemplate
- {
- public class Player : Entity
- {
- public Camera2d Tehcamera;
- public Player(Vector2 StartPosition, Texture2D SetSprite) : base(StartPosition,SetSprite)
- {
- DrawDepth = 0;
- }
- public override void Update(float DT)
- {
- Velocity = Vector2.Zero;
- if ((Keyboard.GetState().IsKeyDown(Keys.W) || Keyboard.GetState().IsKeyDown(Keys.Up)) && !WallUp)
- {
- Velocity.Y = -Speed;
- }
- if ((Keyboard.GetState().IsKeyDown(Keys.S) || Keyboard.GetState().IsKeyDown(Keys.Down)) && !WallDown)
- {
- Velocity.Y = Speed;
- }
- if ((Keyboard.GetState().IsKeyDown(Keys.A) || Keyboard.GetState().IsKeyDown(Keys.Left)) && !WallLeft)
- {
- Velocity.X = -Speed;
- }
- if ((Keyboard.GetState().IsKeyDown(Keys.D) || Keyboard.GetState().IsKeyDown(Keys.Right)) && !WallRight)
- {
- Velocity.X = Speed;
- }
- Position.X += Game1.UpdateinputX(DT);
- Position.Y += Game1.UpdateinputY(DT);
- base.Update(DT);
- Tehcamera.Pos = Position;
- }
- public void SewtCamera(Camera2d cam)
- {
- Tehcamera = cam;
- }
- }
- }
Add Comment
Please, Sign In to add comment