public override void OnUpdate() { if ((HostEntity.CollisionLeft() == ColliderType.Land) || (HostEntity.Location.X <= 0)) { HostEntity.Velocity.X = _speed; HostEntity.SetAnime(_rightAnimeStartIndex, _rightAnimeEndIndex, 8); } if ((HostEntity.CollisionRight() == ColliderType.Land) || (HostEntity.Location.X >= Core.I.CurrentMap.Size.X * 16 - 1)) { HostEntity.Velocity.X = -_speed; HostEntity.SetAnime(_leftAnimeStartIndex, _leftAnimeEndIndex, 8); } }
public override void OnUpdate() { if ((HostEntity.CollisionLeft() == ColliderType.Land) || (HostEntity.Location.X <= 0)) { HostEntity.Velocity.X = _speed; HostEntity.SetAnime(_rightAnimeStartIndex, _rightAnimeEndIndex, 8); } if ((HostEntity.CollisionRight() == ColliderType.Land) || (HostEntity.Location.X >= Core.I.CurrentMap.Size.X * 16 - 1)) { HostEntity.Velocity.X = -_speed; HostEntity.SetAnime(_leftAnimeStartIndex, _leftAnimeEndIndex, 8); } HostEntity.Velocity.Y = (float)Math.Sin(_deg / 180.0 * Math.PI) * (HostEntity.Direction == Direction.Left ? -1 : 1); _deg = (_deg + 5) % 360; }