PVJsquad Posted April 2, 2014 Author Share Posted April 2, 2014 Hello guys i have problem with my engineI've previously added [http://www.eclipseorigins.com/community/index.php?/topic/128175-eo-30-tile-based-simulated-lighting-system-10-deathbeam/?hl=light](http://www.eclipseorigins.com/community/index.php?/topic/128175-eo-30-tile-based-simulated-lighting-system-10-deathbeam/?hl=light)which makes the problem is when I would add tile to light systems```Public Const TILE_TYPE_LIGHT as long = 'some number```and i add some script in **CalcVertexBrightness**```Public Function CalcVertexBrightness(LightX As Long, LightY As Long, VertexX As Long, VertexY As Long, Optional isTile As Boolean = False)Dim X1 As Long, x2 As Long, Y1 As Long, y2 As Long, distance As Double, LightSteps As Long Dim lXDistance As Long Dim lYDistance As Long Dim lDistance As Long Dim lVertexDistance As Long Dim lDistanceNormal As Long Dim lLightSteps As Long Dim lTileX As Long, lTileY As Long If Not isTile Then X1 = ConvertMapX(LightX * 32) + 8 Y1 = ConvertMapY(LightY * 32) + 8 x2 = VertexX y2 = VertexY Else lTileX = LightX - StartXValue lTileY = LightY - StartYValue If lTileX < 0 Then lTileX = 0 If lTileY < 0 Then lTileY = 0 X1 = ((LightX * 32) - (lTileX * PIC_X) - Camera.Left) + 8 Y1 = ((LightY * 32) - (lTileY * PIC_Y) - Camera.Top) + 8 x2 = VertexX y2 = VertexY End If lDistanceNormal = CLng(Sqr((PIC_X / 2) ^ 2 + (PIC_Y / 2) ^ 2)) '// Calculate distance from vertex lXDistance = CLng(Abs(X1 - x2)) lYDistance = CLng(Abs(Y1 - y2)) lVertexDistance = CLng(Sqr(lXDistance ^ 2 + lYDistance ^ 2) / lDistanceNormal) If lVertexDistance <= LIGHT_MAXSTEPS Then '// Calculate light steps lLightSteps = CLng(Abs((LIGHT_BEGIN - LIGHT_END)) / (LIGHT_MAXSTEPS)) If lLightSteps = 0 Then lLightSteps = 1 End If '// Calculate vertex brightness CalcVertexBrightness = CLng(LIGHT_BEGIN - (lVertexDistance * lLightSteps)) Else '// Return lowest value CalcVertexBrightness = LIGHT_END End IfEnd Function```i got problem like that>! ![](http://eclipseorigins.com/community/filehost/c9f1544a1bc3c52b18ac323fefea4121.png) some tile not like player lighting and top left is tile light and bottom right is tile darkmy predicition the error in that command```If Not isTile Then X1 = ConvertMapX(LightX * 32) + 8 Y1 = ConvertMapY(LightY * 32) + 8 x2 = VertexX y2 = VertexY Else lTileX = LightX - StartXValue lTileY = LightY - StartYValue If lTileX < 0 Then lTileX = 0 If lTileY < 0 Then lTileY = 0 X1 = ((LightX * 32) - (lTileX * PIC_X) - Camera.Left) + 8 Y1 = ((LightY * 32) - (lTileY * PIC_Y) - Camera.Top) + 8 x2 = VertexX y2 = VertexY End If```can you fix that Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now