Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
L
LordlarKamarasi
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
LordlarKamarasi
Commits
4eb5bbd9
Kaydet (Commit)
4eb5bbd9
authored
Nis 21, 2019
tarafından
Batuhan Taşkaya
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Inital
üst
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
173 additions
and
0 deletions
+173
-0
Pipfile
Pipfile
+12
-0
Pipfile.lock
Pipfile.lock
+51
-0
__init__.py
lordlarkamarasi/__init__.py
+0
-0
controller.py
lordlarkamarasi/controller.py
+74
-0
textures.py
lordlarkamarasi/textures.py
+36
-0
grass.png
lordlarkamarasi/textures/land/grass.png
+0
-0
sand.png
lordlarkamarasi/textures/land/sand.png
+0
-0
stone.png
lordlarkamarasi/textures/land/stone.png
+0
-0
water.png
lordlarkamarasi/textures/land/water.png
+0
-0
longstone.png
lordlarkamarasi/textures/uppers/longstone.png
+0
-0
stone.png
lordlarkamarasi/textures/uppers/stone.png
+0
-0
tree.png
lordlarkamarasi/textures/uppers/tree.png
+0
-0
No files found.
Pipfile
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pygame = "*"
[requires]
python_version = "3.7"
Pipfile.lock
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
{
"_meta": {
"hash": {
"sha256": "e172a3e30534a9a0b74742497b40f2ab196a0890d1cb082eb481fb89e384456e"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.7"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"pygame": {
"hashes": [
"sha256:0043bee7ebe5f1afc188db1c34fae57559ce6555939195b6a42fbdc1950c1b3c",
"sha256:0d5893bab526ce73d8bda22e0c43f24c2cfddeae489d0eca576199975ecb2246",
"sha256:28dda1b4038cbb710ee8ffa4df8234f8579b6b965a1f8a2434e8dea4914b139c",
"sha256:3baa3aa5d90eda8d54f56caff1a1c80258ebfa328241b5da92ba3fc993a86bdd",
"sha256:42c9bf49926826fac26827b87d278408998eb4638bdd5d64c14fdeb28ee3ebcc",
"sha256:4b3c01b2974de23873da78daad28d1a5d57c149b5009ae3631e220b9999b9b35",
"sha256:4b4f687d5772b0373fd976a0f013059cba3819f699837b82540d51315b9b6d46",
"sha256:6a50a4296a6969d80173ec7d414cd09718cdc3f7a69bd41514369b3a3a742c0f",
"sha256:7c8c8e2b837f95a4b284d9baae695b05f9f24e1ab9ebc1ea0a3088c1c6dcf30c",
"sha256:8f64c2668cc14d376ea095819136e6b825e3b7080370fe0abf2a77e8a99e6d56",
"sha256:9ba33f4fedb4c6d9cdd2d32b6dfc5e58edebb692371205af6054dc5f6ca5abdd",
"sha256:a119b1bd7cb37d804aa7293cb835e14e2649ecd58768fd2dcbfd2da294d7d60b",
"sha256:a43609c9637ab66c10bef66d76435211d44a0d03f6519121f79c7ab1734a4d03",
"sha256:b16231466cddc9c55b9d6e006f1c6b5be2ef2dbe5b6516531513d5f427f88dd1",
"sha256:b2161c86003d264f94249c064395d984cb3eb86974be8b3ebebcdd56ee633352",
"sha256:b62afb88435d2aa80a47b372f99ad74750c81d924abf3bf44a900991ce02bf0a",
"sha256:cd7fcdc4a8ec7110866580e84945d550c7652c105838a155fac3252a02580480",
"sha256:d01c43550ef837a68bb3141e72d89ebaf9bcdc005158f265c348b5dbce81d308",
"sha256:d15e7238015095a12c19379565a66285e989fdcb3807ec360b27338cd8bdaf05",
"sha256:d560fd5efd6b887a2f7eb30f61e383a7edbe8a1afe5d5fb7b857315372de359f",
"sha256:ef17614d4411a4eadea941245ae3112dbd134c97b0d29bfc86948961818057ec",
"sha256:f0eee24dcb8d58d95eb47d946d18354f9720e4dfb0c4b1c59fffcec3ddaf0ebe",
"sha256:f7bfaf75e35f6d1093cf05f161667fae0d158cd3cc13c9e8c97d0c4b2a12e397",
"sha256:fc8bda436482458412d01e595e7a88dd777416d422ff1e45b9a6d96287806255"
],
"index": "pypi",
"version": "==1.9.5"
}
},
"develop": {}
}
lordlarkamarasi/__init__.py
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
lordlarkamarasi/controller.py
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
import
itertools
import
random
import
time
from
collections
import
UserList
from
contextlib
import
suppress
from
typing
import
Tuple
import
pygame
from
pygame.locals
import
QUIT
from
lordlarkamarasi.textures
import
AVAILABLE_BLOCKS
,
TILE_SIZE
,
Blocks
class
Map
(
UserList
):
def
__init__
(
self
,
width
,
height
):
self
.
width
=
width
self
.
height
=
height
self
.
data
=
list
(
list
(
itertools
.
repeat
(
Blocks
.
GRASS
,
width
))
for
_
in
range
(
height
)
)
self
.
_shake_map
()
def
_shake_map
(
self
):
for
_
in
range
((
self
.
width
*
self
.
height
)
//
32
):
print
(
random
.
choice
(
AVAILABLE_BLOCKS
))
self
.
_generate_group
(
random
.
choice
(
AVAILABLE_BLOCKS
))
def
_generate_group
(
self
,
group
):
row_start
=
random
.
randint
(
0
,
self
.
height
)
width_start
=
random
.
randint
(
0
,
self
.
width
)
size
=
round
((
self
.
width
*
self
.
height
)
//
113
)
self
.
data
[
row_start
-
1
][
width_start
-
1
]
=
group
with
suppress
(
IndexError
):
for
row
in
range
(
row_start
,
row_start
+
size
):
for
column
in
range
(
width_start
,
width_start
+
size
):
if
random
.
randint
(
0
,
3
):
# %75
self
.
data
[
row
][
column
]
=
group
class
Game
:
def
__init__
(
self
,
window
:
Tuple
[
int
,
int
]
=
(
800
,
800
)):
pygame
.
init
()
pygame
.
display
.
set_caption
(
"Lordlar Kamarası"
)
self
.
surface
=
pygame
.
display
.
set_mode
(
window
)
self
.
map
=
Map
(
*
(
meter
//
25
for
meter
in
window
))
def
process_event
(
self
,
event
:
pygame
.
event
.
EventType
):
self
.
draw_map
()
def
event_handler
(
self
,
interval
:
int
=
0.005
):
event
=
pygame
.
event
.
wait
()
while
event
.
type
is
not
QUIT
:
self
.
process_event
(
event
)
pygame
.
display
.
update
()
time
.
sleep
(
interval
)
else
:
pygame
.
quit
()
def
start
(
self
):
self
.
event_handler
()
def
draw_map
(
self
):
for
rpos
,
row
in
enumerate
(
self
.
map
):
for
cpos
,
block
in
enumerate
(
row
):
self
.
surface
.
blit
(
block
.
value
.
texture
,
(
cpos
*
TILE_SIZE
,
rpos
*
TILE_SIZE
)
)
if
__name__
==
"__main__"
:
game
=
Game
()
game
.
start
()
lordlarkamarasi/textures.py
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
import
os
from
dataclasses
import
dataclass
from
enum
import
Enum
from
pathlib
import
Path
from
typing
import
Optional
import
pygame
BASE_PATH
=
Path
(
__file__
)
.
parent
def
relative_load
(
path
:
str
)
->
pygame
.
Surface
:
return
pygame
.
image
.
load
(
os
.
fspath
(
BASE_PATH
/
path
))
@dataclass
class
Block
:
id
:
int
texture
:
pygame
.
Surface
must_connect
:
Optional
[
id
]
=
None
class
Blocks
(
Enum
):
STONE
=
Block
(
0
,
relative_load
(
"textures/land/stone.png"
))
GRASS
=
Block
(
1
,
relative_load
(
"textures/land/grass.png"
))
WATER
=
Block
(
2
,
relative_load
(
"textures/land/water.png"
))
SAND
=
Block
(
3
,
relative_load
(
"textures/land/sand.png"
))
AVAILABLE_BLOCKS
=
list
(
filter
(
lambda
block
:
not
block
.
value
.
must_connect
,
Blocks
.
__members__
.
values
())
)
MUST_CONNECT_BLOCKS
=
list
(
filter
(
lambda
block
:
block
.
value
.
must_connect
,
Blocks
.
__members__
.
values
())
)
# use set substractions
TILE_SIZE
=
25
lordlarkamarasi/textures/land/grass.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
23.6 KB
lordlarkamarasi/textures/land/sand.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
87.6 KB
lordlarkamarasi/textures/land/stone.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
40.8 KB
lordlarkamarasi/textures/land/water.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
39.2 KB
lordlarkamarasi/textures/uppers/longstone.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
17.9 KB
lordlarkamarasi/textures/uppers/stone.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
15.5 KB
lordlarkamarasi/textures/uppers/tree.png
0 → 100644
Dosyayı görüntüle @
4eb5bbd9
80 KB
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