Jump to content

havenphillip

Members
  • Posts

    550
  • Joined

  • Last visited

Posts posted by havenphillip

  1. I just got a new computer I started having this problem. Seems like I've encountered this before but can't remember how to fix it but my numbers aren't showing up on start except for in one of the scripts. If I hit ESC then click somewhere random they appear and I can hit ESC again and it's fine. If I hit ESC and click randomly they appear but if I then hover the mouse over the words in the GUI they disappear again. How to fix this?
     

    numbers.png

  2. I got a new computer and downloaded Leadwerks but it won't start for some reason. I click and a window pops up "Preparing to launch Leadwerks Game Engine" then it disappears and nothing. No .dll errors or anything. Just won't start. What the heck?

  3. Oh awesome! That's exactly what I was looking for. I only need to do this and some PostRender() stuff but this is right.

    function NormalizeAngle(angle)
        if angle <= - 180 then
            return angle + 360
        elseif angle >= 180 then
            return angle - 360
        else
            return angle + 0
        end
    end

    Here it is. Working perfectly:
     

    UI Elements.zip

    • Upvote 1
  4. Does your camera have a script? I got this from Aggror's death trigger script. Maybe put this on your camara? You'd have to create a pivot and child the pivot where the camera will reset to the player too.

    Script.start = "" --entity "Start Point"

    function Script:Collision(entity, position, normal, speed)
        reset = self.start:GetPosition()
        self.entity:SetPosition(reset)
    end

  5. OK I'm going to have to keep looking at this to see if I can understand what I can get away with and what I can't. There's a few examples floating around but this is new territory. I feel like I'm about to level up.

  6. My idea is if I can create a single bounding box script and have different scripts call on it that way I can make multiple use of it, but how would I call the bounding box script in another script?

  7. I still want to learn that FlowGUI though. I studied some of the sample maps but the scripts call scripts that call scripts. Where's the starting point if I want to understand it? I want to read it all and understand the step by step logic. Where do I start? What's the first script? I also don't understand how you don't use the format "function Script:Start()" for instance but do things like "function GetGuiElements(guiType)". Reminds me of Rick's State Machine Coroutine thing he posted which  I also can't make sense of.

     

     

  8. Ah ok sweet that worked:

        context:DrawText(string.format("%.0f",self.timer), self.cirPos.x-14, self.cirPos.y-14, 30, 30, Text.VCenter+Text.Center)


    Cool I'll leave it here for whoever wanders by:
    Circle Timer.lua

    (Currently set up to attach to pivot then child to player. Kills player at zero)

  9. Yeah here's scene tree gui:

    Now I"m getting: attempt  to call method 'AddElement' (a nil value) -- Line 70

    Line 70:

        self.guiManager:AddElement(self.healthLabel)

    I don't know why it would be nil.

    Here's my current script. You can see it's a mess. System:Print is currently under PostRender near the bottom.

    "Timer" is this script on the tree.

    correctscripts.png

    Countdown Circle.lua

  10. Oh duh of course load the font in the Start()!

    It's not changing position. I'm not sure at what point we told it to. Tried System:Print it's telling me "argument #3 is 'string';'[no object]' expected. I'm not sure maybe I'm not putting the right thing in the brackets. I've tried "text" and "self.timer"

    I tried with FlowGUI it's telling me "attempt to index field 'healthLabel' (a nil value) --line 93

    line 93:

        self.healthLabel:SetText("Your updated health")

    I'm not supposed to child something to something or anything else, right? I created the two pivots with the correct scripts.

     

  11. Ok this is what I have. If I put it under PostRender() it loads the font like every second. Doesn't do that if I put it under Start() but I think that would probably defeat the purpose. The other thing is it doesn't move position when it changes from 100 to 99.

        --text positions
        font = Font:Load("Fonts/arial.ttf",10)
        context:SetFont(font)
        centerUiX = self.cirPos.x - self.radius/2
        timeX = font:GetTextWidth(text)
        drawX = centerUiX - timeX/2

       (self.cirPos.x is context:GetWidth I'll clean that up)

    I'm going to try this with your  FlowGUI. Also it's a countdown timer, though. Not health. I don't know if that changes anything. I think that may be why it's loading the font every second.

  12. OK that'll take me a minute. Let me see if I can do that. The healthAmountWidth every frame? Is that just context:GetWidth?

    I got the FlowGUI. I've looked through it before. It seems really cool but it's out of my league. If only there were a tutorial or something on it (cough cough).

  13. Ok like if the countdown is 100 the text is centered where I want it to be but once it goes to 99 it looks slightly left since it loses that third digit place. So I want to keep it looking centered as it counts down and my solution was to shift it over slightly so it looks centered at 99 like it does at 100. But my problem is I'm animating it across the screen. I just want it to scoot over a bit then stop moving.

    offcenter.png

  14. Is there a simpler way to center text so that it doesn't depend on the left margin? I have this counter and it looks right until it goes less than 100 and then less than 10. At that point it looks out of place. I thought I'd use "if self.timer...then self.textPos..." but then the text slides across the whole screen the whole time it's in the timer range. I want it to scoot over once then stop. How do I stop it?

     

        context:DrawText(""..Math:Round(self.timer),self.textPos, 465)

        --text positions
        if self.timer >= 100 and self.timer <= 999 then self.textPos = self.textPos  end
        if self.timer >= 10 and self.timer <= 99 then self.textPos = self.textPos +4  end --slides across screen at a rate of "4"
        if self.timer >= 0 and self.timer <= 9 then self.textPos = self.textPos +8  end --slides across screen at a rate of "8"

  15. Something like this maybe on the cube? I had to child the cube to the player. The numbers work and it follows the player but I don't know if it's what you're trying to do exactly you might have to mess with it.

     

    Script.Yue = nil --entity "Malla Jugador"
    Script.Pivote = nil --entity "Pivote"

    function Script:PostRender(context)
     
        self.pos = self.entity:GetPosition(true)
        DrawX = self.pos.x
        context:SetBlendMode(Blend.Alpha)
        context:SetColor(1,0,0,1)
        context:DrawText(""..Math:Round(DrawX), 2, 2)
        context:SetBlendMode(Blend.Solid)
        context:SetColor(1,1,1,1)
        context:DrawStats(2,22)
        
    end

×
×
  • Create New...