share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 11647 b4d621700bbb
parent 11585 026c329b1a13
child 11648 89fc5e6ccc76
equal deleted inserted replaced
11645:e80fc50457a2 11647:b4d621700bbb
     1 
     1 
     2 ------------------------------------------
     2 ------------------------------------------
     3 -- RACER 0.6
     3 -- RACER 0.8
     4 -- map-independant racing script
     4 -- map-independant racing script
     5 -- by mikade
     5 -- by mikade
     6 -----------------------------------------
     6 -----------------------------------------
     7 
     7 
     8 -----------------------------------
     8 -----------------------------------
    71 -- 0.7
    71 -- 0.7
    72 -------
    72 -------
    73 
    73 
    74 -- switch to first available weapon if starting race with no weapon selected
    74 -- switch to first available weapon if starting race with no weapon selected
    75 
    75 
       
    76 -------
       
    77 -- 0.8
       
    78 -------
       
    79 -- allow different boost directions
       
    80 
    76 -----------------------------
    81 -----------------------------
    77 -- SCRIPT BEGINS
    82 -- SCRIPT BEGINS
    78 -----------------------------
    83 -----------------------------
    79 
    84 
    80 HedgewarsScriptLoad("/Scripts/Locale.lua")
    85 HedgewarsScriptLoad("/Scripts/Locale.lua")
   148 local usedWeapons = {}
   153 local usedWeapons = {}
   149 
   154 
   150 local roundN
   155 local roundN
   151 local lastRound
   156 local lastRound
   152 local RoundHasChanged
   157 local RoundHasChanged
       
   158 
       
   159 local boostX = 0
       
   160 local boostY = 0
       
   161 local boostValue = 1
   153 
   162 
   154 -------------------
   163 -------------------
   155 -- general methods
   164 -- general methods
   156 -------------------
   165 -------------------
   157 
   166 
   221 
   230 
   222 
   231 
   223 -----------------
   232 -----------------
   224 -- RACER METHODS
   233 -- RACER METHODS
   225 -----------------
   234 -----------------
       
   235 
       
   236 function onLeft()
       
   237 	boostX = boostX +boostValue
       
   238 end
       
   239 function onLeftUp()
       
   240 	boostX = boostX -boostValue
       
   241 end
       
   242 function onRight()
       
   243 	boostX = boostX -boostValue
       
   244 end
       
   245 function onRightUp()
       
   246 	boostX = boostX +boostValue
       
   247 end
       
   248 function onUp()
       
   249 	boostY = boostY +boostValue
       
   250 end
       
   251 function onUpUp()
       
   252 	boostY = boostY -boostValue
       
   253 end
       
   254 function onDown()
       
   255 	boostY = boostY -boostValue
       
   256 end
       
   257 function onDownUp()
       
   258 	boostY = boostY +boostValue
       
   259 end
   226 
   260 
   227 function CheckWaypoints()
   261 function CheckWaypoints()
   228 
   262 
   229         trackFinished = true
   263         trackFinished = true
   230 
   264