share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
changeset 11653 89fc5e6ccc76
parent 11652 b4d621700bbb
child 11928 85cbb2368269
equal deleted inserted replaced
11651:42d7f5dbd8dc 11653:89fc5e6ccc76
     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 
   656                                 AddCaption(loc("Good to go!"))
   690                                 AddCaption(loc("Good to go!"))
   657                                 racerActive = true
   691                                 racerActive = true
   658                                 trackTime = 0
   692                                 trackTime = 0
   659 
   693 
   660                                 SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
   694                                 SetGearPosition(CurrentHedgehog, wpX[0], wpY[0])
   661                                 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
   695                                 AddGear(GetX(CurrentHedgehog)+boostX, GetY(CurrentHedgehog)+boostY, gtGrenade, 0, 0, 0, 1)
   662                                 FollowGear(CurrentHedgehog)
   696                                 FollowGear(CurrentHedgehog)
   663 
   697 
   664                                 HideMission()
   698                                 HideMission()
   665 
   699 
   666                                 -- don't start empty-handed
   700                                 -- don't start empty-handed