Skip to content

Commit 10f89b1

Browse files
added minor changes
1 parent 3cc5414 commit 10f89b1

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

configuration.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
"treesCount": 5,
88
"parkour_mode": false,
99
"land_size": 15,
10-
"world_type": "default"
10+
"world_type": "default",
11+
"default_block": "stone"
1112
}

main.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
player = FirstPersonController()
1515
player.height = 2
1616
player.cursor = Entity(parent=camera.ui, model='quad',color=color.light_gray, scale=.008, rotation_z=45)
17-
player.gravity = 1
17+
player.gravity = 0.5
1818
player.jump_height = 1
19-
player.fall_after = .30
19+
player.fall_after = .35
20+
camera.y -= 0.35
2021
# player.model = "assets/player.obj"
2122
# player.texture = "textures/"
2223

@@ -77,6 +78,7 @@
7778
parkour = data["parkour_mode"]
7879
landsize = data["land_size"]
7980
world_type = data["world_type"]
81+
defaultblock = data["default_block"]
8082

8183
if fps_counter_enabled == False:
8284
window.fps_counter = False
@@ -133,7 +135,6 @@ def whichblockami(block):
133135
for eachBlock in blocks:
134136
try:
135137
if f"assets/{block.texture.name}" in eachBlock[1]:
136-
print(eachBlock[0])
137138
return eachBlock[0]
138139

139140
except:
@@ -142,7 +143,7 @@ def whichblockami(block):
142143

143144
# Sneaking
144145
def sneak():
145-
player.scale_y = 0.90
146+
camera.y = -0.6
146147
player.speed = 1
147148

148149
# Sprinting
@@ -159,7 +160,7 @@ def zoom():
159160
def default():
160161
player.speed = 5
161162
camera.fov = 90
162-
player.scale_y = 1
163+
camera.y = -0.35
163164

164165
#------------------------------------End of Function Space-------------------------------------------
165166

@@ -187,6 +188,7 @@ def update():
187188
if held_keys['escape']:
188189
sys.exit()
189190

191+
190192
if held_keys['f3']:
191193
if pressed == False:
192194
debugscreen.visible = True
@@ -232,7 +234,7 @@ def update():
232234

233235
# Defining Voxel
234236
class Voxel(Button):
235-
def __init__(self, position=(0, 0, 0), texture="assets/grass_block_tex.png", **kwargs):
237+
def __init__(self, position=(0, 0, 0), texture=f"assets/{defaultblock}_block_tex.png", **kwargs):
236238
super().__init__(
237239
parent=scene,
238240
position=position,
@@ -241,7 +243,8 @@ def __init__(self, position=(0, 0, 0), texture="assets/grass_block_tex.png", **k
241243
texture=texture,
242244
color=color.color(0, 0, random.uniform(0.9, 1)),
243245
scale=1,
244-
shader=lit_with_shadows_shader
246+
shader=lit_with_shadows_shader,
247+
collider = "box"
245248
)
246249

247250
self.block = whichblockami(self)
@@ -251,7 +254,7 @@ def input(self, key):
251254
if key == 'right mouse down':
252255
if sounds == True:
253256
findsoundbasedontexture(blockid=block_id,mode="default",block=self.block).play()
254-
voxel = Voxel(position=self.position + mouse.normal,
257+
voxel = Voxel(position=self.position+mouse.normal,
255258
texture=blocks[block_id][2])
256259
terrainblocks.append(voxel)
257260
if key == 'left mouse down':

0 commit comments

Comments
 (0)