Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FinancialFreedom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mietmiaa
FinancialFreedom
Commits
66d4e0d4
Commit
66d4e0d4
authored
2 weeks ago
by
josisaku
Browse files
Options
Downloads
Patches
Plain Diff
idk lol
parent
38dd63c6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Financial_Freedom/Financial_Freedom/Bossfight.cs
+54
-30
54 additions, 30 deletions
Financial_Freedom/Financial_Freedom/Bossfight.cs
with
54 additions
and
30 deletions
Financial_Freedom/Financial_Freedom/Bossfight.cs
+
54
−
30
View file @
66d4e0d4
...
...
@@ -10,7 +10,7 @@ using Jypeli.Widgets;
public
class
Bossfight
:
PhysicsGame
{
private
const
int
teroHealthValue
=
100
;
private
const
int
teroHealthValue
=
100
00
;
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
=
100
00
;
const
int
teroDamageToBoss
=
1
;
private
PlatformCharacter
tero
;
private
AssaultRifle
playerWeapon
;
private
PlatformCharacter
2
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
=
1
50
;
private
double
bossMoveSpeed
=
50
;
private
PhysicsObject
bottomWall
;
private
Weapon
rifle
=
new
AssaultRifle
(
2
0
,
5
);
private
Weapon
rifle
=
new
AssaultRifle
(
15
0
,
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
PlatformCharacter
2
(
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
(
6000
00
);
boss
.
Jump
(
12
00
);
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
=
"B
ossProjectile
"
,
Tag
=
"B
asicAttack
"
,
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
<
1
5
;
i
++)
for
(
int
i
=
0
;
i
<
7
5
;
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
-
5
0
0
,
tero
.
Position
.
X
+
5
0
0
);
meteor
.
X
=
RandomGen
.
NextDouble
(
tero
.
Position
.
X
-
7
50
,
tero
.
Position
.
X
+
7
50
);
meteor
.
Y
=
Level
.
Top
-
100
;
Add
(
meteor
);
...
...
@@ -435,14 +459,14 @@ public class Bossfight : PhysicsGame
}
collidingObject
.
Destroy
();
if
(
otherObject
==
boss
)
if
(
otherObject
==
tero
)
{
boss
Health
.
Value
-=
10
0
;
tero
Health
.
Value
-=
10
;
}
});
}
if
(
counterMeteor
==
5
)
if
(
counterMeteor
==
10
)
{
spessuAttack
.
Stop
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment