merge
authormikade <redgrinner@gmail.com>
Wed, 13 Apr 2016 21:42:00 +0900
changeset 11653 89fc5e6ccc76
parent 11651 42d7f5dbd8dc (current diff)
parent 11652 b4d621700bbb (diff)
child 11654 1fd1525653d8
child 11772 c21278c4218d
merge
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Apr 12 15:41:48 2016 -0400
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Wed Apr 13 21:42:00 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
@@ -658,7 +692,7 @@
                                 trackTime = 0
 
                                 SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
-                                AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
+                                AddGear(GetX(CurrentHedgehog)+boostX, GetY(CurrentHedgehog)+boostY, gtGrenade, 0, 0, 0, 1)
                                 FollowGear(CurrentHedgehog)
 
                                 HideMission()