Jump to content


Recommended Posts

Hello, I would like to know how to put a timer at the top of the screen, when we start our game.
Otherwise thank you very much for the previous answers, it helped me a lot !

Share this post

Link to post

Script.font = "" -- path "Font" -- use TrueType font file
Script.pos = Vec2(0,30) -- Vec2 "Position"
Script.size = 15 -- float "Size"
Script.color = Vec4(1,1,0,1) -- color "Color"
Script.offset = 20 -- int "Offset" -- make larger if numbers get cut off

function Script:Start()
    self.font = Font:Load(self.font,self.size)
    if self.font == nil then
        Debug:Error("Select a font")

function Script:PostRender(context)

    defaultFont = context:GetFont()

    r = self.size + self.offset
    w = self.pos.x + window:GetWidth()/2 - self.offset
    h = self.pos.y

    --time factor
    time = Time:GetCurrent()/1000

Share this post

Link to post

Yeah put a pivot in the scene and attach the script to the pivot. The pivot can be anywhere on the map. It doesn't matter because the PostRender() stuff will show up in the same place on screen regardless.




Share this post

Link to post

Yeah, man. That's a little quirk in the system that I guess Josh never got around to straightening out.

Go to Scripts folder, and find "Main.lua". Open that and look for this:

    if gamemenu:Hidden() then
        --Update the app timing

        --Update the world

    --Render the world

...then right before "world:Render()" add this line:




Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...