Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
K
kanuni
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
kanuni
Commits
1f5b1efb
Kaydet (Commit)
1f5b1efb
authored
May 25, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make game 16x faster
üst
069f27cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
kanuni.py
kanuni.py
+9
-5
No files found.
kanuni.py
Dosyayı görüntüle @
1f5b1efb
...
...
@@ -6,11 +6,13 @@ from enum import Enum
from
itertools
import
repeat
from
random
import
choice
,
randrange
from
typing
import
Sequence
from
functools
import
lru_cache
import
arcade
from
arcade
import
color
as
Color
from
arcade
import
key
as
Key
arcade
.
create_rectangle_filled
=
lru_cache
(
None
)(
arcade
.
create_rectangle_filled
)
CONFIG
=
{
"tiles"
:
{
"sep"
:
5
,
"row"
:
20
,
"col"
:
20
,
"width"
:
30
,
"height"
:
30
},
"window"
:
{
"title"
:
"Kanuni"
,
"padding"
:
150
},
...
...
@@ -108,12 +110,14 @@ class Player:
class
Grid
(
UserList
):
def
__init__
(
self
,
row
,
col
,
**
kwargs
):
self
.
data
=
[
list
(
repeat
(
0
,
col
))
.
copy
()
for
_
in
range
(
row
)]
self
.
_buffer
=
self
.
data
.
copy
()
def
set_block
(
self
,
col
,
row
,
value
):
self
.
data
[
row
][
col
]
=
value
def
get_block
(
self
,
col
,
row
):
return
self
.
data
[
row
][
col
]
class
Controller
(
arcade
.
Window
):
...
...
@@ -200,15 +204,16 @@ class Controller(arcade.Window):
for
cell
in
self
.
player
.
cells
:
self
.
grid
.
set_block
(
cell
.
x
,
cell
.
y
,
value
)
self
.
draw_foods
()
self
.
draw_grid
()
self
.
draw_info
()
self
.
draw_grid
()
def
on_draw
(
self
):
t0
=
time
.
time
()
arcade
.
start_render
()
self
.
draw_player
()
self
.
shape_list
.
draw
()
print
(
self
.
player
)
t1
=
time
.
time
(
)
print
(
t1
-
t0
)
def
on_key_release
(
self
,
key
,
*
args
):
self
.
draw_player
(
0
)
actions
=
{
...
...
@@ -236,7 +241,6 @@ class Controller(arcade.Window):
self
.
update_player
(
direction
,
amount
)
return
print
(
current
)
self
.
update_player
(
"tile"
,
current
,
x
,
y
)
cell
.
update_coords
(
direction
,
amount
)
...
...
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