This commit is contained in:
alstergym
2026-09-07 15:51:09 +02:00
parent c9e2c4f199
commit ca9480847c
3 changed files with 37 additions and 10 deletions
+5 -4
View File
@@ -23,11 +23,12 @@ class Kart:
def tick(self, input: Input):
input_x = input.horizontal()
input_y = input.vertical()
assert abs(input_x) < 1
assert abs(input_y) < 1
assert abs(input_x) <= 1
assert abs(input_y) <= 1
acc_amount = input_y * 2
self.vel += Vec2(acc_amount, 0).rotate(self.dir)
self.vel *= 0.9
steer = input_x * 2
self.dir += steer
@@ -44,8 +45,8 @@ class Kart:
def consume_item(self, item: Item):
if item.kind == items.ITEM_BANANA:
self.speed_max += 1
self.speed_max += 0.01
elif item.kind == items.ITEM_BANANA:
self.speed_max -= 1
self.speed_max -= 0.01
self.speed_max = clamp(self.speed_max, 0, 100)