unused code remove
This commit is contained in:
parent
b9f8f248c5
commit
d8d5f0520f
3 changed files with 1 additions and 25 deletions
0
client/dest/script.min.js
vendored
0
client/dest/script.min.js
vendored
|
@ -1,27 +1,16 @@
|
||||||
|
|
||||||
import asyncio, time
|
import asyncio
|
||||||
from network import startServer
|
from network import startServer
|
||||||
from player import Player
|
|
||||||
from block import Block
|
|
||||||
from world import *
|
from world import *
|
||||||
from config import *
|
from config import *
|
||||||
|
|
||||||
|
|
||||||
def current_milli_time():
|
|
||||||
return round(time.time() * 1000)
|
|
||||||
|
|
||||||
async def tickTimer():
|
async def tickTimer():
|
||||||
while True:
|
while True:
|
||||||
for b in WORLD:
|
for b in WORLD:
|
||||||
await b.tick()
|
await b.tick()
|
||||||
await asyncio.sleep(1/20)
|
await asyncio.sleep(1/20)
|
||||||
|
|
||||||
async def keepAliveTimer():
|
|
||||||
while True:
|
|
||||||
for b in getPlayers():
|
|
||||||
await b.keepAlive()
|
|
||||||
await asyncio.sleep(1)
|
|
||||||
|
|
||||||
async def renderTimer():
|
async def renderTimer():
|
||||||
while True:
|
while True:
|
||||||
for p in getPlayers():
|
for p in getPlayers():
|
||||||
|
@ -30,7 +19,6 @@ async def renderTimer():
|
||||||
|
|
||||||
async def main():
|
async def main():
|
||||||
asyncio.get_event_loop().create_task(tickTimer())
|
asyncio.get_event_loop().create_task(tickTimer())
|
||||||
asyncio.get_event_loop().create_task(keepAliveTimer())
|
|
||||||
asyncio.get_event_loop().create_task(renderTimer())
|
asyncio.get_event_loop().create_task(renderTimer())
|
||||||
await startServer(HOST, PORT)
|
await startServer(HOST, PORT)
|
||||||
|
|
||||||
|
|
|
@ -231,25 +231,13 @@ class Player(Block):
|
||||||
|
|
||||||
async def onCollide(self, player, x, y):
|
async def onCollide(self, player, x, y):
|
||||||
await super().onCollide(player, x, y)
|
await super().onCollide(player, x, y)
|
||||||
# if x != 0:
|
|
||||||
# player.vel_x *= 0.5
|
|
||||||
# self.vel_x = player.vel_x
|
|
||||||
# if y != 0:
|
|
||||||
# player.vel_y *= 0.5
|
|
||||||
# self.vel_y = player.vel_y
|
|
||||||
# pass
|
|
||||||
|
|
||||||
async def render(self):
|
async def render(self):
|
||||||
self.vel_x *= 0.5
|
self.vel_x *= 0.5
|
||||||
self.vel_y *= 0.5
|
self.vel_y *= 0.5
|
||||||
self.x += self.vel_x
|
self.x += self.vel_x
|
||||||
self.y += self.vel_y
|
self.y += self.vel_y
|
||||||
# await self.setVel(self.vel_x * 0.5, self.vel_y * 0.5)
|
|
||||||
# await self.setPos(self.x + self.vel_x, self.y + self.vel_y)
|
|
||||||
return self.vel_x != 0 or self.vel_y != 0
|
return self.vel_x != 0 or self.vel_y != 0
|
||||||
|
|
||||||
async def keepAlive(self):
|
|
||||||
await self.sendPacket("R", [str(self.x), str(self.y), str(self.vel_x), str(self.vel_y)])
|
|
||||||
|
|
||||||
def toStatement(self, add=True):
|
def toStatement(self, add=True):
|
||||||
return f"P1{self.name},{self.x},{self.y},{self.vel_x},{self.vel_y},{self.color}" if add else f"P0{self.name}"
|
return f"P1{self.name},{self.x},{self.y},{self.vel_x},{self.vel_y},{self.color}" if add else f"P0{self.name}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue