Skip to content

Commit 48ea076

Browse files
committed
- Added Gun Volt enemy.
- Fixed show info feature to show correct values again. - Modified the RNG again.
1 parent 93640d0 commit 48ea076

30 files changed

+623
-65
lines changed
-7.04 KB
Binary file not shown.
-30.2 KB
Binary file not shown.
10.6 KB
Loading
-11.2 KB
Binary file not shown.

XSharp/Engine/Entities/Enemies/AxeMax/AxeMaxLumberjack.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ protected override void OnCreate()
5959
PaletteName = "axeMaxPalette";
6060
SpriteSheetName = "AxeMax";
6161
DefaultDirection = Direction.LEFT;
62+
SpawnFacedToPlayer = false;
6263

6364
SetAnimationNames("Idle", "Laughing", "Throwing");
6465

XSharp/Engine/Entities/Enemies/AxeMax/AxeMaxTrunkHurtbox.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected override void OnCreate()
3838
base.OnCreate();
3939

4040
Invincible = true;
41+
SpawnFacedToPlayer = false;
4142

4243
trunk = (AxeMaxTrunk) Parent;
4344
}

XSharp/Engine/Entities/Enemies/Bosses/ChillPenguin/ChillPenguin.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ private void OnIdle(EntityState state, long frameCounter)
543543

544544
if (!DONT_ATTACK)
545545
{
546-
int value = Engine.RNG.NextInt(16);
546+
var value = Engine.RNG.NextUInt(16);
547547

548548
switch (lastState)
549549
{
@@ -569,15 +569,15 @@ private void OnIdle(EntityState state, long frameCounter)
569569
if (AtLeastOneSculpturesAlive())
570570
State = ChillPenguinState.HANGING;
571571
else
572-
value = Engine.RNG.NextInt(16);
572+
value = Engine.RNG.NextUInt(16);
573573

574574
break;
575575

576576
default:
577577
if (!AllSculpturesAlive())
578578
State = ChillPenguinState.BLOWING;
579579
else
580-
value = Engine.RNG.NextInt(16);
580+
value = Engine.RNG.NextUInt(16);
581581

582582
break;
583583
}
@@ -608,15 +608,15 @@ private void OnIdle(EntityState state, long frameCounter)
608608
if (AtLeastOneSculpturesAlive())
609609
State = ChillPenguinState.HANGING;
610610
else
611-
value = Engine.RNG.NextInt(16);
611+
value = Engine.RNG.NextUInt(16);
612612

613613
break;
614614

615615
default:
616616
if (!AllSculpturesAlive())
617617
State = ChillPenguinState.BLOWING;
618618
else
619-
value = Engine.RNG.NextInt(16);
619+
value = Engine.RNG.NextUInt(16);
620620

621621
break;
622622
}
@@ -647,15 +647,15 @@ private void OnIdle(EntityState state, long frameCounter)
647647
if (AtLeastOneSculpturesAlive())
648648
State = ChillPenguinState.HANGING;
649649
else
650-
value = Engine.RNG.NextInt(16);
650+
value = Engine.RNG.NextUInt(16);
651651

652652
break;
653653

654654
default:
655655
if (!AllSculpturesAlive())
656656
State = ChillPenguinState.BLOWING;
657657
else
658-
value = Engine.RNG.NextInt(16);
658+
value = Engine.RNG.NextUInt(16);
659659

660660
break;
661661
}
@@ -682,15 +682,15 @@ private void OnIdle(EntityState state, long frameCounter)
682682
if (AtLeastOneSculpturesAlive())
683683
State = ChillPenguinState.HANGING;
684684
else
685-
value = Engine.RNG.NextInt(16);
685+
value = Engine.RNG.NextUInt(16);
686686

687687
break;
688688

689689
default:
690690
if (!AllSculpturesAlive())
691691
State = ChillPenguinState.BLOWING;
692692
else
693-
value = Engine.RNG.NextInt(16);
693+
value = Engine.RNG.NextUInt(16);
694694

695695
break;
696696
}
@@ -717,15 +717,15 @@ private void OnIdle(EntityState state, long frameCounter)
717717
if (AtLeastOneSculpturesAlive())
718718
State = ChillPenguinState.HANGING;
719719
else
720-
value = Engine.RNG.NextInt(16);
720+
value = Engine.RNG.NextUInt(16);
721721

722722
break;
723723

724724
default:
725725
if (!AllSculpturesAlive())
726726
State = ChillPenguinState.BLOWING;
727727
else
728-
value = Engine.RNG.NextInt(16);
728+
value = Engine.RNG.NextUInt(16);
729729

730730
break;
731731
}
@@ -753,15 +753,15 @@ private void OnIdle(EntityState state, long frameCounter)
753753
if (AtLeastOneSculpturesAlive())
754754
State = ChillPenguinState.HANGING;
755755
else
756-
value = Engine.RNG.NextInt(16);
756+
value = Engine.RNG.NextUInt(16);
757757

758758
break;
759759

