Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Project Fighting - Version multijoueur
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Project Fighting
Project Fighting - Version multijoueur
Commits
724233ea
Commit
724233ea
authored
Jan 01, 2019
by
Yannick A.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mise en forme du code source
parent
253e9783
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
src/common/block/Block.ts
src/common/block/Block.ts
+23
-23
No files found.
src/common/block/Block.ts
View file @
724233ea
import
Game
from
'
../Game
'
import
Point
from
'
../Point
'
import
Circle
from
'
../Circle
'
import
Entity
from
'
../Entity
'
import
Game
from
'
../Game
'
import
Point
from
'
../Point
'
export
default
abstract
class
Block
implements
Entity
{
private
game
:
Game
...
...
@@ -54,6 +54,26 @@ export default abstract class Block implements Entity {
return
this
.
position
}
public
getCenter
():
Point
{
const
middle
=
this
.
getMiddle
()
return
new
Point
(
this
.
position
.
getX
()
+
middle
.
getX
(),
this
.
position
.
getY
()
+
middle
.
getY
(),
)
}
public
getCircle
():
Circle
{
const
position
=
this
.
getCenter
()
const
radius
=
(
this
.
width
+
this
.
height
)
/
4
return
new
Circle
(
position
.
getX
(),
position
.
getY
(),
radius
)
}
public
getCollisionShape
()
{
return
this
.
getCircle
()
}
protected
getGame
():
Game
{
return
this
.
game
}
...
...
@@ -80,27 +100,7 @@ export default abstract class Block implements Entity {
private
getMiddle
():
Point
{
return
new
Point
(
this
.
width
/
2
,
this
.
height
/
2
this
.
height
/
2
,
)
}
public
getCenter
():
Point
{
const
middle
=
this
.
getMiddle
()
return
new
Point
(
this
.
position
.
getX
()
+
middle
.
getX
(),
this
.
position
.
getY
()
+
middle
.
getY
()
)
}
public
getCircle
():
Circle
{
const
position
=
this
.
getCenter
()
const
radius
=
(
this
.
width
+
this
.
height
)
/
4
return
new
Circle
(
position
.
getX
(),
position
.
getY
(),
radius
)
}
public
getCollisionShape
()
{
return
this
.
getCircle
()
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment