share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 12058 1ebda99fd34a
parent 12057 1ee28630d424
child 12059 e8458438dcee
equal deleted inserted replaced
12057:1ee28630d424 12058:1ebda99fd34a
  1004 -----------------------
  1004 -----------------------
  1005 --EVENT HANDLERS
  1005 --EVENT HANDLERS
  1006 -- action keys
  1006 -- action keys
  1007 -----------------------
  1007 -----------------------
  1008 
  1008 
  1009 function HandleFlameThrower()
       
  1010 
       
  1011 	--
       
  1012 	--flamer
       
  1013 
       
  1014 	fireTimer = fireTimer + 1
       
  1015 	if fireTimer == 6 then	-- 6
       
  1016 		fireTimer = 0
       
  1017 
       
  1018 		if (wep[wepIndex] == loc("Flamer") ) and (preciseOn == true) and (wepAmmo[wepIndex] > 0) and (stopMovement == false) and (tumbleStarted == true) then
       
  1019 
       
  1020 			wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
       
  1021 			AddCaption(
       
  1022 			loc("Flamer") .. ": " ..
       
  1023 			(wepAmmo[wepIndex]/800*100) - (wepAmmo[wepIndex]/800*100)%2 .. "%",
       
  1024 			wepCol[2],
       
  1025 			capgrpMessage2
       
  1026 			)
       
  1027 			DrawTag(3)
       
  1028 
       
  1029 			dx, dy = GetGearVelocity(CurrentHedgehog)
       
  1030 			shell = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtFlame, 0, 0, 0, 0)
       
  1031 
       
  1032 			xdev = 1 + GetRandom(35)
       
  1033 			xdev = xdev / 100
       
  1034 
       
  1035 			r = GetRandom(2)
       
  1036 			if r == 1 then
       
  1037 				xdev = xdev*-1
       
  1038 			end
       
  1039 
       
  1040 			ydev = 1 + GetRandom(35)
       
  1041 			ydev = ydev / 100
       
  1042 
       
  1043 			r = GetRandom(2)
       
  1044 			if r == 1 then
       
  1045 				ydev = ydev*-1
       
  1046 			end
       
  1047 
       
  1048 			SetGearVelocity(shell, (dx*4.5)+(xdev*fMod), (dy*4.5)+(ydev*fMod))
       
  1049 
       
  1050 		end
       
  1051 
       
  1052 	end
       
  1053 
       
  1054 
       
  1055 end
       
  1056 
       
  1057 function ChangeWeapon()
  1009 function ChangeWeapon()
  1058 
  1010 
  1059 	wepIndex = wepIndex + 1
  1011 	wepIndex = wepIndex + 1
  1060 	if wepIndex == wepCount then
  1012 	if wepIndex == wepCount then
  1061 		wepIndex = 0
  1013 		wepIndex = 0
  1509 			if (stopMovement == false) then	--time to stop the player
  1461 			if (stopMovement == false) then	--time to stop the player
  1510 				stopMovement = true
  1462 				stopMovement = true
  1511 				boosterOn = false
  1463 				boosterOn = false
  1512 				beam = false
  1464 				beam = false
  1513 				upOn = false
  1465 				upOn = false
  1514 				down = false
  1466 				downOn = false
  1515 				leftOn = false
  1467 				leftOn = false
  1516 				rightOn = false
  1468 				rightOn = false
  1517 				SetMyCircles(false)
  1469 				SetMyCircles(false)
  1518 				rAlpha = 255
  1470 				rAlpha = 255
  1519 				--nw WriteLnToConsole("Player is out of luck")
  1471 				--nw WriteLnToConsole("Player is out of luck")
  1641 				--WriteLnToConsole("I just SET the velocity of currenthedgehog. It is now dx: " .. dx .. "; dy: " .. dy)
  1593 				--WriteLnToConsole("I just SET the velocity of currenthedgehog. It is now dx: " .. dx .. "; dy: " .. dy)
  1642 				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
  1594 				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
  1643 				--nw WriteLnToConsole("End of Player MoveTimer")
  1595 				--nw WriteLnToConsole("End of Player MoveTimer")
  1644 
  1596 
  1645 			end
  1597 			end
  1646 
       
  1647 
       
  1648 			HandleFlameThrower()
       
  1649 
  1598 
  1650 
  1599 
  1651 		end -- new end I put here to check if he's still alive or not
  1600 		end -- new end I put here to check if he's still alive or not
  1652 
  1601 
  1653 	end
  1602 	end