Skip to content

Commit 9c3eb57

Browse files
committed
basic flying (F)
1 parent 7cc9121 commit 9c3eb57

File tree

6 files changed

+16
-3
lines changed

6 files changed

+16
-3
lines changed

src/client/html/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ <h3>Game paused</h3>
9292
<li>
9393
<button class="btn btn-dark">/</button> <button class="btn btn-dark">T</button> chat
9494
</li>
95+
<li>
96+
<button class="btn btn-dark">F</button> Toggle fly
97+
</li>
9598
</div>
9699
</div>
97100
</div>

src/client/scripts/FirstPersonControls.coffee

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ class FirstPersonControls
6767
_this.setState "menu"
6868
if z.keyCode is 27 and _this.gameState is "chat"
6969
_this.setState "menu"
70+
71+
#Flying
72+
if z.keyCode is 70
73+
_this.game.flying=not _this.game.flying
74+
_this.game.socket.emit "fly",_this.game.flying
7075

7176
#Wysyłanie state'u do serwera
7277
if _this.kc[z.keyCode] isnt undefined and _this.gameState is "gameLock"

src/client/scripts/World/World.coffee

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,11 @@ class World
4343
}
4444
return
4545
updateRenderOrder: (cell)->
46-
#Here will be ordering meshes
4746
c=new vec3 cell...
4847
for i of @cellMesh
4948
n=i.split ":"
5049
x=new vec3 parseInt(n[0]),parseInt(n[1]),parseInt(n[2])
5150
@cellMesh[i].renderOrder=-c.distanceTo x
52-
@game.renderer.clearDepth()
5351
return
5452
setCell: (cellX,cellY,cellZ,buffer)->
5553
@_setCell cellX,cellY,cellZ,buffer

src/client/scripts/index.coffee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class Game
3232
@canvas=document.querySelector "#c"
3333
@pcanvas=document.querySelector "#c_player"
3434
@dimension=null
35+
@flying=false
3536
if PRODUCTION
3637
console.log "Running in production mode"
3738
else

src/client/styles/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ body { margin: 0; background:black;}
3636
-ms-transform: translate(-50%, -50%);
3737
transform: translate(-50%, -50%);
3838
width:800px;
39-
height:450px;
39+
height:500px;
4040
background:#303030;
4141
z-index:10;
4242
color:white;

src/index.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,12 @@ module.exports=(mode)->
109109
return
110110
,10
111111
socketEventMap=
112+
"fly":(toggle)->
113+
if toggle
114+
bot.creative.startFlying()
115+
else
116+
bot.creative.stopFlying()
117+
return
112118
"blockPlace":(pos,vec)->
113119
block=bot.blockAt(new vec3(pos...))
114120
vecx=[

0 commit comments

Comments
 (0)