share/hedgewars/Data/Scripts/Multiplayer/Space_Invasion.lua
changeset 13448 6aca4f45ab0a
parent 13447 93ba1826b8c2
child 13449 57de4f050891
equal deleted inserted replaced
13447:93ba1826b8c2 13448:6aca4f45ab0a
   344 local explosivesID = 0
   344 local explosivesID = 0
   345 local luaGameTicks = 0
   345 local luaGameTicks = 0
   346 
   346 
   347 -- gaudyRacer
   347 -- gaudyRacer
   348 local boosterOn = false
   348 local boosterOn = false
       
   349 local preciseOn = false
   349 local roundLimit = 3		-- can be overridden by script parameter "rounds"
   350 local roundLimit = 3		-- can be overridden by script parameter "rounds"
   350 local roundNumber = 0
   351 local roundNumber = 0
   351 local firstClan = 10
   352 local firstClan = 10
   352 local gameOver = false
   353 local gameOver = false
   353 local gameBegun = false
   354 local gameBegun = false
   462 
   463 
   463 local shockwave
   464 local shockwave
   464 local shockwaveHealth = 0
   465 local shockwaveHealth = 0
   465 local shockwaveRad = 300
   466 local shockwaveRad = 300
   466 
   467 
   467 local Timer100 = 0
   468 local timer100 = 0
   468 
   469 
   469 local vTag = {}
   470 local vTag = {}
   470 
   471 
   471 -----------------------------------------------
   472 -----------------------------------------------
   472 -- CIRCLY GOODIES
   473 -- CIRCLY GOODIES
   473 -----------------------------------------------
   474 -----------------------------------------------
   474 
   475 
   475 local CirclesAreGo = false
   476 local circlesAreGo = false
   476 local playerIsFine = true
   477 local playerIsFine = true
   477 local targetHit = false
   478 local targetHit = false
   478 
   479 
   479 local FadeAlpha = 0 -- used to fade the circles out gracefully when player dies
   480 local fadeAlpha = 0 -- used to fade the circles out gracefully when player dies
   480 local pTimer = 0 -- tracking projectiles following player
   481 local pTimer = 0 -- tracking projectiles following player
   481 
   482 
   482 local circAdjustTimer = 0		-- handle adjustment of circs direction
   483 local circAdjustTimer = 0		-- handle adjustment of circs direction
   483 local m2Count = 0		-- handle speed of circs
   484 local m2Count = 0		-- handle speed of circs
   484 
   485 
   561 		tValue = roundScore
   562 		tValue = roundScore
   562 	end
   563 	end
   563 
   564 
   564 	DeleteVisualGear(vTag[i])
   565 	DeleteVisualGear(vTag[i])
   565 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   566 	vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false)
   566 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vTag[i])
       
   567 	SetVisualGearValues	(
   567 	SetVisualGearValues	(
   568 				vTag[i], 		--id
   568 				vTag[i], 		--id
   569 				-(ScreenWidth/2) + xOffset,	--xoffset
   569 				-(ScreenWidth/2) + xOffset,	--xoffset
   570 				ScreenHeight - yOffset, --yoffset
   570 				ScreenHeight - yOffset, --yoffset
   571 				0, 			--dx
   571 				0, 			--dx
   572 				0, 			--dy
   572 				0, 			--dy
   573 				zoomL, 			--zoom
   573 				zoomL, 			--zoom
   574 				1, 			--~= 0 means align to screen
   574 				1, 			--~= 0 means align to screen
   575 				g7, 			--frameticks
   575 				nil, 			--frameticks
   576 				tValue, 		--value
   576 				tValue, 		--value
   577 				240000, 		--timer
   577 				240000, 		--timer
   578 				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
   578 				tCol		--GetClanColor( GetHogClan(CurrentHedgehog) )
   579 				)
   579 				)
   580 
   580 
   592 	end
   592 	end
   593 	numTeams = 0
   593 	numTeams = 0
   594 
   594 
   595 	for i = 0, (numhhs-1) do
   595 	for i = 0, (numhhs-1) do
   596 
   596 
   597 		z = 0
   597 		local z = 0
   598 		unfinished = true
   598 		local unfinished = true
   599 		while(unfinished == true) do
   599 		while(unfinished == true) do
   600 
   600 
   601 			newTeam = true
   601 			local newTeam = true
   602 			tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
   602 			local tempHogTeamName = GetHogTeamName(hhs[i]) -- this is the new name
   603 
   603 
   604 			if tempHogTeamName == teamNameArr[z] then
   604 			if tempHogTeamName == teamNameArr[z] then
   605 				newTeam = false
   605 				newTeam = false
   606 				unfinished = false
   606 				unfinished = false
   607 			end
   607 			end
   949 	end
   949 	end
   950 end
   950 end
   951 
   951 
   952 function setNewGearValues(gear)
   952 function setNewGearValues(gear)
   953 
   953 
       
   954 	local lfs
   954 	if GetGearType(gear) == gtShell then
   955 	if GetGearType(gear) == gtShell then
   955 		lfs = 50	-- roughly 5 seconds
   956 		lfs = 50	-- roughly 5 seconds
   956 		shellID = shellID + 1
   957 		shellID = shellID + 1
   957 		setGearValue(gear,"ID",shellID)
   958 		setGearValue(gear,"ID",shellID)
   958 		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell")
   959 		--nw WriteLnToConsole("Just assigned ID " .. getGearValue(gear,"ID") .. " to this shell")
  1050 		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
  1051 		wepAmmo[wepIndex] = wepAmmo[wepIndex] - 1
  1051 
  1052 
  1052 		if wep[wepIndex] == loc("Barrel Launcher") then
  1053 		if wep[wepIndex] == loc("Barrel Launcher") then
  1053 			shotsFired = shotsFired +1
  1054 			shotsFired = shotsFired +1
  1054 
  1055 
  1055 			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
  1056 			local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtExplosives, 0, 0, 0, 1)
  1056 			CopyPV(CurrentHedgehog, morte) -- new addition
  1057 			CopyPV(CurrentHedgehog, morte) -- new addition
  1057 			x,y = GetGearVelocity(morte)
  1058 			local x,y = GetGearVelocity(morte)
  1058 			x = x*2
  1059 			x = x*2
  1059 			y = y*2
  1060 			y = y*2
  1060 			SetGearVelocity(morte, x, y)
  1061 			SetGearVelocity(morte, x, y)
  1061 
  1062 
  1062 			if wepAmmo[wepIndex] == 0 then
  1063 			if wepAmmo[wepIndex] == 0 then
  1066 				PlaySound(sndThrowRelease)
  1067 				PlaySound(sndThrowRelease)
  1067 			end
  1068 			end
  1068 			DrawTag(1)
  1069 			DrawTag(1)
  1069 
  1070 
  1070 		elseif wep[wepIndex] == loc("Mine Deployer") then
  1071 		elseif wep[wepIndex] == loc("Mine Deployer") then
  1071 			morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0)
  1072 			local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0)
  1072 			SetTimer(morte, 1000)
  1073 			SetTimer(morte, 1000)
  1073 			DrawTag(1)
  1074 			DrawTag(1)
  1074 		end
  1075 		end
  1075 
  1076 
  1076 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1077 	elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then
  1332 		roundNumber = 0 -- 0
  1333 		roundNumber = 0 -- 0
  1333 		firstClan = GetHogClan(CurrentHedgehog)
  1334 		firstClan = GetHogClan(CurrentHedgehog)
  1334 	end
  1335 	end
  1335 
  1336 
  1336 	if gameOver == true then
  1337 	if gameOver == true then
  1337 		gameBegun = false
       
  1338 		stopMovement = true
  1338 		stopMovement = true
  1339 		tumbleStarted = false
  1339 		tumbleStarted = false
  1340 		SetMyCircles(false)
  1340 		SetMyCircles(false)
  1341 	end
  1341 	end
  1342 
  1342 
  1365 function ThingsToBeRunOnGears(gear)
  1365 function ThingsToBeRunOnGears(gear)
  1366 
  1366 
  1367 	HandleLifeSpan(gear)
  1367 	HandleLifeSpan(gear)
  1368 	DeleteFarFlungBarrel(gear)
  1368 	DeleteFarFlungBarrel(gear)
  1369 
  1369 
  1370 	if CirclesAreGo == true then
  1370 	if circlesAreGo == true then
  1371 		CheckVarious(gear)
  1371 		CheckVarious(gear)
  1372 		ProjectileTrack(gear)
  1372 		ProjectileTrack(gear)
  1373 	end
  1373 	end
  1374 
  1374 
  1375 end
  1375 end
  1394 	--WriteLnToConsole("Start of GameTick")
  1394 	--WriteLnToConsole("Start of GameTick")
  1395 	luaGameTicks = luaGameTicks + 1 -- GameTime
  1395 	luaGameTicks = luaGameTicks + 1 -- GameTime
  1396 
  1396 
  1397 	HandleCircles()
  1397 	HandleCircles()
  1398 
  1398 
  1399 	Timer100 = Timer100 + 1
  1399 	timer100 = timer100 + 1
  1400 	if Timer100 >= 100 then
  1400 	if timer100 >= 100 then
  1401 		Timer100 = 0
  1401 		timer100 = 0
  1402 
  1402 
  1403 		if beam == true then
  1403 		if beam == true then
  1404 			shieldHealth = shieldHealth - 1
  1404 			shieldHealth = shieldHealth - 1
  1405 			if shieldHealth < 80 then -- <= 80
  1405 			if shieldHealth < 80 then -- <= 80
  1406 				shieldHealth = 80
  1406 				shieldHealth = 80
  1422 
  1422 
  1423 		runOnGears(ThingsToBeRunOnGears)
  1423 		runOnGears(ThingsToBeRunOnGears)
  1424 
  1424 
  1425 		--nw WriteLnToConsole("Finished ThingsToBeRunOnGears()")
  1425 		--nw WriteLnToConsole("Finished ThingsToBeRunOnGears()")
  1426 
  1426 
  1427 		if CirclesAreGo == true then
  1427 		if circlesAreGo == true then
  1428 			CheckDistances()
  1428 			CheckDistances()
  1429 		end
  1429 		end
  1430 
  1430 
  1431 		-- white smoke trail as player falls from the sky
  1431 		-- white smoke trail as player falls from the sky
  1432 		if (TimeLeft <= 0) and (stopMovement == true) and (CurrentHedgehog ~= nil) then
  1432 		if (TimeLeft <= 0) and (stopMovement == true) and (CurrentHedgehog ~= nil) then
  1433 			j,k = GetGearVelocity(CurrentHedgehog)
  1433 			local j,k = GetGearVelocity(CurrentHedgehog)
  1434 			if (j ~= 0) and (k ~= 0) then
  1434 			if (j ~= 0) and (k ~= 0) then
  1435 				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
  1435 				AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
  1436 			end
  1436 			end
  1437 		end
  1437 		end
  1438 
  1438 
  1444 	-- start the player tumbling with a boom once their turn has actually begun
  1444 	-- start the player tumbling with a boom once their turn has actually begun
  1445 	if (tumbleStarted == false) and (gameOver == false) then
  1445 	if (tumbleStarted == false) and (gameOver == false) then
  1446 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
  1446 		if (TurnTimeLeft > 0) and (TurnTimeLeft ~= TurnTime) then
  1447 			tumbleStarted = true
  1447 			tumbleStarted = true
  1448 			TimeLeft = (TurnTime/1000)
  1448 			TimeLeft = (TurnTime/1000)
  1449 			FadeAlpha = 0
  1449 			fadeAlpha = 0
  1450 			rAlpha = 255
  1450 			rAlpha = 255
  1451 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
  1451 			AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1)
  1452 			DrawTag(0)
  1452 			DrawTag(0)
  1453 			DrawTag(1)
  1453 			DrawTag(1)
  1454 			DrawTag(2)
  1454 			DrawTag(2)
  1508 				FailGraphics()
  1508 				FailGraphics()
  1509 				--nw WriteLnToConsole("Player is out of luck")
  1509 				--nw WriteLnToConsole("Player is out of luck")
  1510 
  1510 
  1511 				if shieldMiser == true then
  1511 				if shieldMiser == true then
  1512 
  1512 
  1513 					p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1513 					local p = (roundKills*3.5) - ((roundKills*3.5)%1) + 2
  1514 
  1514 
  1515 					AddCaption(string.format(loc("Shield Miser! +%d points!"), p),0xffba00ff,capgrpAmmoinfo)
  1515 					AddCaption(string.format(loc("Shield Miser! +%d points!"), p),0xffba00ff,capgrpAmmoinfo)
  1516 					AwardPoints(p)
  1516 					AwardPoints(p)
  1517 				end
  1517 				end
  1518 
  1518 
  1573 				---------------
  1573 				---------------
  1574 				-- new trail code
  1574 				-- new trail code
  1575 				---------------
  1575 				---------------
  1576 				-- the trail lets you know you have 5s left to pilot, akin to birdy feathers
  1576 				-- the trail lets you know you have 5s left to pilot, akin to birdy feathers
  1577 				if (TimeLeft <= 5) and (TimeLeft > 0) then							--vgtSmoke
  1577 				if (TimeLeft <= 5) and (TimeLeft > 0) then							--vgtSmoke
  1578 					tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
  1578 					local tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, true)
  1579 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  1579 					SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, GetClanColor(GetHogClan(CurrentHedgehog)) )
  1580 					SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
       
  1581 				end
  1580 				end
  1582 				--------------
  1581 				--------------
  1583 				--------------
  1582 				--------------
  1584 
  1583 
  1585 				dx, dy = GetGearVelocity(CurrentHedgehog)
  1584 				local dx, dy = GetGearVelocity(CurrentHedgehog)
  1586 
  1585 
  1587 				--WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy)
  1586 				--WriteLnToConsole("I just got the velocity of currenthedgehog. It is dx: " .. dx .. "; dy: " .. dy)
  1588 				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
  1587 				--WriteLnToConsole("The above event occured game Time: " .. GameTime .. "; luaTicks: " .. luaGameTicks)
  1589 
  1588 
       
  1589 				local dxlimit, dylimit
  1590 				if boosterOn == true then
  1590 				if boosterOn == true then
  1591 					tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
  1591 					local tempE = AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtDust, 0, false)
  1592 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  1592 					SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, 1, nil, GetClanColor(GetHogClan(CurrentHedgehog)) )
  1593 					SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, 1, g9, GetClanColor(GetHogClan(CurrentHedgehog)) )
       
  1594 					dxlimit = 0.8*fMod
  1593 					dxlimit = 0.8*fMod
  1595 					dylimit = 0.8*fMod
  1594 					dylimit = 0.8*fMod
  1596 				else
  1595 				else
  1597 					dxlimit = 0.4*fMod
  1596 					dxlimit = 0.4*fMod
  1598 					dylimit = 0.4*fMod
  1597 					dylimit = 0.4*fMod
  1731 ------------------------------------------------------------
  1730 ------------------------------------------------------------
  1732 
  1731 
  1733 function DoHorribleThings(cUID)
  1732 function DoHorribleThings(cUID)
  1734 
  1733 
  1735 	-- work out the distance to the target
  1734 	-- work out the distance to the target
  1736 	g1X, g1Y = GetGearPosition(CurrentHedgehog)
  1735 	local g1X, g1Y = GetGearPosition(CurrentHedgehog)
  1737 	g2X, g2Y = vCircX[cUID], vCircY[cUID]
  1736 	local g2X, g2Y = vCircX[cUID], vCircY[cUID]
  1738 	q = g1X - g2X
  1737 	local q = g1X - g2X
  1739 	w = g1Y - g2Y
  1738 	local w = g1Y - g2Y
  1740 	r = math.sqrt( (q*q) + (w*w) )	--alternate
  1739 	local r = math.sqrt( (q*q) + (w*w) )	--alternate
  1741 
  1740 
  1742 	opp = w
  1741 	local opp = w
  1743 	if opp < 0 then
  1742 	if opp < 0 then
  1744 		opp = opp*-1
  1743 		opp = opp*-1
  1745 	end
  1744 	end
  1746 
  1745 
  1747 	-- work out the angle (theta) to the target
  1746 	-- work out the angle (theta) to the target
  1748 	t = math.deg ( math.asin(opp / r) )
  1747 	local t = math.deg ( math.asin(opp / r) )
  1749 
  1748 
  1750 	-- based on the radius of the radar, calculate what x/y displacement should be
  1749 	-- based on the radius of the radar, calculate what x/y displacement should be
  1751 	NR = 150 -- radius at which to draw circs
  1750 	local NR = 150 -- radius at which to draw circs
  1752 	NX = math.cos( math.rad(t) ) * NR
  1751 	local NX = math.cos( math.rad(t) ) * NR
  1753 	NY = math.sin( math.rad(t) ) * NR
  1752 	local NY = math.sin( math.rad(t) ) * NR
  1754 
  1753 
  1755 	-- displace xy based on where this thing actually is
  1754 	-- displace xy based on where this thing actually is
  1756 
  1755 
  1757 	if r < NR then
  1756 	if r < NR then
  1758 		rCircX[cUID] = g2X
  1757 		rCircX[cUID] = g2X
  1775 function PlayerIsFine()
  1774 function PlayerIsFine()
  1776 	return (playerIsFine)
  1775 	return (playerIsFine)
  1777 end
  1776 end
  1778 
  1777 
  1779 function GetDistFromXYtoXY(a, b, c, d)
  1778 function GetDistFromXYtoXY(a, b, c, d)
  1780 	q = a - c
  1779 	local q = a - c
  1781 	w = b - d
  1780 	local w = b - d
  1782 	return ( (q*q) + (w*w) )
  1781 	return ( (q*q) + (w*w) )
  1783 end
  1782 end
  1784 
  1783 
  1785 function GetDistFromGearToGear(gear, gear2)
  1784 function GetDistFromGearToGear(gear, gear2)
  1786 
  1785 
  1787 	g1X, g1Y = GetGearPosition(gear)
  1786 	local g1X, g1Y = GetGearPosition(gear)
  1788 	g2X, g2Y = GetGearPosition(gear2)
  1787 	local g2X, g2Y = GetGearPosition(gear2)
  1789 	q = g1X - g2X
  1788 	local q = g1X - g2X
  1790 	w = g1Y - g2Y
  1789 	local w = g1Y - g2Y
  1791 
  1790 
  1792 	return ( (q*q) + (w*w) )
  1791 	return ( (q*q) + (w*w) )
  1793 
  1792 
  1794 end
  1793 end
  1795 
  1794 
  1796 function GetDistFromGearToXY(gear, g2X, g2Y)
  1795 function GetDistFromGearToXY(gear, g2X, g2Y)
  1797 
  1796 
  1798 	g1X, g1Y = GetGearPosition(gear)
  1797 	local g1X, g1Y = GetGearPosition(gear)
  1799 	q = g1X - g2X
  1798 	local q = g1X - g2X
  1800 	w = g1Y - g2Y
  1799 	local w = g1Y - g2Y
  1801 
  1800 
  1802 	return ( (q*q) + (w*w) )
  1801 	return ( (q*q) + (w*w) )
  1803 
  1802 
  1804 end
  1803 end
  1805 
  1804 
  1851 
  1850 
  1852 end
  1851 end
  1853 
  1852 
  1854 function IGotMeASafeXYValue(i)
  1853 function IGotMeASafeXYValue(i)
  1855 
  1854 
  1856 	acceptibleDistance = 800
  1855 	local acceptibleDistance = 800
  1857 
  1856 
  1858 	vCircX[i] = GetRandom(5000)
  1857 	vCircX[i] = GetRandom(5000)
  1859 	vCircY[i] = GetRandom(2000)
  1858 	vCircY[i] = GetRandom(2000)
  1860 	dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i])
  1859 	local dist = GetDistFromGearToXY(CurrentHedgehog, vCircX[i], vCircY[i])
  1861 	if dist > acceptibleDistance*acceptibleDistance then
  1860 	if dist > acceptibleDistance*acceptibleDistance then
  1862 		return(true)
  1861 		return(true)
  1863 	else
  1862 	else
  1864 		return(false)
  1863 		return(false)
  1865 	end
  1864 	end
  1866 
  1865 
  1867 end
  1866 end
  1868 
  1867 
  1869 function CircleDamaged(i)
  1868 function CircleDamaged(i)
  1870 
  1869 
  1871 	res = ""
  1870 	local res = ""
  1872 	vCircHealth[i] = vCircHealth[i] -1
  1871 	vCircHealth[i] = vCircHealth[i] -1
  1873 
  1872 
  1874 	if vCircHealth[i] <= 0 then
  1873 	if vCircHealth[i] <= 0 then
  1875 	-- circle is dead, do death effects/consequences
  1874 	-- circle is dead, do death effects/consequences
  1876 
  1875 
  1880 			PlaySound(sndHellishImpact4)
  1879 			PlaySound(sndHellishImpact4)
  1881 			TimeLeft = TimeLeft + timeBonus
  1880 			TimeLeft = TimeLeft + timeBonus
  1882 			AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage )
  1881 			AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage )
  1883 			DrawTag(0)
  1882 			DrawTag(0)
  1884 
  1883 
  1885 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1884 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1886 			SetHealth(morte, 0)
  1885 			SetHealth(morte, 0)
  1887 
  1886 
  1888 			RK = RK + 1
  1887 			RK = RK + 1
  1889 			if RK == 5 then
  1888 			if RK == 5 then
  1890 				RK = 0
  1889 				RK = 0
  1941 			tauntTimer = 300
  1940 			tauntTimer = 300
  1942 			tauntSound = sndEnemyDown
  1941 			tauntSound = sndEnemyDown
  1943 			tauntGear = CurrentHedgehog
  1942 			tauntGear = CurrentHedgehog
  1944 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1943 			AddCaption(loc("Boss defeated! +30 points!"), 0x0050ffff,capgrpMessage)
  1945 
  1944 
  1946 			morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1945 			local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1)
  1947 			SetHealth(morte, 0)
  1946 			SetHealth(morte, 0)
  1948 
  1947 
  1949 			BK = BK + 1
  1948 			BK = BK + 1
  1950 			if BK == 2 then
  1949 			if BK == 2 then
  1951 				BK = 0
  1950 				BK = 0
  1971 
  1970 
  1972 	else
  1971 	else
  1973 	-- circle is merely damaged
  1972 	-- circle is merely damaged
  1974 	-- do damage effects/sounds
  1973 	-- do damage effects/sounds
  1975 		AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false)
  1974 		AddVisualGear(vCircX[i], vCircY[i], vgtSteam, 0, false)
  1976 		r = math.random(1,4)
  1975 		local r = math.random(1,4)
  1977 		PlaySound(_G["sndHellishImpact" .. tostring(r)])
  1976 		PlaySound(_G["sndHellishImpact" .. tostring(r)])
  1978 		res = "non-fatal"
  1977 		res = "non-fatal"
  1979 
  1978 
  1980 	end
  1979 	end
  1981 
  1980 
  1984 end
  1983 end
  1985 
  1984 
  1986 function SetUpCircle(i)
  1985 function SetUpCircle(i)
  1987 
  1986 
  1988 
  1987 
  1989 	r = GetRandom(10)
  1988 	local r = GetRandom(10)
  1990 	-- 80% of spawning either red/green
  1989 	-- 80% of spawning either red/green
  1991 	if r <= 7 then
  1990 	if r <= 7 then
  1992 
  1991 
  1993 		r = GetRandom(2)
  1992 		r = GetRandom(2)
  1994 		if r == 0 then
  1993 		if r == 0 then
  2030 		end
  2029 		end
  2031 
  2030 
  2032 	end
  2031 	end
  2033 
  2032 
  2034 	-- regenerate circle xy if too close to player or until sanity limit kicks in
  2033 	-- regenerate circle xy if too close to player or until sanity limit kicks in
  2035 	reN = 0
  2034 	local reN = 0
  2036 	while (reN < 10) do
  2035 	while (reN < 10) do
  2037 		if IGotMeASafeXYValue(i) == false then
  2036 		if IGotMeASafeXYValue(i) == false then
  2038 			reN = reN + 1
  2037 			reN = reN + 1
  2039 		else
  2038 		else
  2040 			reN = 15
  2039 			reN = 15
  2041 		end
  2040 		end
  2042 	end
  2041 	end
  2043 
  2042 
  2044 	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
  2043 	vCircRadius[i] = vCircRadMax[i] - GetRandom(vCircRadMin[i])
  2045 
  2044 
  2046 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
  2045 	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff)
  2047 	SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], vCircWidth[i], vCircCol[i]-0x000000ff)
  2046 
  2048 
  2047 	SetVisualGearValues(rCirc[i], 0, 0, nil, nil, nil, nil, nil, nil, nil, vCircCol[i]-0x000000ff)
  2049 	g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(rCirc[i])
       
  2050 	SetVisualGearValues(rCirc[i], 0, 0, g3, g4, g5, g6, g7, g8, g9, vCircCol[i]-0x000000ff)
       
  2051 
  2048 
  2052 
  2049 
  2053 	vCircActive[i] = true
  2050 	vCircActive[i] = true
  2054 
  2051 
  2055 	--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
  2052 	--nw WriteLnToConsole("CIRC " .. i .. ": X: " .. vCircX[i] .. "; Y: " .. vCircY[i])
  2058 
  2055 
  2059 end
  2056 end
  2060 
  2057 
  2061 function SetMyCircles(s)
  2058 function SetMyCircles(s)
  2062 
  2059 
  2063 	CirclesAreGo = s
  2060 	circlesAreGo = s
  2064 	playerIsFine = s
  2061 	playerIsFine = s
  2065 
  2062 
  2066 	if s == true then
  2063 	if s == true then
  2067 		--nw WriteLnToConsole("About to set up all circles, old values are here:")
  2064 		--nw WriteLnToConsole("About to set up all circles, old values are here:")
  2068 		for i = 0,(vCCount-1) do
  2065 		for i = 0,(vCCount-1) do
  2118 
  2115 
  2119 	targetHit = false
  2116 	targetHit = false
  2120 
  2117 
  2121 	-- if circle is hit by player fire
  2118 	-- if circle is hit by player fire
  2122 	if (GetGearType(gear) == gtExplosives) then
  2119 	if (GetGearType(gear) == gtExplosives) then
  2123 		circsHit = 0
  2120 		local circsHit = 0
  2124 
  2121 
  2125 		for i = 0,(vCCount-1) do
  2122 		for i = 0,(vCCount-1) do
  2126 
  2123 
  2127 			--nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i)
  2124 			--nw WriteLnToConsole("Is it neccessary to check for collision with circ " .. i)
  2128 
  2125 
  2129 			--nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i)
  2126 			--nw WriteLnToConsole("YES. about to calc distance between gtExplosives and circ " .. i)
  2130 
  2127 
  2131 			dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i])
  2128 			local dist = GetDistFromGearToXY(gear, vCircX[i], vCircY[i])
  2132 
  2129 
  2133 			-- calculate my real radius if I am an aura
  2130 			-- calculate my real radius if I am an aura
       
  2131 			local NR
  2134 			if vCircType[i] == 0 then
  2132 			if vCircType[i] == 0 then
  2135 				NR = vCircRadius[i]
  2133 				NR = vCircRadius[i]
  2136 			else
  2134 			else
  2137 				NR = (48/100*vCircRadius[i])/2
  2135 				NR = (48/100*vCircRadius[i])/2
  2138 			end
  2136 			end
  2183 		end
  2181 		end
  2184 
  2182 
  2185 	-- if player is hit by circle bazooka
  2183 	-- if player is hit by circle bazooka
  2186 	elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then
  2184 	elseif (GetGearType(gear) == gtShell) and (CurrentHedgehog ~= nil) then
  2187 
  2185 
  2188 		dist = GetDistFromGearToGear(gear, CurrentHedgehog)
  2186 		local dist = GetDistFromGearToGear(gear, CurrentHedgehog)
  2189 
  2187 
  2190 		if beam == true then
  2188 		if beam == true then
  2191 
  2189 
  2192 			if dist < 3000 then
  2190 			if dist < 3000 then
  2193 				tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
  2191 				local tempE = AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, true)
  2194 				g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  2192 				SetVisualGearValues(tempE, nil, nil, nil, nil, nil, nil, nil, nil, nil, 0xff00ffff )
  2195 				SetVisualGearValues(tempE, g1, g2, g3, g4, g5, g6, g7, g8, g9, 0xff00ffff )
       
  2196 				PlaySound(sndVaporize)
  2193 				PlaySound(sndVaporize)
  2197 				DeleteGear(gear)
  2194 				DeleteGear(gear)
  2198 
  2195 
  2199 				SK = SK + 1
  2196 				SK = SK + 1
  2200 				if SK == 5 then
  2197 				if SK == 5 then
  2231 	for i = 0,(vCCount-1) do
  2228 	for i = 0,(vCCount-1) do
  2232 
  2229 
  2233 
  2230 
  2234 		--nw WriteLnToConsole("Attempting to calculate dist of circ " .. i)
  2231 		--nw WriteLnToConsole("Attempting to calculate dist of circ " .. i)
  2235 
  2232 
  2236 		g1X, g1Y = GetGearPosition(CurrentHedgehog)
  2233 		local g1X, g1Y = GetGearPosition(CurrentHedgehog)
  2237 		g2X, g2Y = vCircX[i], vCircY[i]
  2234 		local g2X, g2Y = vCircX[i], vCircY[i]
  2238 
  2235 
  2239 		g1X = g1X - g2X
  2236 		g1X = g1X - g2X
  2240 		g1Y = g1Y - g2Y
  2237 		g1Y = g1Y - g2Y
  2241 		dist = (g1X*g1X) + (g1Y*g1Y)
  2238 		local dist = (g1X*g1X) + (g1Y*g1Y)
  2242 
  2239 
  2243 		--nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist)
  2240 		--nw WriteLnToConsole("Calcs done. Dist to CurrentHedgehog is " .. dist)
  2244 
  2241 
  2245 		-- calculate my real radius if I am an aura
  2242 		-- calculate my real radius if I am an aura
       
  2243 		local NR
  2246 		if vCircType[i] == 0 then
  2244 		if vCircType[i] == 0 then
  2247 			NR = vCircRadius[i]
  2245 			NR = vCircRadius[i]
  2248 		else
  2246 		else
  2249 			NR = (48/100*vCircRadius[i])/2
  2247 			NR = (48/100*vCircRadius[i])/2
  2250 		end
  2248 		end
  2259 
  2257 
  2260 			elseif (vCircActive[i] == true) and
  2258 			elseif (vCircActive[i] == true) and
  2261 					( (vType[i] == "drone") or (vType[i] == "blueboss") )
  2259 					( (vType[i] == "drone") or (vType[i] == "blueboss") )
  2262 			then
  2260 			then
  2263 
  2261 
  2264 				ss = CircleDamaged(i)
  2262 				local ss = CircleDamaged(i)
  2265 				local explosion
  2263 				local explosion
  2266 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  2264 				if vType[i] == "blueboss" then explosion = true else explosion = false end
  2267 
  2265 
  2268 				local kamikaze = false
  2266 				local kamikaze = false
  2269 				if ss == "fatal" then
  2267 				if ss == "fatal" then
  2336 			if vCircRadCounter[i] == 100 then
  2334 			if vCircRadCounter[i] == 100 then
  2337 
  2335 
  2338 				vCircRadCounter[i] = 0
  2336 				vCircRadCounter[i] = 0
  2339 
  2337 
  2340 				-- make my radius increase/decrease faster if I am an aura
  2338 				-- make my radius increase/decrease faster if I am an aura
       
  2339 				local M
  2341 				if vCircType[i] == 0 then
  2340 				if vCircType[i] == 0 then
  2342 					M = 1
  2341 					M = 1
  2343 				else
  2342 				else
  2344 					M = 10
  2343 					M = 10
  2345 				end
  2344 				end
  2359 				--vgtSteam -- nice long trail
  2358 				--vgtSteam -- nice long trail
  2360 				--vgtDust -- short trail on earthrise
  2359 				--vgtDust -- short trail on earthrise
  2361 				--vgtSmokeTrace
  2360 				--vgtSmokeTrace
  2362 				if vType[i] == "ammo" then
  2361 				if vType[i] == "ammo" then
  2363 
  2362 
  2364 					tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true)
  2363 					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtSmoke, 0, true)
  2365 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  2364 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, nil, nil, vCircCol[i] )
  2366 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, g8, g9, vCircCol[i] )
       
  2367 
  2365 
  2368 				elseif vType[i] == "bonus" then
  2366 				elseif vType[i] == "bonus" then
  2369 
  2367 
  2370 					tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
  2368 					local tempE = AddVisualGear(vCircX[i], vCircY[i], vgtDust, 0, true)
  2371 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  2369 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], nil, nil, nil, nil, nil, 1, nil, 0xff00ffff )
  2372 					SetVisualGearValues(tempE, vCircX[i], vCircY[i], g3, g4, g5, g6, g7, 1, g9, 0xff00ffff )
       
  2373 
  2370 
  2374 
  2371 
  2375 				elseif vType[i] == "blueboss" then
  2372 				elseif vType[i] == "blueboss" then
  2376 
  2373 
  2377 					k = 25
  2374 					local k = 25
  2378 					g = vgtSteam
  2375 					local g = vgtSteam
  2379 					trailColour = 0xae00ffff
  2376 					local trailColour = 0xae00ffff
  2380 
  2377 
  2381 					-- 0xffae00ff -- orange
  2378 					-- 0xffae00ff -- orange
  2382 					-- 0xae00ffff -- purp
  2379 					-- 0xae00ffff -- purp
  2383 
  2380 
       
  2381 					local tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
       
  2382 					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
       
  2383 
  2384 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2384 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2385 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  2385 					SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
  2386 					SetVisualGearValues(tempE, vCircX[i], vCircY[i]+k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
       
  2387 
  2386 
  2388 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2387 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
  2389 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
  2388 					SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, nil, nil, nil, nil, nil, nil, nil, trailColour-75 )
  2390 					SetVisualGearValues(tempE, vCircX[i]+k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
       
  2391 
       
  2392 					tempE = AddVisualGear(vCircX[i], vCircY[i], g, 0, true)
       
  2393 					g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(tempE)
       
  2394 					SetVisualGearValues(tempE, vCircX[i]-k, vCircY[i]-k, g3, g4, g5, g6, g7, g8, g9, trailColour-75 )
       
  2395 
  2389 
  2396 
  2390 
  2397 				end
  2391 				end
  2398 
  2392 
  2399 
  2393 
  2419 				vCircDX[i] = -5	--5 circmovchange
  2413 				vCircDX[i] = -5	--5 circmovchange
  2420 			elseif vCircX[i] < -1500 then
  2414 			elseif vCircX[i] < -1500 then
  2421 				vCircDX[i] = 5	--5 circmovchange
  2415 				vCircDX[i] = 5	--5 circmovchange
  2422 			else
  2416 			else
  2423 
  2417 
  2424 				z = GetRandom(2)
  2418 				local z = GetRandom(2)
  2425 				if z == 1 then
  2419 				if z == 1 then
  2426 					z = 1
  2420 					z = 1
  2427 				else
  2421 				else
  2428 					z = -1
  2422 					z = -1
  2429 				end
  2423 				end
  2433 			if vCircY[i] > 1500 then
  2427 			if vCircY[i] > 1500 then
  2434 				vCircDY[i] = -5	--5 circmovchange
  2428 				vCircDY[i] = -5	--5 circmovchange
  2435 			elseif vCircY[i] < -2900 then
  2429 			elseif vCircY[i] < -2900 then
  2436 				vCircDY[i] = 5	--5 circmovchange
  2430 				vCircDY[i] = 5	--5 circmovchange
  2437 			else
  2431 			else
  2438 				z = GetRandom(2)
  2432 				local z = GetRandom(2)
  2439 				if z == 1 then
  2433 				if z == 1 then
  2440 					z = 1
  2434 					z = 1
  2441 				else
  2435 				else
  2442 					z = -1
  2436 					z = -1
  2443 				end
  2437 				end
  2463 
  2457 
  2464 		end
  2458 		end
  2465 
  2459 
  2466 		if (TimeLeft == 0) and (tumbleStarted == true) then
  2460 		if (TimeLeft == 0) and (tumbleStarted == true) then
  2467 
  2461 
  2468 			FadeAlpha = FadeAlpha + 1
  2462 			fadeAlpha = fadeAlpha + 1
  2469 			if FadeAlpha >= 255 then
  2463 			if fadeAlpha >= 255 then
  2470 				FadeAlpha = 255
  2464 				fadeAlpha = 255
  2471 			end
  2465 			end
  2472 
  2466 
  2473 		end
  2467 		end
  2474 
  2468 
  2475 
  2469 
  2480 		end
  2474 		end
  2481 
  2475 
  2482 	end
  2476 	end
  2483 
  2477 
  2484 	for i = 0,(vCCount-1) do
  2478 	for i = 0,(vCCount-1) do
  2485 		g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
  2479 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i])
  2486 		SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, g10)
       
  2487 	end
  2480 	end
  2488 
  2481 
  2489 	if 	(TimeLeft == 0) or
  2482 	if 	(TimeLeft == 0) or
  2490 		((tumbleStarted == false)) then
  2483 		((tumbleStarted == false)) then
  2491 		for i = 0,(vCCount-1) do
  2484 		for i = 0,(vCCount-1) do
  2492 			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(vCirc[i])
  2485 			SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], nil, nil, nil, nil, nil, vCircRadius[i], nil, (vCircCol[i]-fadeAlpha))
  2493 			SetVisualGearValues(vCirc[i], vCircX[i], vCircY[i], g3, g4, g5, g6, g7, vCircRadius[i], g9, (vCircCol[i]-FadeAlpha))
       
  2494 		end
  2486 		end
  2495 	end
  2487 	end
  2496 
  2488 
  2497 
  2489 
  2498 	if (CurrentHedgehog ~= nil) then
  2490 	if (CurrentHedgehog ~= nil) then
  2499 		if beam == true then
  2491 		if beam == true then
  2500 			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(pShield)
  2492 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, 0xa800ffff-0x000000ff - -shieldHealth )
  2501 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 200, g9, 0xa800ffff-0x000000ff - -shieldHealth )
       
  2502 			DrawTag(2)
  2493 			DrawTag(2)
  2503 		else
  2494 		else
  2504 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 )
  2495 			SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2505 		end
  2496 		end
  2506 
  2497 
  2507 		if shockwaveHealth > 0 then
  2498 		if shockwaveHealth > 0 then
  2508 			g1, g2, g3, g4, g5, g6, g7, g8, g9, g10 = GetVisualGearValues(shockwave)
  2499 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, shockwaveRad, nil, 0xff3300ff-0x000000ff - -shockwaveHealth )
  2509 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, shockwaveRad, g9, 0xff3300ff-0x000000ff - -shockwaveHealth )
       
  2510 		else
  2500 		else
  2511 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), g3, g4, g5, g6, g7, 0, g9, g10 )
  2501 			SetVisualGearValues(shockwave, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0)
  2512 		end
  2502 		end
  2513 
  2503 
  2514 	end
  2504 	end
  2515 
  2505 
  2516 
  2506 
  2520 
  2510 
  2521 	if (GetGearType(gear) == gtShell) then
  2511 	if (GetGearType(gear) == gtShell) then
  2522 
  2512 
  2523 		--nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID"))
  2513 		--nw WriteLnToConsole("ProjectileTrack() for Shell ID: " .. getGearValue(gear,"ID"))
  2524 
  2514 
  2525 		if (GetGearType(gear) == gtShell) then
  2515 		local turningSpeed = 0.1*fMod
  2526 			turningSpeed = 0.1*fMod
  2516 
  2527 		end
  2517 		local dx, dy = GetGearVelocity(gear)
  2528 
       
  2529 		dx, dy = GetGearVelocity(gear)
       
  2530 
  2518 
  2531 		--WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID"))
  2519 		--WriteLnToConsole("I'm trying to track currenthedge with shell ID: " .. getGearValue(gear,"ID"))
  2532 		--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
  2520 		--WriteLnToConsole("I just got the velocity of the shell. It is dx: " .. dx .. "; dy: " .. dy)
  2533 		--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
  2521 		--WriteLnToConsole("CurrentHedgehog is at X: " .. GetX(CurrentHedgehog) .. "; Y: " .. GetY(CurrentHedgehog) )
  2534 
  2522 
  2543 		else
  2531 		else
  2544 			dy = dy + turningSpeed
  2532 			dy = dy + turningSpeed
  2545 		end
  2533 		end
  2546 
  2534 
  2547 
  2535 
  2548 		if (GetGearType(gear) == gtShell) then
  2536 		local dxlimit = 0.4*fMod
  2549 			dxlimit = 0.4*fMod
  2537 		local dylimit = 0.4*fMod
  2550 			dylimit = 0.4*fMod
       
  2551 		end
       
  2552 
  2538 
  2553 		if dx > dxlimit then
  2539 		if dx > dxlimit then
  2554 			dx = dxlimit
  2540 			dx = dxlimit
  2555 		end
  2541 		end
  2556 		if dy > dylimit then
  2542 		if dy > dylimit then