760760
default:
761761
if (!AllSculpturesAlive())
762762
State = ChillPenguinState.BLOWING;
763763
else
764-
value = Engine.RNG.NextInt(16);
764+
value = Engine.RNG.NextUInt(16);
765765

766766
break;
767767
}
@@ -792,15 +792,15 @@ private void OnIdle(EntityState state, long frameCounter)
792792
if (AtLeastOneSculpturesAlive())
793793
State = ChillPenguinState.HANGING;
794794
else
795-
value = Engine.RNG.NextInt(16);
795+
value = Engine.RNG.NextUInt(16);
796796

797797
break;
798798

799799
default:
800800
if (!AllSculpturesAlive())
801801
State = ChillPenguinState.BLOWING;
802802
else
803-
value = Engine.RNG.NextInt(16);
803+
value = Engine.RNG.NextUInt(16);
804804

805805
break;
806806
}
@@ -891,7 +891,7 @@ private void ShootIce()
891891
PenguinIce ice = Engine.Entities.Create<PenguinIce>(new
892892
{
893893
Shooter = this,
894-
Bump = Engine.RNG.NextInt(2) == 1
894+
Bump = Engine.RNG.NextUInt(2) == 1
895895
});
896896

897897
ice.Spawn();

XSharp/Engine/Entities/Enemies/Enemy.cs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ internal static void Precache()
5454
private string lastPaletteName;
5555
private bool flashing;
5656

57+
public bool SpawnFacedToPlayer
58+
{
59+
get;
60+
set;
61+
} = true;
62+
5763
public HitResponse HitResponse
5864
{
5965
get;
@@ -72,43 +78,43 @@ public FixedSingle ContactDamage
7278
set;
7379
} = 1;
7480

75-
public long SmallHealthDropOdd
81+
public ulong SmallHealthDropOdd
7682
{
7783
get;
7884
set;
7985
} = 0;
8086

81-
public long BigHealthDropOdd
87+
public ulong BigHealthDropOdd
8288
{
8389
get;
8490
set;
8591
} = 0;
8692

87-
public long SmallAmmoDropOdd
93+
public ulong SmallAmmoDropOdd
8894
{
8995
get;
9096
set;
9197
} = 0;
9298

93-
public long BigAmmoDropOdd
99+
public ulong BigAmmoDropOdd
94100
{
95101
get;
96102
set;
97103
} = 0;
98104

99-
public long LifeUpDropOdd
105+
public ulong LifeUpDropOdd
100106
{
101107
get;
102108
set;
103109
} = 0;
104110

105-
public long NothingDropOdd
111+
public ulong NothingDropOdd
106112
{
107113
get;
108114
set;
109115
} = 100;
110116

111-
public long TotalDropOdd => SmallHealthDropOdd + BigHealthDropOdd + SmallAmmoDropOdd + BigAmmoDropOdd + LifeUpDropOdd + NothingDropOdd;
117+
public ulong TotalDropOdd => SmallHealthDropOdd + BigHealthDropOdd + SmallAmmoDropOdd + BigAmmoDropOdd + LifeUpDropOdd + NothingDropOdd;
112118

113119
protected Enemy()
114120
{
@@ -130,6 +136,9 @@ protected override void OnSpawn()
130136

131137
lastPaletteName = null;
132138
flashing = false;
139+
140+
if (SpawnFacedToPlayer && Engine.Player != null)
141+
Direction = GetHorizontalDirection(Engine.Player);
133142
}
134143

135144
protected override bool OnPreThink()
@@ -219,7 +228,7 @@ protected override void OnBroke()
219228

220229
OnExplode();
221230

222-
var random = Engine.RNG.NextLong(TotalDropOdd);
231+
var random = Engine.RNG.NextLong((ulong) TotalDropOdd);
223232
if (random > TotalDropOdd - NothingDropOdd)
224233
return;
225234

XSharp/Engine/Entities/Enemies/Flammingle/Flammingle.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ protected override void OnCreate()
141141
base.OnCreate();
142142

143143
DefaultDirection = Direction.LEFT;
144+
SpawnFacedToPlayer = false;
144145

145146
PaletteName = "flamminglePalette";
146147
SpriteSheetName = "Flammingle";
@@ -157,7 +158,7 @@ private void OnIdle(EntityState state, long frameCounter)
157158
var player = Engine.Player;
158159
if (frameCounter >= 4
159160
&& player != null
160-
&& GetHorizontalDirection(player) == Direction.Oposite()
161+
&& GetHorizontalDirection(player) == Direction
161162
&& (player.Origin.X - Origin.X).Abs <= ATTACK_DISTANCE_X
162163
&& Hitbox.VerticallInterval.IsOverlaping(player.CollisionBox.VerticallInterval))
163164
State = FlammingleState.ATTACKING;

XSharp/Engine/Entities/Enemies/Flammingle/FlammingleShot.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ protected override void OnCreate()
2222
{
2323
base.OnCreate();
2424

25+
SpawnFacedToPlayer = false;
26+
2527
PaletteName = "flamminglePalette";
2628
SpriteSheetName = "Flammingle";
2729

0 commit comments

Comments
 (0)