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

Revision 5299, 1.7 KB checked in by mijoilmo, 6 years ago (diff)

kaiken muutin

RevLine 
[5224]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{
[5256]11    GameObject thrusterEffect;
[5299]12    Proto236b parent;
13
[5224]14    public void rotate(double rotSpeed)
15    {
[5256]16        this.AngularVelocity = rotSpeed;
[5224]17    }
[5256]18    public void thrusterStart(double speed)
[5224]19    {
[5256]20        this.thrusterEffect.IsVisible = true;
[5270]21        this.Push(Vector.FromLengthAndAngle(speed * 800, this.Angle + Angle.RightAngle));
[5224]22    }
[5256]23    public void thrusterEnd()
24    {
25        this.thrusterEffect.IsVisible = false;
26        //if this.ids, enable ids
27    }
[5299]28    public Player(Proto236b parent)
[5261]29        : base(40, 40)
30    {
[5284]31        this.parent = parent;
[5299]32        this.Image = parent.Images["player"];
33        this.Shape = Shape.FromImage(parent.Images["player"]);
[5286]34        bool IDS = false; //inertial dampening system, katsotaan pistetäänkö ostettavaksi peliin
[5261]35        if (IDS == true)
36        {
37            this.LinearDamping = 0.97;
38        }
39        else
40        {
41            this.LinearDamping = 1;
42        }
43        this.AngularDamping = 0.7;
44
[5270]45        this.thrusterEffect = new GameObject(40, 40);
[5299]46        thrusterEffect.Image = parent.Images["player_thruster"];
[5261]47        thrusterEffect.IsVisible = false;
48        thrusterEffect.Y -= 20;
49        Add(thrusterEffect);
50    }
[5264]51    public override void Update(Time time)
52    {
53        base.Update(time);
[5299]54        if (this.X > parent.Level.Right) {
55            this.X = parent.Level.Left;
56        }else if (this.X < parent.Level.Left){
57            this.X = parent.Level.Right;
58        }
[5264]59    }
[5261]60}
Note: See TracBrowser for help on using the repository browser.