Example #1
0
 public Thing(GameScene game, Vector position)
 {
     this.Game = game;
     this.Position = position;
     Velocity = Vector.Zero;
     Removed = false;
     Carry = new ThingList();
 }
Example #2
0
File: Tiun.cs Project: sinshu/mafia
 public Tiun(GameScene game, Vector position, int direction, int speed, int life, int type)
     : base(game, position)
 {
     this.direction = direction;
     this.speed = speed;
     this.life = life;
     this.type = type;
 }
Example #3
0
 public Thing(GameScene game, int row, int col)
 {
     this.Game = game;
     Position.X = col * Mafia.BLOCK_WIDTH;
     Position.Y = row * Mafia.BLOCK_WIDTH;
     Velocity = Vector.Zero;
     Removed = false;
     Carry = new ThingList();
 }
Example #4
0
 public void Tick(Random random)
 {
     velocity.Y += 0.125;
     position += velocity;
     if (position.X < -16 || position.X > Mafia.SCREEN_WIDTH || position.Y > Mafia.SCREEN_HEIGHT)
     {
         Reset(random);
     }
     if (type == MAFIA)
     {
     }
     else if (type == COIN)
     {
         animation = (animation + 1) % 16;
     }
 }
Example #5
0
 public Player(GameScene game, int row, int col, int direction)
     : base(game, row, col)
 {
     if (direction == RIGHT)
     {
         this.Direction = RIGHT;
     }
     else
     {
         this.Direction = LEFT;
     }
     Animation = 0;
     LandState = IN_AIR;
     JumpTick = -1;
     focus = Vector.Zero;
     if (Center.X + focus.X < Mafia.SCREEN_WIDTH / 2)
     {
         focus.X = Mafia.SCREEN_WIDTH / 2 - Center.X;
     }
     else if (Center.X + focus.X > game.Map.Width - Mafia.SCREEN_WIDTH / 2)
     {
         focus.X = game.Map.Width - Mafia.SCREEN_WIDTH / 2 - Center.X;
     }
     if (Center.Y + focus.Y < Mafia.SCREEN_HEIGHT / 2)
     {
         focus.Y = Mafia.SCREEN_HEIGHT / 2 - Center.Y;
     }
     else if (Center.Y + focus.Y > game.Map.Height - Mafia.SCREEN_HEIGHT / 2)
     {
         focus.Y = game.Map.Height - Mafia.SCREEN_HEIGHT / 2 - Center.Y;
     }
     missed = false;
     left = up = right = down = false;
     jumpSound = false;
     tiunSound = false;
     coinSound = false;
 }
Example #6
0
 public virtual void MoveTo(Vector position)
 {
     MoveHorizontalTo(position.X);
     MoveVerticalTo(position.Y);
 }
Example #7
0
 public virtual Vector MoveBy(Vector delta)
 {
     return new Vector(MoveHorizontalBy(delta.X), MoveVerticalBy(delta.Y));
 }