Skip to content
Snippets Groups Projects
Commit 66d4e0d4 authored by josisaku's avatar josisaku
Browse files

idk lol

parent 38dd63c6
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ using Jypeli.Widgets;
public class Bossfight : PhysicsGame
{
private const int teroHealthValue = 100;
private const int teroHealthValue = 10000;
private const int terofireRate = 10;
private const int teroAmmoValue = terofireRate;
......@@ -18,23 +18,23 @@ public class Bossfight : PhysicsGame
private const int bulletSize = 2;
private const int bulletLifespan = 1;
private const int bossHealthValue = 100;
private const int bossHealthValue = 10000;
const int teroDamageToBoss = 1;
private PlatformCharacter tero;
private AssaultRifle playerWeapon;
private PlatformCharacter2 boss;
private PlatformCharacter boss;
private IntMeter bossHealth;
private IntMeter teroHealth;
private Timer bossAttackTimer;
private Timer bossMovementTimer;
private Timer spessuTimer;
private Timer spessuAttack;
private double bossMoveSpeed = 150;
private double bossMoveSpeed = 50;
private PhysicsObject bottomWall;
private Weapon rifle = new AssaultRifle(20, 5);
private Weapon rifle = new AssaultRifle(150, 100);
private bool startBoss = false;
private bool isBossMoving = false;
......@@ -135,9 +135,9 @@ public class Bossfight : PhysicsGame
tero.Position = new Vector(0, 0);
tero.Mass = 10.0;
tero.CollisionIgnoreGroup = 2;
tero.CollisionIgnoreGroup = 1;
rifle = new AssaultRifle(150, 100);
//rifle = new AssaultRifle(150, 100);
rifle.Image = LoadImage("ch661.png");
tero.Weapon = rifle;
......@@ -175,11 +175,11 @@ public class Bossfight : PhysicsGame
private void CreateBoss()
{
boss = new PlatformCharacter2(120, 240);
boss = new PlatformCharacter(120, 240);
boss.Shape = Shape.Rectangle;
boss.Color = Color.Red;
boss.Position = new Vector(600, 100);
boss.CollisionIgnoreGroup = 2;
boss.CollisionIgnoreGroup = 1;
boss.Mass = 10.0;
Add(boss);
......@@ -235,6 +235,13 @@ public class Bossfight : PhysicsGame
ShowPlayerDamageEffect();
CheckPlayerDeath();
}
if (projectile.Tag as string == "Meteor" && target == tero)
{
teroHealth.Value -= 10;
projectile.Destroy();
ShowPlayerDamageEffect();
CheckPlayerDeath();
}
}
private void ShowBossDamageEffect()
......@@ -260,14 +267,13 @@ public class Bossfight : PhysicsGame
private void StartBossBehavior()
{
// Projectile attack pattern
bossAttackTimer = new Timer(1.5);
bossAttackTimer.Timeout += BossAttack;
bossAttackTimer.Start();
spessuTimer = new Timer(5);
/*spessuTimer = new Timer(5);
spessuTimer.Timeout += Spessu;
spessuTimer.Start();
spessuTimer.Start();*/
// Movement pattern
bossMovementTimer = new Timer(0.5);
......@@ -285,19 +291,19 @@ public class Bossfight : PhysicsGame
switch (i)
{
case 0:
boss.Jump(600000);
boss.Jump(1200);
break;
case 1:
StartMovement(new Vector(12, 0), 1.0);
StartMovement(new Vector(12, 0), 0.7);
break;
case 2:
StartMovement(new Vector(-12, 0), 1.0);
StartMovement(new Vector(-12, 0), 0.7);
break;
case 3:
StartMovement(new Vector(18, 0), 0.7);
StartMovement(new Vector(18, 0), 0.2);
break;
case 4:
StartMovement(new Vector(-18, 0), 0.7);
StartMovement(new Vector(-18, 0), 0.2);
break;
}
}
......@@ -334,16 +340,16 @@ public class Bossfight : PhysicsGame
ShootProjectiles();
break;
case 1:
ShootProjectiles();
break;
case 2:
ShootProjectiles();
break;
case 3:
Spessu();
break;
case 4:
Spessu();
break;
}
}
......@@ -358,11 +364,26 @@ public class Bossfight : PhysicsGame
Shape = Shape.Circle,
Color = Color.Yellow,
Position = boss.Position,
Tag = "BossProjectile",
Tag = "BasicAttack",
IgnoresGravity = false,
CollisionIgnoreGroup = 1 // Don't collide with other boss projectiles
CollisionIgnoreGroup = 2 // Don't collide with other boss projectiles
};
AddCollisionHandler<PhysicsObject, PhysicsObject>(projectile,
(collidingObject, otherObject) =>
{
//if (collidingObject.Tag == otherObject.Tag)
//{
//return;
//}
collidingObject.Destroy();
if (otherObject == tero)
{
teroHealth.Value -= 20;
}
});
// Add velocity towards player
Vector direction = (tero.Position - boss.Position).Normalize();
projectile.Velocity = direction * 3000;
......@@ -378,6 +399,7 @@ public class Bossfight : PhysicsGame
{
Keyboard.Listen(Key.A, ButtonState.Down, () => tero.X -= 12, "Move left");
Keyboard.Listen(Key.D, ButtonState.Down, () => tero.X += 12, "Move right");
Keyboard.Listen(Key.W, ButtonState.Pressed, () => tero.Y += 15, "Jump");
Keyboard.Listen(Key.W, ButtonState.Down, () => tero.Jump(500.0), "Jump");
// Safe shooting
......@@ -390,6 +412,8 @@ public class Bossfight : PhysicsGame
Keyboard.Listen(Key.Escape, ButtonState.Pressed, Exit, "Quit");
}
public void SafeJump() {tero.Y += 1; tero.Jump(500.0);}
void TeroShootWeapon(Weapon weapon) {
if (weapon == null)
......@@ -406,7 +430,7 @@ public class Bossfight : PhysicsGame
bullet.IgnoresGravity = false;
bullet.Mass = 1.0;
bullet.Tag = "PlayerProjectile";
bullet.CollisionIgnoreGroup = 1;
bullet.CollisionIgnoreGroup = 2;
}
}
......@@ -417,12 +441,12 @@ public class Bossfight : PhysicsGame
int counterMeteor = 0;
spessuAttack = Timer.CreateAndStart(0.1, () =>
{
for (int i = 0; i < 15; i++)
for (int i = 0; i < 75; i++)
{
PhysicsObject meteor = new PhysicsObject(size, size); // or Meteor(i) if you return PhysicsObject
meteor.Shape = Shape.Circle;
meteor.Tag = "meteor";
meteor.X = RandomGen.NextDouble(tero.Position.X - 500, tero.Position.X + 500);
meteor.X = RandomGen.NextDouble(tero.Position.X - 750, tero.Position.X + 750);
meteor.Y = Level.Top - 100;
Add(meteor);
......@@ -435,14 +459,14 @@ public class Bossfight : PhysicsGame
}
collidingObject.Destroy();
if (otherObject == boss)
if (otherObject == tero)
{
bossHealth.Value -= 100;
teroHealth.Value -= 10;
}
});
}
if (counterMeteor == 5)
if (counterMeteor == 10)
{
spessuAttack.Stop();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment