Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Yağız Arda Gün
Algoritma oyun
Commits
d4efc9c0
Commit
d4efc9c0
authored
Dec 31, 2021
by
Yağız Arda Gün
Browse files
Initial commit
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
algo oyun.c
0 → 100644
View file @
d4efc9c0
#include <stdio.h>
#include <windows.h>
void
display_border
();
COORD
c
=
{
0
,
0
};
void
setxy
(
int
x
,
int
y
)
{
c
.
X
=
x
;
c
.
Y
=
y
;
// x ve y koordinatlarn belirliyoruz
SetConsoleCursorPosition
(
GetStdHandle
(
STD_OUTPUT_HANDLE
),
c
);
}
int
main
()
{
int
batx
=
15
,
baty
=
13
,
ballx
=
25
,
bally
=
7
;
int
x
=
25
,
y
=
10
,
ch1
,
ch2
,
b
;
setxy
(
14
,
1
);
printf
(
"...Topu Bul..."
)
;
display_border
();
setxy
(
batx
,
baty
);
printf
(
"==="
);
setxy
(
ballx
,
bally
);
printf
(
"%c"
,
2
);
ch1
=
getch
();
ch2
=
0
;
if
(
ch1
==
0xE0
)
{
while
(
ch2
=
getch
())
{
if
(
ch2
==
'X'
)
exit
(
0
);
if
(
ch2
==
75
)
//sol
{
if
(
batx
>
11
)
//topu sol duvarla snrlyoruz
{
setxy
(
--
batx
,
baty
);
printf
(
"==="
);
setxy
(
batx
+
3
,
baty
);
//yolu temizlemek iinn alana ayoruz
printf
(
" "
);
}
}
if
(
ch2
==
77
)
//sa
{
if
(
batx
<
37
)
//topu sa duvarla snrlyoruz
{
setxy
(
++
batx
,
baty
);
printf
(
"==="
);
setxy
(
batx
-
1
,
baty
);
//topun rotas iin boluk atyoruz
printf
(
" "
);
}
}
if
(
ch2
==
72
)
//yukar
{
if
(
baty
>
6
)
{
setxy
(
batx
,
--
baty
);
printf
(
"==="
);
setxy
(
batx
,
baty
+
1
);
printf
(
" "
);
}
}
if
(
ch2
==
80
)
//aa
{
if
(
baty
<
14
)
{
setxy
(
batx
,
++
baty
);
printf
(
"==="
);
setxy
(
batx
,
baty
-
1
);
printf
(
" "
);
}
}
if
(
batx
==
ballx
-
1
&&
baty
==
bally
)
{
setxy
(
ballx
-
9
,
bally
+
4
);
printf
(
"...tebriklerr..."
);
setxy
(
ballx
-
9
,
bally
+
5
);
printf
(
" ...Top bulundu.."
);
setxy
(
ballx
-
9
,
bally
+
6
);
printf
(
" ...Oyun bitti kaybettiniz.."
);
getch
();
exit
(
0
);
}
}
}
getch
();
return
0
;
}
void
display_border
()
{
int
i
,
j
;
//st snr izgisi
setxy
(
10
,
5
);
for
(
j
=
0
;
j
<
30
;
j
++
)
printf
(
"%c"
,
223
);
//alt snr cizgisi
setxy
(
10
,
15
);
for
(
j
=
0
;
j
<=
30
;
j
++
)
printf
(
"%c"
,
223
);
//sol ve sa snr cizgileri
for
(
j
=
0
;
j
<
10
;
j
++
)
{
setxy
(
10
,
5
+
j
);
printf
(
"%c"
,
219
);
setxy
(
40
,
5
+
j
);
printf
(
"%c"
,
219
);
}
printf
(
"
\n
"
);
}
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