15
15
player .height = 2
16
16
player .cursor = Entity (parent = camera .ui , model = 'quad' ,color = color .light_gray , scale = .008 , rotation_z = 45 )
17
17
player .gravity = 1
18
- player .jump_up_duration = .3
18
+ player .jump_height = 1
19
+ player .fall_after = .30
19
20
# player.model = "assets/player.obj"
20
21
# player.texture = "textures/"
21
22
75
76
fps_counter_enabled = data ["fps_counter_enabled" ]
76
77
parkour = data ["parkour_mode" ]
77
78
landsize = data ["land_size" ]
79
+ world_type = data ["world_type" ]
78
80
79
81
if fps_counter_enabled == False :
80
82
window .fps_counter = False
@@ -137,6 +139,7 @@ def whichblockami(block):
137
139
except :
138
140
print (f"No texture on index" )
139
141
142
+
140
143
# Sneaking
141
144
def sneak ():
142
145
player .scale_y = 0.90
@@ -162,13 +165,13 @@ def default():
162
165
163
166
# Task Update
164
167
def update ():
165
- global inventorytrue , pressed
168
+ global inventorytrue , pressed , items
166
169
if held_keys ['left mouse down' ] or held_keys ['right mouse down' ]:
167
170
# punch_sound.play()
168
171
hand .active ()
169
172
else :
170
173
hand .passive ()
171
-
174
+
172
175
if held_keys ["shift" ]:
173
176
sneak ()
174
177
@@ -205,13 +208,27 @@ def update():
205
208
memoryUse = python_process .memory_info ()[0 ]/ 2. ** 30
206
209
207
210
cpu_panel .text = f'CPU: { cpu } % / RAM: { ram } % / Memory use: { round (memoryUse ,2 )} GB'
208
-
211
+
209
212
if player .y < - 100 :
210
213
Audio ("assets/sounds/sh/die.ogg" )
211
214
player .y = 15
212
215
player .x = 0
213
216
player .z = 0
214
217
Audio ("assets/sounds/sh/spawn.ogg" )
218
+
219
+ # if player.y < -100:
220
+ # Audio("assets/sounds/sh/die.ogg")
221
+ # application.pause()
222
+ # o.visible = True
223
+ # dietext.visible = True
224
+ # items = False
225
+ # hotbar.destroyItems()
226
+ # hotbar.visible = False
227
+ # hand.visible = False
228
+ # selected.visible = False
229
+ # respawn_button = RespawnButton()
230
+ # respawn_button.text_entity.font = button_font
231
+ # mouse.locked = False
215
232
216
233
# Defining Voxel
217
234
class Voxel (Button ):
@@ -251,6 +268,36 @@ def input(key):
251
268
block_id = len (blocks ) - 1
252
269
hand .texture = blocks [block_id ][2 ]
253
270
271
+ # Death Screen
272
+ o = Panel (scale = 4 , color = color .rgba (255 , 0 , 0 , 200 ))
273
+ o .visible = False
274
+ items = True
275
+ dietext = Text (font = button_font , text = "You Died!" ,
276
+ position = Vec2 (- 0.1 , 0.2 ), color = color .white , scale = 2 )
277
+ dietext .visible = False
278
+ class RespawnButton (Button ):
279
+ def __init__ (self ):
280
+ super ().__init__ (
281
+ text = "Respawn" ,
282
+ parent = camera .ui ,
283
+ model = "quad" ,
284
+ texture = "textures/widgets/button.png" ,
285
+ color = color .color (0 , 0 , random .uniform (0.9 , 1 )),
286
+ scale = (0.5 , 0.1 )
287
+ )
288
+
289
+ def input (self , key ):
290
+ if self .hovered :
291
+ self .texture = "textures/widgets/button_selected.png"
292
+ if key == "left mouse down" :
293
+ dietext .visible = False
294
+ application .resume ()
295
+ player .y = 15
296
+ player .x = 0
297
+ player .z = 0
298
+ Audio ("assets/sounds/sh/spawn.ogg" )
299
+ destroy (self )
300
+
254
301
# Defining Hand
255
302
class Hand (Entity ):
256
303
def __init__ (self ):
@@ -330,16 +377,27 @@ def __init__(self):
330
377
)
331
378
332
379
def appendItems (self ):
333
- grass = Item (blocks [1 ][2 ],(- 0.35 ,- 0.42 ))
334
- dirt = Item (blocks [2 ][2 ],(- 0.26 ,- 0.42 ))
335
- stone = Item (blocks [3 ][2 ],(- 0.17 , - 0.42 ))
336
- cobblestone = Item (blocks [4 ][2 ],(- 0.08 ,- 0.42 ))
337
- sand = Item (blocks [5 ][2 ],(0 ,- 0.42 ))
338
- oak = Item (blocks [6 ][2 ],(0.08 ,- 0.42 ))
339
- planks = Item (blocks [7 ][2 ],(0.17 ,- 0.42 ))
340
- obsidian = Item (blocks [8 ][2 ], (0.26 , - 0.42 ))
341
- ice = Item (blocks [9 ][2 ], (0.35 , - 0.42 ))
380
+ self . grass = Item (blocks [1 ][2 ],(- 0.35 ,- 0.42 ))
381
+ self . dirt = Item (blocks [2 ][2 ],(- 0.26 ,- 0.42 ))
382
+ self . stone = Item (blocks [3 ][2 ],(- 0.17 , - 0.42 ))
383
+ self . cobblestone = Item (blocks [4 ][2 ],(- 0.08 ,- 0.42 ))
384
+ self . sand = Item (blocks [5 ][2 ],(0 ,- 0.42 ))
385
+ self . oak = Item (blocks [6 ][2 ],(0.08 ,- 0.42 ))
386
+ self . planks = Item (blocks [7 ][2 ],(0.17 ,- 0.42 ))
387
+ self . obsidian = Item (blocks [8 ][2 ], (0.26 , - 0.42 ))
388
+ self . ice = Item (blocks [9 ][2 ], (0.35 , - 0.42 ))
342
389
390
+ def destroyItems (self ):
391
+ if items == False :
392
+ self .grass .visible = False
393
+ self .dirt .visible = False
394
+ self .stone .visible = False
395
+ self .cobblestone .visible = False
396
+ self .sand .visible = False
397
+ self .oak .visible = False
398
+ self .planks .visible = False
399
+ self .obsidian .visible = False
400
+ self .ice .visible = False
343
401
#-------------------------------------End of Inventory Zone-------------------------------------------
344
402
345
403
# Terrain Generation
@@ -348,7 +406,12 @@ def appendItems(self):
348
406
if parkour == True :
349
407
amp = 100
350
408
else :
351
- amp = 6
409
+ amp = 5
410
+
411
+ if world_type == "super_flat" :
412
+ amp = 0
413
+ else :
414
+ amp = 5
352
415
for i in range (terrainWidth * terrainWidth ):
353
416
voxel = Voxel (texture = blocks [1 ][2 ])
354
417
voxel .x = floor (i / terrainWidth )
0 commit comments