Skip to content

Commit 09ea262

Browse files
added sprinting and jumping
1 parent 32a3692 commit 09ea262

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ D -> right<br>
2727

2828
T -> spawn tree<br>
2929
ESC -> Quit<br>
30+
F3 -> debug screen (like Minecraft but not so much text)
3031

3132
## Extreme Amplified Parkour
3233

main.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
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 = 0.5
17+
player.gravity = 0.8
1818
# player.model = "assets/player.obj"
1919
# player.texture = "textures/"
20-
player.scale = 1
21-
player.y = 50
2220

2321
# Window Settings
2422
window.title = "Minecraft Python Edition"
@@ -137,6 +135,27 @@ def whichblockami(block):
137135

138136
except:
139137
print(f"No texture on index")
138+
139+
# Sneaking
140+
def sneak():
141+
player.scale_y = 0.90
142+
player.speed = 1
143+
144+
# Sprinting
145+
def sprint():
146+
camera.fov = 100
147+
player.speed = 10
148+
player.jumping = True
149+
150+
# Zooming
151+
def zoom():
152+
camera.fov = 70
153+
154+
# Default Function
155+
def default():
156+
player.speed = 5
157+
camera.fov = 90
158+
player.scale_y = 1
140159

141160
#------------------------------------End of Function Space-------------------------------------------
142161

@@ -148,6 +167,18 @@ def update():
148167
hand.active()
149168
else:
150169
hand.passive()
170+
171+
if held_keys["shift"]:
172+
sneak()
173+
174+
elif held_keys["control"] and held_keys["w"] or held_keys["control"] and held_keys["w"] and held_keys["space"]:
175+
sprint()
176+
177+
elif held_keys["c"]:
178+
zoom()
179+
180+
else:
181+
default()
151182

152183
if held_keys['escape']:
153184
sys.exit()

0 commit comments

Comments
 (0)