zomb88 Posted July 28, 2013 Author Share Posted July 28, 2013 Hey guys,Ive been doing alot of work on my game and whilst i have been holding back releasing any of it as tutorials i thought i would release this as it is a sort of essential addon to the minimap system posted by Ertzel.First you will need the tutorial posted by Ertzel found [HERE](http://www.eclipseorigins.com/community/index.php?/topic/129760-ea-minimap/?hl=minimap). This will give you the back bones.Once you have implemented his tutorial you just need to replace your DrawMiniMap sub with this one :)```Public Sub DrawMiniMap()Dim i As Long, z As LongDim x As Integer, y As IntegerDim direction As ByteDim CameraX As Long, CameraY As Long, playerNum As LongDim MapX As Long, MapY As Long, MinMapX As Long, MinMapY As LongDim CameraXSize As Long, CameraYSize As Long, CameraHalfX As Long, CameraHalfY As LongCameraXSize = ScreenWidth - 50 - (MAX_MAPX * 4)CameraYSize = ScreenHeight - 50 - (MAX_MAPY * 4)' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerCameraHalfX = (MAX_MAPX / 2)CameraHalfY = (MAX_MAPY / 2)MinMapX = Player(MyIndex).x - CameraHalfXMinMapY = Player(MyIndex).y - CameraHalfYMapX = Player(MyIndex).x + CameraHalfXMapY = Player(MyIndex).y + CameraHalfYIf Player(MyIndex).x <= CameraHalfX Then MinMapX = 0If Player(MyIndex).y <= CameraHalfY Then MinMapY = 0If MinMapX <= CameraHalfX Then MapX = MAX_MAPXIf MinMapY <= CameraHalfY Then MapY = MAX_MAPYIf MapX > Map.MaxX Then MapX = Map.MaxXIf MapY > Map.MaxY Then MapY = Map.MaxY ' Draw Outline For x = 0 To MAX_MAPX For y = 0 To MAX_MAPY CameraX = CameraXSize + (x * 4) CameraY = CameraYSize + (y * 4) RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 255, 255, 150) Next y Next x ' Draw Player dot For i = 1 To Player_HighIndex If IsPlaying(i) Then CameraX = CameraXSize + (((MiniMapPlayer(i).x / 4) - MinMapX) * 4) CameraY = CameraYSize + (((MiniMapPlayer(i).y / 4) - MinMapY) * 4) If (MiniMapPlayer(i).x / 4) < MapX Or (MiniMapPlayer(i).x / 4) > MinMapX Then If (MiniMapPlayer(i).y / 4) < MapY Or (MiniMapPlayer(i).y / 4) > MinMapY Then If GetPlayerMap(i) = GetPlayerMap(MyIndex) And (Not i = MyIndex) Then Select Case Player(i).PK Case 0 RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(0, 255, 0, 200) Case 1 RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(100, 0, 0, 200) End Select Else If (Map.MaxX - CameraHalfX) < (MiniMapPlayer(i).x / 4) Then CameraX = CameraXSize + ((MAX_MAPX - (Map.MaxX - (MiniMapPlayer(i).x / 4))) * 4) If (Map.MaxY - CameraHalfY) < (MiniMapPlayer(i).y / 4) Then CameraY = CameraYSize + ((MAX_MAPY - (Map.MaxY - (MiniMapPlayer(i).y / 4))) * 4) RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(0, 255, 0, 200) End If End If End If End If Next i ' Draw Tile Attribute For x = 0 To Map.MaxX For y = 0 To Map.MaxY If Map.Tile(x, y).Type > 0 Then CameraX = CameraXSize + ((x - MinMapX) * 4) CameraY = CameraYSize + ((y - MinMapY) * 4) If Player(MyIndex).x > (Map.MaxX - CameraHalfX) Then CameraX = CameraXSize + ((x - (Map.MaxX - MAX_MAPX)) * 4) If Player(MyIndex).y > (Map.MaxY - CameraHalfY) Then CameraY = CameraYSize + ((y - (Map.MaxY - MAX_MAPY)) * 4) If CameraX >= CameraXSize And CameraX <= CameraXSize + (MAX_MAPX * 4) And CameraY >= CameraYSize And CameraY <= CameraYSize + (MAX_MAPY * 4) Then Select Case Map.Tile(x, y).Type Case TILE_TYPE_BLOCKED RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 0, 0, 200) Case TILE_TYPE_WARP RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(75, 0, 155, 200) Case TILE_TYPE_ITEM RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(0, 155, 0, 200) Case TILE_TYPE_SHOP RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 125, 0, 200) End Select End If End If Next y Next x ' Draw NPC dot For i = 1 To MAX_MAP_NPCS If MapNpc(i).Num > 0 Then CameraX = CameraXSize + (((MiniMapNPC(i).x / 4) - MinMapX) * 4) CameraY = CameraYSize + (((MiniMapNPC(i).y / 4) - MinMapY) * 4) If Player(MyIndex).x > (Map.MaxX - CameraHalfX) Then CameraX = CameraXSize + (((MiniMapNPC(i).x / 4) - (Map.MaxX - MAX_MAPX)) * 4) If Player(MyIndex).y > (Map.MaxY - CameraHalfY) Then CameraY = CameraYSize + (((MiniMapNPC(i).y / 4) - (Map.MaxY - MAX_MAPY)) * 4) Select Case NPC(i).Behaviour Case NPC_BEHAVIOUR_ATTACKONSIGHT RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(0, 0, 0, 200) Case NPC_BEHAVIOUR_ATTACKWHENATTACKED RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(100, 0, 100, 200) Case NPC_BEHAVIOUR_SHOPKEEPER RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 125, 0, 200) Case NPC_BEHAVIOUR_FRIENDLY RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 0, 255, 200) Case NPC_BEHAVIOUR_GUARD RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(0, 255, 255, 200) End Select End If Next i ' directional blocks For x = 0 To Map.maxX For y = 0 To Map.maxY If Map.Tile(x, y).DirBlock >= 1 Then CameraX = CameraXSize + ((x - MinMapX) * 4) CameraY = CameraYSize + ((y - MinMapY) * 4) If Player(MyIndex).x > (Map.maxX - CameraHalfX) Then CameraX = CameraXSize + ((x - (Map.maxX - MAX_MAPX)) * 4) If Player(MyIndex).y > (Map.maxY - CameraHalfY) Then CameraY = CameraYSize + ((y - (Map.maxY - MAX_MAPY)) * 4) If CameraX >= CameraXSize And CameraX <= CameraXSize + (MAX_MAPX * 4) And CameraY >= CameraYSize And CameraY <= CameraYSize + (MAX_MAPY * 4) Then RenderTexture Tex_White, CameraX, CameraY, 0, 0, 4, 4, 4, 4, D3DColorRGBA(255, 0, 0, 200) End If End If Next Next' Error handlerExit Suberrorhandler:HandleError "DrawMiniMap", "modRendering", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub ```It has been written so that it will adjust based on your set resolution (this is for my personal project {multiple resolutions})**Currently this draws only:**- Tile Types- Players- NPCs- Directional Blocking**Update coming for:**- Events Link to comment Share on other sites More sharing options...
jcsnider Posted July 28, 2013 Share Posted July 28, 2013 Nice man, good job ^^.Edit: You may want to actually add a hyperlink on the "HERE" ;)Cheers,JC Link to comment Share on other sites More sharing options...
zomb88 Posted July 28, 2013 Author Share Posted July 28, 2013 oh sorry will do :) Link to comment Share on other sites More sharing options...
Philosophy Posted July 28, 2013 Share Posted July 28, 2013 Very nice! :-). and The hyperlink is fixed ;P Link to comment Share on other sites More sharing options...
zomb88 Posted July 29, 2013 Author Share Posted July 29, 2013 Thanks for your feedback there should be no problems (i tested multiple resolutions on my version and they all work) Link to comment Share on other sites More sharing options...
teamokell Posted October 2, 2013 Share Posted October 2, 2013 it would be even better if it were converted to directx 7.anyone? 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