Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ISN 2022-ACL project Cyberpac 2077
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RICHARD Florian
ISN 2022-ACL project Cyberpac 2077
Commits
0476206b
Commit
0476206b
authored
2 years ago
by
Louis MALTERRE
Browse files
Options
Downloads
Patches
Plain Diff
c bon LM
parent
04116312
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MAVENProject/src/main/java/entity/Character.java
+10
-11
10 additions, 11 deletions
MAVENProject/src/main/java/entity/Character.java
MAVENProject/src/main/java/jeu/Jeu.java
+1
-1
1 addition, 1 deletion
MAVENProject/src/main/java/jeu/Jeu.java
with
11 additions
and
12 deletions
MAVENProject/src/main/java/entity/Character.java
+
10
−
11
View file @
0476206b
...
...
@@ -28,7 +28,7 @@ public class Character extends Entity{
private
double
masse
;
public
int
key
;
pr
ivate
Map
<
String
,
Double
>
tableCommande
;
//table des commandes du perso
pr
otected
Map
<
String
,
Double
>
tableCommande
;
//table des commandes du perso
//private Obstacle obstacleBeneath = Jeu.sol;
...
...
@@ -45,7 +45,7 @@ public class Character extends Entity{
nbMaxFramesInvicible
=
500
;
}
private
void
deplacements
(){
// alpha indique si il est au sol ou non, il vaut 0 (en l'air) ou 1 (au sol) en fonction
void
deplacements
(){
// alpha indique si il est au sol ou non, il vaut 0 (en l'air) ou 1 (au sol) en fonction
double
delta
=
Math
.
pow
(
10
,
-
3
);
// pas de temps remis en secondes
...
...
@@ -72,7 +72,7 @@ public class Character extends Entity{
if
(
Math
.
abs
(
vitesseActuZ
)
>
vitesseMax
*
500
)
vitesseActuZ
=
Math
.
signum
(
vitesseActuZ
)*
vitesseMax
*
500
;
}
private
void
collisionGestion
(){
void
collisionGestion
(){
List
<
Obstacle
>
listeObstaclesInVoisinage
=
getObstacleTable
();
//stocke l'obstacle avec lequel il y a eu collision
HashMap
<
Obstacle
,
PositionCollision
>
collisionsPresentes
=
new
HashMap
<
Obstacle
,
PositionCollision
>();
...
...
@@ -144,7 +144,7 @@ public class Character extends Entity{
}
}
private
void
keyGestion
()
{
void
keyGestion
()
{
for
(
Coffre
cof
:
Jeu
.
getCoffreTable
()){
if
(
HitBox
.
collision
(
this
.
getHitBox
(),
cof
.
getHitbox
())){
if
(
cof
.
key
)
{
...
...
@@ -156,7 +156,7 @@ public class Character extends Entity{
}
}
private
List
<
Obstacle
>
obstacleInVoisinage
(){
//recupere la liste des obstacles presents dans le voisinage
List
<
Obstacle
>
obstacleInVoisinage
(){
//recupere la liste des obstacles presents dans le voisinage
List
<
Obstacle
>
liste
=
new
ArrayList
<>();
for
(
Obstacle
obs
:
getObstacleTable
()){
if
(
HitBox
.
collision
(
voisinage
,
obs
.
getHitbox
())){
...
...
@@ -167,7 +167,7 @@ public class Character extends Entity{
}
private
void
attaque
(){
void
attaque
(){
Coordonnees
attackCenter
=
new
Coordonnees
(
coord
.
getX
()
+
direction
*
entityWIDTH
/
2
,
coord
.
getZ
());
Attack
characterAttack
=
new
Attack
(
attackStat
,
attackCenter
,
new
HitBox
(
attackCenter
,
entityHEIGHT
,
entityWIDTH
+
20
));
for
(
Monster
monster
:
Jeu
.
getMonsterList
()){
...
...
@@ -179,7 +179,7 @@ public class Character extends Entity{
}
private
void
getGameCommand
(){
void
getGameCommand
(){
Map
<
String
,
Boolean
>
commandeJeu
=
Jeu
.
getDirectionJeu
();
if
(
commandeJeu
.
get
(
"Right"
)
&&
commandeJeu
.
get
(
"Left"
)){
tableCommande
.
replace
(
"CommandX"
,
(
double
)
0
);}
...
...
@@ -197,7 +197,7 @@ public class Character extends Entity{
if
(
commandeJeu
.
get
(
"Attack"
))
tableCommande
.
replace
(
"CommandAttack"
,
(
double
)
1
);
}
private
void
resetCommand
(){
void
resetCommand
(){
for
(
String
key
:
tableCommande
.
keySet
()){
tableCommande
.
replace
(
key
,
(
double
)
0
);
}
...
...
@@ -207,7 +207,6 @@ public class Character extends Entity{
getGameCommand
();
deplacements
();
collisionGestion
();
//System.out.println(obstacleBeneath);
keyGestion
();
updateVoisinage
();
this
.
setHitBox
(
new
HitBox
(
this
.
getCoord
(),
entityHEIGHT
,
entityWIDTH
));
// mise à jour moins crade pour l'instant
...
...
@@ -218,7 +217,7 @@ public class Character extends Entity{
}
private
void
updateNbFrameInvincible
(){
void
updateNbFrameInvincible
(){
nbFramesInvincible
=
Math
.
max
(
0
,
nbFramesInvincible
-
1
);
}
...
...
@@ -238,7 +237,7 @@ public class Character extends Entity{
return
impulsionSaut
;
}
pr
ivate
void
updateVoisinage
(){
pr
otected
void
updateVoisinage
(){
voisinage
=
new
HitBox
(
coord
,
1000
,
1000
);
}
...
...
This diff is collapsed.
Click to expand it.
MAVENProject/src/main/java/jeu/Jeu.java
+
1
−
1
View file @
0476206b
...
...
@@ -247,7 +247,7 @@ public class Jeu implements Game{
}
public
static
Character
getGameCharacter
()
{
return
gameCharacter
.
clone
()
;
return
gameCharacter
;
}
public
static
List
<
Monster
>
getMonsterList
()
{
...
...
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