Skip to content

Commit

Permalink
mechanic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisKolganov committed Sep 5, 2018
1 parent 3f91bdd commit a7987c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion madcars/Runners/mechanic/game_objects/base_car.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Car(object):
rear_wheel_friction = 1
rear_wheel_elasticity = 0.8
rear_wheel_joint = (0, 0)
rear_wheel_groove_offset = 5
rear_wheel_damp_position = (0, 0)
rear_wheel_damp_length = 20
rear_wheel_damp_stiffness = 6e4
Expand All @@ -46,6 +47,7 @@ class Car(object):
front_wheel_friction = 1
front_wheel_elasticity = 0.8
front_wheel_joint = (0, 0)
front_wheel_groove_offset = 5
front_wheel_damp_position = (0, 0)
front_wheel_damp_length = 20
front_wheel_damp_stiffness = 6e4
Expand Down Expand Up @@ -84,6 +86,7 @@ def create_wheel(self, wheel_side):
wheel_position = getattr(self, wheel_side + '_wheel_position')
wheel_friction = getattr(self, wheel_side + '_wheel_friction')
wheel_elasticity = getattr(self, wheel_side + '_wheel_elasticity')
wheel_grove_offset = getattr(self, wheel_side + '_wheel_groove_offset')
wheel_damp_position = getattr(self, wheel_side + '_wheel_damp_position')
wheel_damp_length = getattr(self, wheel_side + '_wheel_damp_length')
wheel_damp_stiffness = getattr(self, wheel_side + '_wheel_damp_stiffness')
Expand All @@ -100,7 +103,7 @@ def create_wheel(self, wheel_side):
wheel_objects.append(wheel_shape)

wheel_grove = pymunk.GrooveJoint(self.car_body, wheel_body,
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1]),
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1] - wheel_grove_offset),
(wheel_damp_position[0] * self.x_modification,
wheel_damp_position[1] - wheel_damp_length * 1.5),
(0, 0))
Expand Down
3 changes: 2 additions & 1 deletion madcars/Runners/mechanic/game_objects/cars.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def create_wheel(self, wheel_side):
wheel_position = getattr(self, wheel_side + '_wheel_position')
wheel_friction = getattr(self, wheel_side + '_wheel_friction')
wheel_elasticity = getattr(self, wheel_side + '_wheel_elasticity')
wheel_grove_offset = getattr(self, wheel_side + '_wheel_groove_offset')
wheel_damp_position = getattr(self, wheel_side + '_wheel_damp_position')
wheel_damp_length = getattr(self, wheel_side + '_wheel_damp_length')
wheel_damp_stiffness = getattr(self, wheel_side + '_wheel_damp_stiffness')
Expand All @@ -120,7 +121,7 @@ def create_wheel(self, wheel_side):
wheel_objects.append(wheel_shape)

wheel_grove = pymunk.GrooveJoint(self.car_body, wheel_body,
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1]),
(wheel_damp_position[0] * self.x_modification, wheel_damp_position[1] - wheel_grove_offset),
(wheel_damp_position[0] * self.x_modification,
wheel_damp_position[1] - wheel_damp_length * 1.5),
(0, 0))
Expand Down
6 changes: 3 additions & 3 deletions madcars/Runners/mechanic/game_objects/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def create_box(self, space):
left.sensor = True

top = pymunk.Segment(space.static_body, (-bo, self.max_height + bo),
(self.max_width + bo, self.max_height + bo), 10)
(self.max_width + bo, self.max_height + bo), self.segment_height)
top.sensor = True

right = pymunk.Segment(space.static_body, (self.max_width + bo, self.max_height + bo),
(self.max_width + bo, -bo), 10)
(self.max_width + bo, -bo), self.segment_height)
right.sensor = True

bottom = pymunk.Segment(space.static_body, (self.max_width + bo, -bo), (-bo, -bo), 10)
bottom = pymunk.Segment(space.static_body, (self.max_width + bo, -bo), (-bo, -bo), self.segment_height)
bottom.sensor = True

self.objects.extend([left, top, right, bottom])
Expand Down

0 comments on commit a7987c8

Please sign in to comment.