share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
changeset 10670 638af9cb922b
parent 10036 3be36d2fdca6
child 11301 fa18940f290d
equal deleted inserted replaced
10669:4c78eafe76ac 10670:638af9cb922b
    75 local wHeight = {}
    75 local wHeight = {}
    76 local wTouched = {}
    76 local wTouched = {}
    77 --local margin
    77 --local margin
    78 local wallsLeft = 0
    78 local wallsLeft = 0
    79 
    79 
    80 local highestY = 0
       
    81 local surferTimer = 0
       
    82 local hasSurfed = false
    80 local hasSurfed = false
    83 local allWallsHit = false
    81 local allWallsHit = false
    84 
    82 
    85 local gTimer = 1
    83 local gTimer = 1
    86 local effectTimer = 1
    84 local effectTimer = 1
   354 		end
   352 		end
   355 	end
   353 	end
   356 
   354 
   357 end
   355 end
   358 
   356 
   359 function CheckSurfer()
   357 function onGearWaterSkip(gear)
   360 
   358 	if gear == CurrentHedgehog then
   361 	if GetY(CurrentHedgehog) > highestY then
   359 		hasSurfed = true
   362 		highestY = GetY(CurrentHedgehog)
   360 		AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
   363 	end
   361 	end
   364 
   362 end
   365 	if (highestY == (WaterLine-8)) and (hasSurfed == false)  then
       
   366 
       
   367 		surferTimer = surferTimer +1
       
   368 		if (surferTimer == 40) then
       
   369 			hasSurfed = true
       
   370 			AddCaption(loc("Surfer!"),0xffba00ff,capgrpMessage2)
       
   371 		end
       
   372 	end
       
   373 
       
   374 end
       
   375 
       
   376 
   363 
   377 
   364 
   378 function WallHit(id, zXMin,zYMin, zWidth, zHeight)
   365 function WallHit(id, zXMin,zYMin, zWidth, zHeight)
   379 
   366 
   380 	if wTouched[id] == false then
   367 	if wTouched[id] == false then
   586 		wTouched[i] = false
   573 		wTouched[i] = false
   587 	end
   574 	end
   588 
   575 
   589 	allowCrate = true
   576 	allowCrate = true
   590 
   577 
   591 	surferTimer = 0
       
   592 	hasSurfed = false
   578 	hasSurfed = false
   593 	allWallsHit = false
   579 	allWallsHit = false
   594 	highestY = 0
       
   595 
   580 
   596 	crateG = nil
   581 	crateG = nil
   597 
   582 
   598 	-- new config stuff
   583 	-- new config stuff
   599 	roundN = roundN + 1
   584 	roundN = roundN + 1
   647 
   632 
   648 	if CurrentHedgehog ~= nil then
   633 	if CurrentHedgehog ~= nil then
   649 
   634 
   650 		--AddCaption(Map)
   635 		--AddCaption(Map)
   651 		--AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
   636 		--AddCaption(RightX ..";" .. GetX(CurrentHedgehog))
   652 
       
   653 		CheckSurfer()
       
   654 
   637 
   655 		gTimer = gTimer + 1
   638 		gTimer = gTimer + 1
   656 		if gTimer == 25 then
   639 		if gTimer == 25 then
   657 			gTimer = 1
   640 			gTimer = 1
   658 
   641