Allow variable boost directions in Racer
authormikade <redgrinner@gmail.com>
Sun, 10 Apr 2016 14:00:09 +0900
changeset 11652 b4d621700bbb
parent 11650 e80fc50457a2
child 11653 89fc5e6ccc76
Allow variable boost directions in Racer
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Thu Apr 07 11:53:20 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Sun Apr 10 14:00:09 2016 +0900
@@ -1,6 +1,6 @@
 
 ------------------------------------------
--- RACER 0.6
+-- RACER 0.8
 -- map-independant racing script
 -- by mikade
 -----------------------------------------
@@ -73,6 +73,11 @@
 
 -- switch to first available weapon if starting race with no weapon selected
 
+-------
+-- 0.8
+-------
+-- allow different boost directions
+
 -----------------------------
 -- SCRIPT BEGINS
 -----------------------------
@@ -151,6 +156,10 @@
 local lastRound
 local RoundHasChanged
 
+local boostX = 0
+local boostY = 0
+local boostValue = 1
+
 -------------------
 -- general methods
 -------------------
@@ -224,6 +233,31 @@
 -- RACER METHODS
 -----------------
 
+function onLeft()
+	boostX = boostX +boostValue
+end
+function onLeftUp()
+	boostX = boostX -boostValue
+end
+function onRight()
+	boostX = boostX -boostValue
+end
+function onRightUp()
+	boostX = boostX +boostValue
+end
+function onUp()
+	boostY = boostY +boostValue
+end
+function onUpUp()
+	boostY = boostY -boostValue
+end
+function onDown()
+	boostY = boostY -boostValue
+end
+function onDownUp()
+	boostY = boostY +boostValue
+end
+
 function CheckWaypoints()
 
         trackFinished = true