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
52a02f5a
Commit
52a02f5a
authored
2 years ago
by
Azurlors
Browse files
Options
Downloads
Patches
Plain Diff
Suppression carrés voisinage
parent
828ee5cc
Branches
Branches containing commit
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/jeu/Painter.java
+11
-4
11 additions, 4 deletions
MAVENProject/src/main/java/jeu/Painter.java
MAVENProject/src/main/java/loaders/ObstacleLoader.java
+6
-0
6 additions, 0 deletions
MAVENProject/src/main/java/loaders/ObstacleLoader.java
with
17 additions
and
4 deletions
MAVENProject/src/main/java/jeu/Painter.java
+
11
−
4
View file @
52a02f5a
...
@@ -57,7 +57,7 @@ public class Painter implements GamePainter{
...
@@ -57,7 +57,7 @@ public class Painter implements GamePainter{
private
void
drawCharacter
(
Graphics2D
crayon
,
Image
imageCharac
){
private
void
drawCharacter
(
Graphics2D
crayon
,
Image
imageCharac
){
if
(
gameCharacter
.
getNbFramesInvincible
()
>
0
)
crayon
.
setColor
(
Color
.
black
);
if
(
gameCharacter
.
getNbFramesInvincible
()
>
0
)
crayon
.
setColor
(
Color
.
black
);
crayon
.
fillRect
(
WIDTH
/
2
-(
int
)
gameCharacter
.
getEntityWIDTH
()/
2
,
HEIGHT
/
2
-(
int
)
gameCharacter
.
getEntityHEIGHT
()/
2
+
decalage
,
(
int
)
gameCharacter
.
getEntityWIDTH
(),(
int
)
gameCharacter
.
getEntityHEIGHT
());
crayon
.
fillRect
(
WIDTH
/
2
-(
int
)
gameCharacter
.
getEntityWIDTH
()/
2
,
HEIGHT
/
2
-(
int
)
gameCharacter
.
getEntityHEIGHT
()/
2
+
decalage
,
(
int
)
gameCharacter
.
getEntityWIDTH
(),(
int
)
gameCharacter
.
getEntityHEIGHT
());
crayon
.
drawRect
(
WIDTH
/
2
-
500
,
WIDTH
/
2
-
500
,
1000
,
1000
);
//
crayon.drawRect(WIDTH/2-500,WIDTH/2-500, 1000,1000);
if
(
gameCharacter
.
getDirection
()
==
1
){
if
(
gameCharacter
.
getDirection
()
==
1
){
crayon
.
drawImage
(
imageCharac
,
WIDTH
/
2
-
(
int
)
gameCharacter
.
getEntityWIDTH
()/
2
-
10
,
HEIGHT
/
2
-
(
int
)
gameCharacter
.
getEntityHEIGHT
()/
2
-
3
+
decalage
,
null
,
null
);
crayon
.
drawImage
(
imageCharac
,
WIDTH
/
2
-
(
int
)
gameCharacter
.
getEntityWIDTH
()/
2
-
10
,
HEIGHT
/
2
-
(
int
)
gameCharacter
.
getEntityHEIGHT
()/
2
-
3
+
decalage
,
null
,
null
);
}
}
...
@@ -96,13 +96,20 @@ public class Painter implements GamePainter{
...
@@ -96,13 +96,20 @@ public class Painter implements GamePainter{
Coordonnees
bd
=
extremites
.
get
(
"BasDroite"
);
Coordonnees
bd
=
extremites
.
get
(
"BasDroite"
);
Coordonnees
hg
=
extremites
.
get
(
"HautGauche"
);
Coordonnees
hg
=
extremites
.
get
(
"HautGauche"
);
Coordonnees
bg
=
extremites
.
get
(
"BasGauche"
);
Coordonnees
bg
=
extremites
.
get
(
"BasGauche"
);
if
(
HitBox
.
collision
(
gameCharacter
.
getVoisinage
(),
obstacle
.
getHitbox
()))
crayon
.
setColor
(
Color
.
green
);
//
if (HitBox.collision(gameCharacter.getVoisinage(), obstacle.getHitbox()))crayon.setColor(Color.green);
crayon
.
drawLine
((
int
)
hd
.
getX
()
-
xCam
,(
int
)
hd
.
getZ
()
-
zCam
,(
int
)
bd
.
getX
()
-
xCam
,(
int
)
bd
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
hd
.
getX
()
-
xCam
,(
int
)
hd
.
getZ
()
-
zCam
,(
int
)
bd
.
getX
()
-
xCam
,(
int
)
bd
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
bd
.
getX
()
-
xCam
,(
int
)
bd
.
getZ
()
-
zCam
,(
int
)
bg
.
getX
()
-
xCam
,(
int
)
bg
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
bd
.
getX
()
-
xCam
,(
int
)
bd
.
getZ
()
-
zCam
,(
int
)
bg
.
getX
()
-
xCam
,(
int
)
bg
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
bg
.
getX
()
-
xCam
,(
int
)
bg
.
getZ
()
-
zCam
,(
int
)
hg
.
getX
()
-
xCam
,(
int
)
hg
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
bg
.
getX
()
-
xCam
,(
int
)
bg
.
getZ
()
-
zCam
,(
int
)
hg
.
getX
()
-
xCam
,(
int
)
hg
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
hg
.
getX
()
-
xCam
,(
int
)
hg
.
getZ
()
-
zCam
,(
int
)
hd
.
getX
()
-
xCam
,(
int
)
hd
.
getZ
()
-
zCam
);
crayon
.
drawLine
((
int
)
hg
.
getX
()
-
xCam
,(
int
)
hg
.
getZ
()
-
zCam
,(
int
)
hd
.
getX
()
-
xCam
,(
int
)
hd
.
getZ
()
-
zCam
);
}
}
private
void
drawObstacleBis
(
Graphics2D
crayon
,
Obstacle
obstacle
,
String
nom
){
ObstacleLoader
loader
=
new
ObstacleLoader
(
obstacle
,
nom
);
HitBox
hitBox
=
loader
.
getObstacle
().
getHitbox
();
int
z
=
(
int
)
hitBox
.
getCentre
().
getZ
();
int
x
=
(
int
)
hitBox
.
getCentre
().
getX
();
crayon
.
drawImage
(
loader
.
getImageObstacle
(),
x
-
(
int
)
hitBox
.
getWidth
()/
2
-
xCam
,
z
-
(
int
)
hitBox
.
getHeight
()/
2
-
zCam
,
null
,
null
);
}
private
void
drawCoffre
(
Graphics2D
crayon
,
Coffre
coffre
){
private
void
drawCoffre
(
Graphics2D
crayon
,
Coffre
coffre
){
HashMap
<
String
,
Coordonnees
>
extremites
=
coffre
.
getHitbox
().
getExtremites
();
HashMap
<
String
,
Coordonnees
>
extremites
=
coffre
.
getHitbox
().
getExtremites
();
Coordonnees
hd
=
extremites
.
get
(
"HautDroite"
);
Coordonnees
hd
=
extremites
.
get
(
"HautDroite"
);
...
@@ -165,7 +172,7 @@ public class Painter implements GamePainter{
...
@@ -165,7 +172,7 @@ public class Painter implements GamePainter{
x
=
(
int
)
monster
.
getCoord
().
getX
();
x
=
(
int
)
monster
.
getCoord
().
getX
();
z
=
(
int
)
monster
.
getCoord
().
getZ
();
z
=
(
int
)
monster
.
getCoord
().
getZ
();
crayon
.
drawRect
(
x
-
300
-
xCam
,
z
-
300
-
zCam
,
600
,
600
);
//
crayon.drawRect(x-300 - xCam, z-300 - zCam, 600, 600);
if
(
HitBox
.
collision
(
gameCharacter
.
getHitBox
(),
monster
.
getHitBox
()))
crayon
.
setColor
(
Color
.
red
);
if
(
HitBox
.
collision
(
gameCharacter
.
getHitBox
(),
monster
.
getHitBox
()))
crayon
.
setColor
(
Color
.
red
);
if
(
monster
.
getNbFramesInvincible
()
>
0
)
crayon
.
setColor
(
Color
.
black
);
if
(
monster
.
getNbFramesInvincible
()
>
0
)
crayon
.
setColor
(
Color
.
black
);
crayon
.
fillRect
(
x
-(
int
)
monster
.
getEntityWIDTH
()/
2
-
xCam
,
z
-(
int
)
monster
.
getEntityHEIGHT
()/
2
-
zCam
,
(
int
)
monster
.
getEntityWIDTH
(),
(
int
)
monster
.
getEntityHEIGHT
());
crayon
.
fillRect
(
x
-(
int
)
monster
.
getEntityWIDTH
()/
2
-
xCam
,
z
-(
int
)
monster
.
getEntityHEIGHT
()/
2
-
zCam
,
(
int
)
monster
.
getEntityWIDTH
(),
(
int
)
monster
.
getEntityHEIGHT
());
...
...
This diff is collapsed.
Click to expand it.
MAVENProject/src/main/java/loaders/ObstacleLoader.java
+
6
−
0
View file @
52a02f5a
...
@@ -3,6 +3,7 @@ import map.Obstacle;
...
@@ -3,6 +3,7 @@ import map.Obstacle;
import
javax.swing.*
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.net.URL
;
import
java.net.URL
;
public
class
ObstacleLoader
{
public
class
ObstacleLoader
{
...
@@ -26,4 +27,9 @@ public class ObstacleLoader {
...
@@ -26,4 +27,9 @@ public class ObstacleLoader {
obstacle
=
obs
;
obstacle
=
obs
;
imageObstacle
=
new
ImageIcon
(
path
).
getImage
();
imageObstacle
=
new
ImageIcon
(
path
).
getImage
();
}
}
public
ObstacleLoader
(
Obstacle
obs
,
BufferedImage
image
){
obstacle
=
obs
;
imageObstacle
=
image
;
}
}
}
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