Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using SFML.Audio;
- using SFML.Graphics;
- using SFML.Window;
- using DanmakufuDotNet;
- public class TemplatePlayerShot : Entity
- {
- public float Angle
- {
- set { _angle = Helper.AngleNormalize(Helper.AngleToRadians(value)); }
- get { return Helper.AngleToDegrees(_angle); }
- }
- public float Speed { get; set; }
- public float MaxSpeed { get; set; }
- public float Curve { get; set; }
- public int Delay { get; set; }
- public float Acceleration { get; set; }
- private float _angle;
- public override void Update()
- {
- if (Delay == 0)
- {
- X += Speed * (float)Math.Cos(_angle);
- Y += Speed * (float)Math.Sin(_angle);
- Angle += Curve;
- Sprite.Rotation = 360 - Angle;
- if (Acceleration != 0)
- {
- if (Acceleration > 0 && Speed < MaxSpeed)
- {
- Speed += Acceleration;
- }
- else if (Acceleration < 0 && Speed > MaxSpeed)
- {
- Speed -= Acceleration;
- }
- }
- }
- else
- {
- Delay--;
- }
- if (!Game.Playfield.IsInPlayfield(X, Y))
- {
- Destroy();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment