From d8d0818288c8e6ae811b19ba759240aa28105604 Mon Sep 17 00:00:00 2001 From: djib Date: Sun, 1 Jan 2023 23:46:57 +0100 Subject: [PATCH] Add basic motor sound --- racing.p8 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/racing.p8 b/racing.p8 index 25d7ce8..d168ffc 100644 --- a/racing.p8 +++ b/racing.p8 @@ -44,11 +44,8 @@ function car:update() end if btn(⬅️) then self.x=self.x-1 end if btn(➡️) then self.x=self.x+1 end - if btn(⬅️) or btn(➡️) then - sfx(1,10,-1,0,5) - else - sfx(1,8,-1,0,5) - end + sfx(-1) + sfx(self.speed) end function car:draw() @@ -57,7 +54,6 @@ function car:draw() tick=self.game.t\(2^(4-self.speed))%4 end palt(0x0100) - printh(1+tick*2) spr(1+tick*2,self.x,self.y,2,2) print("speed:"..car.speed,5,5,5) end @@ -123,7 +119,6 @@ function road:draw() else end else - printh("y:"..y.." self:"..self[y+1]) if x