using System; using System.Collections.Generic; using Jypeli; using Jypeli.Assets; using Jypeli.Controls; using Jypeli.Effects; using Jypeli.Widgets; public class Player : PhysicsObject { GameObject thrusterEffect; Proto236b parent; public void rotate(double rotSpeed) { this.AngularVelocity = rotSpeed; } public void thrusterStart(double speed) { this.thrusterEffect.IsVisible = true; this.Push(Vector.FromLengthAndAngle(speed * 800, this.Angle + Angle.RightAngle)); } public void thrusterEnd() { this.thrusterEffect.IsVisible = false; //if this.ids, enable ids } public Player(Proto236b parent) : base(40, 40) { this.parent = parent; this.Image = parent.Images["player"]; this.Shape = Shape.FromImage(parent.Images["player"]); bool IDS = false; //inertial dampening system, katsotaan pistetäänkö ostettavaksi peliin if (IDS == true) { this.LinearDamping = 0.97; } else { this.LinearDamping = 1; } this.AngularDamping = 0.7; this.thrusterEffect = new GameObject(40, 40); thrusterEffect.Animation = new Animation(parent.ImageLists["player_thruster"]); thrusterEffect.Animation.FPS = 18; thrusterEffect.Animation.Start(); thrusterEffect.IsVisible = false; thrusterEffect.Y -= 19; Add(thrusterEffect); } public override void Update(Time time) { base.Update(time); if (this.X > parent.Level.Right) { this.X = parent.Level.Left; }else if (this.X < parent.Level.Left){ this.X = parent.Level.Right; } } }