Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MLOD Mini Projet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yoann Bordin
MLOD Mini Projet
Commits
b84b5014
Commit
b84b5014
authored
Nov 02, 2020
by
Yoann Bordin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added down acceleration while pressing down key
parent
f38bf89a
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
2 deletions
+18
-2
README.md
README.md
+2
-2
tetris-main.c
tetris-main.c
+4
-0
tetris-main.exe
tetris-main.exe
+0
-0
tetris-struct.c
tetris-struct.c
+11
-0
tetris-struct.h
tetris-struct.h
+1
-0
No files found.
README.md
View file @
b84b5014
...
...
@@ -2,6 +2,6 @@
This project is based on the Tetris game invented by Alekseï Pajitnov in 1984.
The goal is to complete a maximum of lines in a grid with pieces (tetrominoes) that fall from the top.
# Building
This project work by compiling using Notepad++ for Raylib and adding the following files to the gcc command :
# Building
on Windows
This project work
s
by compiling using Notepad++ for Raylib and adding the following files to the gcc command :
```tetris-struct.c tetris-graph.c```
\ No newline at end of file
tetris-main.c
View file @
b84b5014
...
...
@@ -46,6 +46,10 @@ int main(void){
if
(
IsKeyPressed
(
KEY_RIGHT
)
&&
canMoveHztl
(
grid
,
p
,
1
)){
movePieceHztl
(
p
,
1
);
}
if
(
IsKeyDown
(
KEY_DOWN
)
&&
canMoveDown
(
grid
,
p
,
1
)){
movePieceVert
(
p
,
1
);
}
if
(
IsKeyPressed
(
KEY_Q
)){
// A en AZERTY
while
(
rotateBorderLeft
(
p
,
false
)){
movePieceHztl
(
p
,
1
);
...
...
tetris-main.exe
0 → 100644
View file @
b84b5014
File added
tetris-struct.c
View file @
b84b5014
...
...
@@ -288,6 +288,17 @@ bool canMoveHztl(Grid g, Piece p, int moveNum){
}
return
true
;
}
bool
canMoveDown
(
Grid
g
,
Piece
p
,
int
moveNum
){
for
(
int
i
=
0
;
i
<
p
.
size
;
i
++
){
int
x
=
p
.
squares
[
i
]
->
posX
;
int
y
=
p
.
squares
[
i
]
->
posY
+
moveNum
;
if
(
y
<
0
||
y
>=
g
.
height
||
g
.
grid
[
x
][
y
]
!=
NULL
){
return
false
;
}
}
return
true
;
}
void
moveSquareHztl
(
Square
sq
,
int
shift
){
sq
->
posX
+=
shift
;
...
...
tetris-struct.h
View file @
b84b5014
...
...
@@ -59,6 +59,7 @@ void displaySquare(Square sq, int pIndex, int pListIndex);
void
displayPiece
(
Piece
p
,
int
pListIndex
);
void
displayPieceList
(
Piece
*
pList
,
int
size
);
bool
canMoveDown
(
Grid
g
,
Piece
p
,
int
moveNum
);
void
moveSquareVert
(
Square
sq
,
int
shift
);
void
movePieceVert
(
Piece
piece
,
int
shift
);
...
...
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