havenphillip Posted February 20, 2018 Author Share Posted February 20, 2018 if enemyDrawX >= x and enemyDrawX <= self.miniMapSize.x and enemyDrawY <= self.miniMapSize.y and enemyDrawY >= y then I'm trying to get this to work but it's eliminating all the dots. Maybe something in my script that I did somewhere that negates it? Or maybe is there a way to say "not greater than"? Like a ~>? I tried but figured probably not. Mini Map.lua Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 20, 2018 Share Posted February 20, 2018 Ah that would not work I see now. Can you undo the if statement with the last changes and make a screenshot of what your are currently seeing. That last if statement is also confusing me a little since I would not expect any enemies to found outside the drawing rectangle. But perhaps with an offset here and there, some enemies might slip through. Alternatively the calculation for drawing the enemy pos is not correct. Everything so has been from the top of my head. If you want I can have a look at your project. Can you send the project via pm? (excluding assets I do not need.) Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 20, 2018 Author Share Posted February 20, 2018 Actually this is working pretty good. It's close to perfect. Maybe you can explain why. Instead of x and y I used dotX and dotY which I made in order to get the zoom to work right. Originally the dots were sort of "slipping" over the terrain and that's fixed: --set enemy entities dot color and position local miniMapEnemySize = Vec2(self.miniMapSize.x/25,self.miniMapSize.y/25) --local radarHalf = self.miniMapSize.y/2 * (self.miniMapSize.x), self.miniMapSize.y/2 * (self.miniMapSize.y) local radarHalf = Vec2((self.radar / 2 / self.radar) * (self.miniMapSize.x), (self.radar / 2 / self.radar) * (self.miniMapSize.y)) local dotX = (self.miniMapSize.x / self.cameraRng / self.zoom) local dotY = (self.miniMapSize.y / self.cameraRng / self.zoom) for k, v in pairs(self.enemyEntities) do if self.enemyEntities[k].script.enabled == true then if self.enemyEntities[k].script.mode ~= "dying" and self.enemyEntities[k].script.mode ~= "dead" then enemy = self.enemyEntities[k]:GetPosition() enemyDrawX = dotX * (enemy.x - pos.x) + radarHalf.x enemyDrawY = dotY * (pos.z - enemy.z) + radarHalf.y if enemyDrawX > dotX and enemyDrawX <= self.miniMapSize.x and enemyDrawY <= self.miniMapSize.y and enemyDrawY > dotY then context:SetColor(1,0,0,1) context:DrawRect(x + enemyDrawX, y + enemyDrawY, miniMapEnemySize.x, miniMapEnemySize.y, 0, 1) end end end end Yeah, man. You can check out whatever I got. I don't have a game, per se, but I'll send you my whole project. I'm mostly just learning Leadwerks and getting the basics of making a game. But whatever I got you can check out, but you'll have to explain to me how to send a project through pm. I don't even know where the pm button is lol. One last thing is that the minimap shows my other HUD elements inside the minimap. I don't know of any way to get rid of that but I would love to get rid of it. It's workable as is but it's one of those little annoyances in the back of my mind. Here's the most recent version: Mini Map.lua Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 20, 2018 Author Share Posted February 20, 2018 Also here's the Radar Effect standalone: Radar Effect.lua Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 21, 2018 Share Posted February 21, 2018 I actually meant a zip file so that I can import the project and try out the map.(minus unnecessary models, sounds etc). I would have to build up a scene from scratch to try out your code. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 21, 2018 Author Share Posted February 21, 2018 Oh ok. It's no problem but you may have to explain to me how to do that. I'll look it up and see if I can figure out .zip files. But the code should work in any project so long as you put "GetKeyValue("type","enemy") in your enemy scripts (you can use crawlers) and have the code attached to a pivot and childed to a player, and have the shader at the bottom of the code named right and in the right folder..But whatever you want, man. I appreciate your help with this. I'm totally stoked on it! I'm going to go see if I can figure it out... Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 22, 2018 Share Posted February 22, 2018 You can go the project manager and press export. After the export is made simply exclude files that are not used by the map you want me to open. Think about sounds, models, terrain textures. This reduces the files you want to send to me significantly. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 27, 2018 Share Posted February 27, 2018 Sorry hadn't had time to look at the project yet. On 2/20/2018 at 5:28 PM, havenphillip said: One last thing is that the minimap shows my other HUD elements inside the minimap. I don't know of any way to get rid of that but I would love to get rid of it. It's workable as is but it's one of those little annoyances in the back of my mind. As for the UI being drawn inside the minimap: disable all UI widgets before rendering the world for the minimap. In you minimap script do something like: DisbaleUI() world:Render() EnableUI() The documentation contains a Hide and Show function for widgets you can use for this. https://www.leadwerks.com/learn?page=API-Reference_Object_Widget_Hide Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 27, 2018 Author Share Posted February 27, 2018 Ok I did this but it didn't work. I'm still trying to understand but it looks like the minimap takes a snapshot of the screen right at the start and renders it from the top view? So wouldn't I have to delay the healthbar, etc. within that code? Seems like delaying the minimap wouldn't work. in Minimap: function Script:UpdateWorld() if self.toggle==0 then self:DisableUI() world:Render() self:EnableUI() end function Script:DisableUI() self.player:Hide() end function Script:EnableUI() self.player:Show() end Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 28, 2018 Share Posted February 28, 2018 Are you using Leadwerks widgets or just drawimage etc? Can you post a screenshot of what is going wrong? I can't see the hud being drawn in the minimap. So during the update, your player camera is placed in the sky, rotated so that it looks down and then what the camera sees is being stored in a buffer. this buffer will result in to the minimap texture drawn on to the screen. Quote Link to comment Share on other sites More sharing options...
havenphillip Posted February 28, 2018 Author Share Posted February 28, 2018 Yeah I'm using the FPSPlayerStatusBar from the workshop and if you zoom out the minimap (down arrow) the health bar and stamina and ammo and the minimap itself can be seen in the minimap. I noticed the health, stamina, and ammo shown in the minimap don't change which leads me to conclude that it takes a snapshot of the first frame of the player cam, which I presume is what you mean about saving in a buffer. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted March 2, 2018 Share Posted March 2, 2018 That is the cool thing about game development. Things can magically work their way around in your game. I will have a look this weekend. I expect that a buffer needs to get cleared at some point. I can't find it in the API docs though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.