Licencia desde 75 €
DE EN FR ES IT CZ

How to slide an object? Or send it to position?

Este debate tiene algunos años. Algunos detalles pueden referirse a una versión anterior de Visionaire Studio. Tutoriales actuales

  1. · 8 years ago
    I´m not sure about this but wouldn´t this register the draw function again and again? Since the draw function is called every frame this would get very expensive soon wink
    It doesn't really matter, you are just replacing the draw function inside of the table, but you can create the function that registers the draw function outside of the loop.

    Something along the lines of this...
    local health
    graphics.addDrawFunc("draw()", 0)
    
    function drawHealthBar()
     health = (Values["MC_health"].Int / 100) * 300
     -- + --
     function draw() graphics.drawBox(200, 200, health, 40, 0x0000ff, 1) end
    end
    
    registerEventHandler("mainLoop", "drawHealthBar")


  2. · 8 years ago
    I´m not sure about this but wouldn´t this register the draw function again and again? Since the draw function is called every frame this would get very expensive soon wink
    It doesn't really matter, you are just replacing the draw function inside of the table, but you can create the function that registers the draw function outside of the loop.

    Something along the lines of this...
    local health
    graphics.addDrawFunc("draw()", 0)
    
    function drawHealthBar()
     health = (Values["MC_health"].Int / 100) * 300
     -- + --
     function draw() graphics.drawBox(200, 200, health, 40, 0x0000ff, 1) end
    end
    
    registerEventHandler("mainLoop", "drawHealthBar")



    Thank you, it works. I've just added "if mc health < 0 set it to 0" through visual scripting and that's it here it is a wonderfull healthbar!
  3. · 8 years ago
    No worries. wink

Este tema está cerrado porque nadie ha respondido en más de un año. Puedes hacer tu pregunta en un tema nuevo.

Nuevo tema

¿Eliminar de verdad este mensaje?