Add strafe.
This commit is contained in:
parent
f7ee5715c7
commit
f231973984
8
main.py
8
main.py
@ -64,7 +64,7 @@ def draw(level,gPlayer,fov,res):
|
|||||||
continue
|
continue
|
||||||
if cDot(rot,MobiusAdd(cInt,-gPlayer.cPos)) > 0:
|
if cDot(rot,MobiusAdd(cInt,-gPlayer.cPos)) > 0:
|
||||||
continue
|
continue
|
||||||
rDist = MobiusDist(cInt,gPlayer.cPos)
|
rDist = MobiusDist(cInt,gPlayer.cPos)*1.1
|
||||||
if not (j.isFinite and cBetween(j.pointA,j.pointB,cInt)):
|
if not (j.isFinite and cBetween(j.pointA,j.pointB,cInt)):
|
||||||
continue
|
continue
|
||||||
if (1 - m.height) > rDist:
|
if (1 - m.height) > rDist:
|
||||||
@ -102,7 +102,7 @@ def mainLoop():
|
|||||||
if event.type == pygame.QUIT:
|
if event.type == pygame.QUIT:
|
||||||
return True
|
return True
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
if event.key == pygame.K_q:
|
if event.key == pygame.K_r:
|
||||||
gPlayer.cRot *= -1
|
gPlayer.cRot *= -1
|
||||||
if event.key == pygame.K_F3:
|
if event.key == pygame.K_F3:
|
||||||
debugInfo = not debugInfo
|
debugInfo = not debugInfo
|
||||||
@ -111,6 +111,10 @@ def mainLoop():
|
|||||||
gPlayer.rotate(ROT)
|
gPlayer.rotate(ROT)
|
||||||
if keys[pygame.K_a]:
|
if keys[pygame.K_a]:
|
||||||
gPlayer.rotate(IROT)
|
gPlayer.rotate(IROT)
|
||||||
|
if keys[pygame.K_q]:
|
||||||
|
gPlayer += GyroVector(OFFSET * gPlayer.cRot*I, 1)
|
||||||
|
if keys[pygame.K_e]:
|
||||||
|
gPlayer -= GyroVector(OFFSET * gPlayer.cRot*I, 1)
|
||||||
if keys[pygame.K_w]:
|
if keys[pygame.K_w]:
|
||||||
gPlayer -= GyroVector(OFFSET * gPlayer.cRot, 1)
|
gPlayer -= GyroVector(OFFSET * gPlayer.cRot, 1)
|
||||||
if keys[pygame.K_s]:
|
if keys[pygame.K_s]:
|
||||||
|
Loading…
Reference in New Issue
Block a user