Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Everything posted by AggrorJorn

  1. "argument #3 is 'string';'[no object]' means that you put in an object rather than a string. Can you post the code were you print info? I tried with FlowGUI it's telling me "attempt to index field 'healthLabel' (a nil value) --line 93 Can you screenshot the scene tree were you have created the style, guimanager? Child/parent isn't really required but helps organising the scene. As long as the guimanager is loaded first and the styles are being loaded before you create the label, everything should work. If you look at any example scene from the FlowGUI project, you can see that I like to organise my scene as follow: pivot-GuiManager (gui manager script attached) pivot styles (no script attached) timerLabelStyle (labelstyle script attached) mycustomobject (in your case the timer) Referencing GUI manager and Timer lablestyle. here is loading the ui style with a wait time build in. I am not at home, so haven't tested it. --Load FlowGUI if a script makes use of it. import "Scripts/FlowGUI/FlowGUI.lua" Script.guiManager = nil --entity "GUI manager" Script.healthLabelStyle = nil --entity "HealthLabelStyle" Script.healthLabel = nil Script.uiLoadInterval = 1 Script.startTimeStamp = nil Script.uiLoaded = false function Script:Start() self.startTimeStamp = Time:GetCurrent() self.guiManager = self.guiManager.script end function Script:UpdateWorld() if self.uiLoaded == false and Time:GetCurrent()-self.startTimeStamp > self.uiLoadInterval then self.healthLabelStyle = self.healthLabelStyle.script:GetStyle() self:CreateLabel() sel.uiLoaded = true end end function Script:CreateLabel() self.healthLabel = FG_Label:Create() self.healthLabel:SetPosition(Vec2(200,120)) self.healthLabel:SetScale(Vec2(150,50)) self.healthLabel:SetText("Your health") self.healthLabel:SetGUIStyle(self.healthLabelStyle) self.healthLabel:SetTextPosition(FG_TextPosition.Center) self.healthLabel:SetDebug(false) self.guiManager:AddElement(self.healthLabel) end function Script:PostRender() if sel.uiLoaded then self.healthLabel:SetText("Your updated health") end end
  2. Really impressive stuff this. How you get this done so quickly is beyond me. I remember having spend weeks on an implementation of marching cubes, to only get a result were it took 3 seconds to render a small blob of voxels.
  3. You can load the font in the start function, and set the font in the postrender function. self.font = Font:Load("Fonts/arial.ttf",10) You can clean it up (like you already said) with something like this: centerTimerX = context:GetWidth() - (timerAreaWidth / 2) drawX = centerTimerX - (font:GetTextWidth(text)/2) You can also System:Print(font:GetTextWidth(text)) to see if the width of the text is actually changing. Sorry I was thinking of a healthbar for some reason, but it doesn't matter for its purpose.
  4. You can do a camera pick (so the pick starts from the camera point of view) https://www.leadwerks.com/learn?page=API-Reference_Object_Entity_Camera_Pick. The pick returns true or false. when pick is true, you can also retrieve information from the pickinfo object. In this object you find the position of the pick, normal etc. https://www.leadwerks.com/learn?page=API-Reference_Object_PickInfo
  5. Technically you would only have to recalculate the position if your health changes, but it can't hurt to do it every frame. Context:GetWidth will get you the width of your game window. GetTextWidth, will get get you the length of a text string. https://www.leadwerks.com/learn?page=API-Reference_Object_Asset_Font_GetTextWidth Alternatively with FlowGui. Best to download the sample project and opening a sample scene with text element. From the top of my head create a pivot and attach flowgui manager lua script create a pivot and attach label style lua script (here you can fine tune font, text size, color, center positioning) create a healtbar script (your existing script) which references the label style and flowgui manager. Add something like this: --Load FlowGUI if a script makes use of it. import "Scripts/FlowGUI/FlowGUI.lua" Script.guiManager = nil --entity "GUI manager" Script.healthLabelStyle = nil --entity "HealthLabelStyle" Script.healthLabel = nil function Script:UpdateWorld() self.healthLabelStyle = self.healthLabelStyle.script:GetStyle() self:CreateLabel() end function Script:CreateLabel() self.healthLabel = FG_Label:Create() self.healthLabel:SetPosition(Vec2(200,120)) self.healthLabel:SetScale(Vec2(150,50)) self.healthLabel:SetText("Your health") self.healthLabel:SetGUIStyle(self.healthLabelStyle) self.healthLabel:SetTextPosition(FG_TextPosition.Center) self.healthLabel:SetDebug(false) self.guiManager:AddElement(self.healthLabel) end function Script:PostRender() self.healthLabel:SetText("Your updated health") end
  6. One thing you can do is for every monster: Get position of monster. use Camera:Unproject(monsterPosition) to get the 2d coordinates of the monster's 3d position Do a distance check from the monster2dCoordinates to the crossHaird2dCoordinates.
  7. Ah I get it now. The best solution is not applying any 'move over' margin at all. Instead do the following: Lets say your health circle is 200 px wide. Get center position of the health UI: centerUiX = ScreenWidth - (healthCircleWidth/2) Get the healthAmountWidth of the text every frame. There is a leadwerks API command for that. Subtract half of the text width from the centerUiX: drawX = centerUiX - (healthAmountWidth/2) Draw the text with drawX; You can also use FlowGUI (free for download at https://bitbucket.org/Aggror/flowgui/src). I don't know if the official leadwerks UI has text centering.
  8. I am not really sure what you are trying to do. You are asking about centering text, but than demonstrate code that animates the text. Can you elaborate a little bit more.
  9. You can use raycasting for this. This older video uses C++ but the idea is the same.
  10. Verify integrity of game cache Restart your computer and relaunch Steam. Head over to the library section and right click on the game which is giving you problems. Click on its properties and select the local files. Click the “Verify Integrity of Game Cache” button and Steam will verify that game in a few minutes. Latest drivers? Verify if Visual Studio redistributable is installed. This can be found in the following folder: C:\Program Files (x86)\Steam\steamapps\common\\Leadwerks\_CommonRedist
  11. Try removing config file. User/MyDocuments/Leadwerks/Leadwerks.cfg
  12. Very cool. I will have to try this out. Looks like you made a ton of progress.
  13. Either adjust the pivot position in Blender or make the character model a child of the player and move it upwards. The physics controller remains on the parent.
  14. That is looking really cool. Like gamecreator said, people tend to underestimate how much work goes in to this.
  15. Lightning engine sounds really good to be honest. Fast as lightning, It is is good of you to give your opinion macklebee, that is what is needed to make it better. I agree that giving up Leadwerks as a brandname is a bit of a shame. Purely changing the name for pronunciation sake would not be my main reason though. I see it more as a fresh start. I have been pronouncing Leadwerks like 'leedworks' in my first year with Leadwerks. A message from Annika changed that when she corrected me on it. I think the name change to something shorter and using a more universal existing word was the right thing to do. However, I do see your point on the word 'Turbo' being an 'outdated' word. Like CangoJoe, the first thing that came to mind when reading the word 'Turbo', was Far cry blood dragon with its neon style. Since Josh has trademarked the engine and bought an expensive domain name, I just don't think it is going to change.
  16. I think the shortness of the name will make it stick more. Plus the words 'turbo' and 'engine' fit together really well. ps: don't forget to rename the 'Leadwerks 5' backers forum.
  17. Very nice, Will the sidebar return? I miss the recent blogs column.
  18. Blogs page looks nice. Does it simply pick the first image you have in the blog?
  19. Access to the Leadwerks 5 alpha forum Early access to demo's, tests Join discussions on development You are listed as supporter in the bottom of the forum You get a different forum status:
  20. Why do people pledge for kickstarter games when they are not playable? Because they want to support the development process and perhaps get insider knowledge that you otherwise don't get to know.
  21. This is so cool looking. I remember this presentation of a game developer on college where a similar technique was used for the game Delta Force. How terrible is the performance when doing this on the goblin? Have you ever thought about using a technique like this for the terrain? No idea if it is a valid technology, but terminology like voxels often make it to the screen when the terrain topic.
  22. Very cool. What kind of game are making?
  23. I just love how that gpu graph almost reaches full capacity. Its really awesome to see those animation tests evolve in something so powerfull. Cant wait to see what kind of magic you pull on the lights.
  24. For this reason (and a whole bunch more) I use vs code.
×
×
  • Create New...