Skip to content

Commit

Permalink
not sending .acc test
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickGibson committed Apr 29, 2020
1 parent c9ff2ee commit 595e4ee
Show file tree
Hide file tree
Showing 16 changed files with 907 additions and 791 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vscode/
tempCodeRunnerFile.js
tempCodeRunnerFile.js
*.map
4 changes: 4 additions & 0 deletions body.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body{
color: #4A89F4
}
canvas{
width:100% !important;
height:100% !important;
}
24 changes: 13 additions & 11 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def random_food():

food = {random_food_id(): random_food() for _ in range(100)}

VIEW_DISTANCE_X = 950 * 4
VIEW_DISTANCE_Y = 530 * 4
VIEW_DISTANCE_X = 950 # * 4
VIEW_DISTANCE_Y = 530 # * 4

BASE_ADD_KILL_SCORE = 50
KILL_ADD_SCORE_PERCENTAGE = 0.2
Expand Down Expand Up @@ -67,9 +67,11 @@ def heart_beat():
personalInfo = {}
bestScore = -1;
if currCar['active'] == True:
view_x = VIEW_DISTANCE_X
view_y = VIEW_DISTANCE_Y
personalInfo = {"score" : currCar['score'], "scoreBoard": {}, "bestPlayerPos": []}
carScale = 1 - (currCar['score'] / 4000)
mapMult = 1 / carScale
view_x = VIEW_DISTANCE_X * mapMult
view_y = VIEW_DISTANCE_Y * mapMult
personalInfo = {"score" : currCar['score'], "scoreboard": {}, "bestPlayerPos": []}
else:
view_x = VIEW_DISTANCE_X*2
view_y = VIEW_DISTANCE_Y*2
Expand All @@ -84,7 +86,7 @@ def heart_beat():

# BEST CAR ... If playing show scoreboard info
if currCar['active'] == True:
personalInfo['scoreBoard'][display_car_id] = [c['name'], c['score'] ]
personalInfo['scoreboard'][display_car_id] = [c['name'], c['score'] ]
if bestScore < c['score']:
bestScore = c['score']
personalInfo['bestPlayerPos'] = [c['x'], c['y']]
Expand Down Expand Up @@ -118,11 +120,11 @@ def heart_beat():
@socketio.on('myCar', namespace="/")
def update_my_car(car):
if request.sid in cars:
cars[request.sid]['x'] = car['x']
cars[request.sid]['y'] = car['y']
cars[request.sid]['rot'] = car['rot']
cars[request.sid]['boost'] = car['boost']
cars[request.sid]['acc'] = car['acc']
cars[request.sid]['x'] = car['x'] if isinstance(car['x'], int) else 0
cars[request.sid]['y'] = car['y'] if isinstance(car['y'], int) else 0
cars[request.sid]['rot'] = car['rot'] if isinstance(car['rot'], float) or isinstance(car['rot'], int) else 0
cars[request.sid]['boost'] = car['boost'] if isinstance(car['boost'], bool) else False
cars[request.sid]['acc'] = car['acc'] if isinstance(car['acc'], int) else 0


@socketio.on("kill", namespace="/")
Expand Down
2 changes: 1 addition & 1 deletion static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body{
margin: 0;
padding:0;
overflow: hidden;
background-color: "1099bb";
background-color: #1099bb;
}
#overlay{
position:fixed;
Expand Down
File renamed without changes
File renamed without changes
Binary file added static/images/gui/white_pixel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified static/images/vehicles/basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 595e4ee

Please sign in to comment.