source: 2014/27/AleksanteriV/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Protokolla236TrueSurvivor/Player.cs @ 5280

Revision 5280, 1.7 KB checked in by mijoilmo, 6 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using Jypeli;
4using Jypeli.Assets;
5using Jypeli.Controls;
6using Jypeli.Effects;
7using Jypeli.Widgets;
8
9public class Player : PhysicsObject
10{
11    GameObject thrusterEffect;
12    Level level;
13    Camera camera;
14    public void rotate(double rotSpeed)
15    {
16        this.AngularVelocity = rotSpeed;
17    }
18    public void thrusterStart(double speed)
19    {
20        this.thrusterEffect.IsVisible = true;
21        this.Push(Vector.FromLengthAndAngle(speed * 800, this.Angle + Angle.RightAngle));
22    }
23    public void thrusterEnd()
24    {
25        this.thrusterEffect.IsVisible = false;
26        //if this.ids, enable ids
27    }
28    public Player(Level level)
29        : base(40, 40)
30    {
31        this.Image = Proto236b.images["player"];
32        this.level = level;
33        bool IDS = true; //inertial dampening system, katsotaan pistetäänkö ostettavaksi peliin
34        if (IDS == true)
35        {
36            this.LinearDamping = 0.97;
37        }
38        else
39        {
40            this.LinearDamping = 1;
41        }
42        this.AngularDamping = 0.7;
43
44        this.thrusterEffect = new GameObject(40, 40);
45        thrusterEffect.Image = Proto236b.images["player_thruster"];
46        thrusterEffect.IsVisible = false;
47        thrusterEffect.Y -= 20;
48        Add(thrusterEffect);
49    }
50    public override void Update(Time time)
51    {
52        if (this.X + this.level.Width / 2.0 > this.level.Right)
53        {
54            if (this.Position.X > this.level.Right)
55            {
56                //((Game)this.Parent).Camera
57                this.X = this.level.Left;
58            }
59        }
60        base.Update(time);
61    }
62}
Note: See TracBrowser for help on using the repository browser.