예제 #1
0
파일: Engine.cs 프로젝트: Al90/Project
        /// <summary>
        /// Nächste Spielerposition rechnen
        /// </summary>
        /// <param name="pl">Spieler</param>
        /// <returns>Spielerposition</returns>
        private PointF getNextPosition(Player pl)
        {
            // Neuer Punkt erstellen
            PointF Next = new Point();
            // Verschiebung in X rechnen
            Next.X = pl.Position.X + (float)(pl.Speed * Math.Cos(pl.Angle * Math.PI / 180));

            // Verschiebung in Y rechnen
            Next.Y = pl.Position.Y + (float)(pl.Speed * Math.Sin(pl.Angle * Math.PI / 180));

            // Punkt zurückgeben
            return Next;
        }
예제 #2
0
파일: Engine.cs 프로젝트: Al90/Project
 /// <summary>
 /// Konstruktor
 /// </summary>
 public Engine()
 {
     Lines = new List<Line>();
     Rider = new Player(new Point(100,500),60,global::LineRider.Properties.Resources.player_gerade);
     Playtime = new TimeSpan();
     GameButtons = new List<GameButton>();
     Origin = new Point();
     Messages = new ConcurrentQueue<UI_Message>();
     Offset = new Point(0, 600);
     int Size = 40;
     Play = new GameButton(new Point((int)(800 / 2 - (2 * Size + 1.5 * 10)), 10), Size, true, global::LineRider.Properties.Resources.Button_Play_icon);
     Pause = new GameButton(new Point((int)(800 / 2 - (1 * Size + 0.5 * 10)), 10), Size, true, global::LineRider.Properties.Resources.Button_Pause_icon);
     Save = new GameButton(new Point((int)(800 / 2 + (0.5 * 10)), 10), Size, true, global::LineRider.Properties.Resources.Save_icon);
     Load = new GameButton(new Point((int)(800 / 2 + (1 * Size + 1.5 * 10)), 10), Size, true, global::LineRider.Properties.Resources.Open_Folder_icon);
     GameButtons.Add(Play);
     GameButtons.Add(Pause);
     GameButtons.Add(Save);
     GameButtons.Add(Load);
     State = EngineStates.Editor;
     Deadpoints = new List<PointF>();
     Move = new AutoResetEvent(false);
     Process = new AutoResetEvent(true);
     MoveTimer = new System.Windows.Forms.Timer();
     MoveTimer.Interval = 50;
     MoveTimer.Tick += MoveTimer_Tick;
     MoveTimer.Start();
 }