Este debate tiene algunos años. Algunos detalles pueden referirse a una versión anterior de Visionaire Studio. Tutoriales actuales
La versión gratuita permite hasta 25 escenas por proyecto. Para más escenas y para vender tu juego necesitas una licencia. Los lectores del foro tienen el Indie Bundle con un 15 % de descuento con el código FORUM15: 84,15 € en lugar de 99 €, válido hasta el 31/12/2026.Black Friday: el Indie Bundle tiene un 30 % de descuento hasta el 01/12/2026, 69,30 € en lugar de 99 €. El código BLACKFRIDAY ya está aplicado.
Conseguir un 15 % de descuento Pruébalo gratislocal cloud = ActiveAnimations["cloud"]
cloud:to(10000, { AnimationCurrentPosition = {x = -1000, y = cloud.AnimationCurrentPosition.y} }, easeLinearInOut, true, false)Thank you, I got another question. I'd need a way to scale an object based on a variable value, how can I achieve it? Basically it for an health barA'llo,You should create the cloud as an animation as it's much easier to move than objects. Object movement is offset based whereas animations can be moved to absolute positions.There are also multiple methods for moving objects & animations, but the simplest method is the to() tweening function as you can specify the time it takes to get from the starting position to the target position as well as specify easing & make it loop &/or loop forwards then backwards (pendulum) when it gets to the target position.Here's a quick example of how you could have a cloud move from a starting position, to an end position, then loop from the start again...local cloud = ActiveAnimations["cloud"] cloud:to(10000, { AnimationCurrentPosition = {x = -1000, y = cloud.AnimationCurrentPosition.y} }, easeLinearInOut, true, false)In the example above we are moving a cloud from the starting position to -1000 pixels over 10000ms (10 seconds) with linear easing (default easing) & once it reaches the target position it will loop back to the starting position & make its way across the scene again.Other alternatives are to increment the position of the animation via an execute a script action part that you create inside of the animation frame. Another method would be to use a mainLoop event handler & increment/decrement the position via that.Quick note #1: you need to make sure you set the animation to loop infinitely & also the animation should be assigned as the default animation of the scene object you created the animation under.Quick note #2: if you want to get a bit more creative with sliding objects around scenes, then you should look into math.random or the random value action part as it will allow you to create more dynamic content. For example, you could change the target position or the amount of time in which it should take to get from the starting position to the target position.
graphics.addDrawFunc("draw()", 0)
function draw()
graphics.drawBox(200, 200, 300, 40, 0x0000ff, 1)
endgraphics.addDrawFunc("draw()", 1)function draw()
graphics.drawBox(x, y, w, h, color, alpha)
end</div>
if Values["MC_health"].Int == 100
then
graphics.addDrawFunc("draw()", 0)
function draw()
graphics.drawBox(200, 200, 300, 40, 0x0000ff, 1)
else
if Values["MC_health"].Int == 50
then
graphics.addDrawFunc("draw()", 0)
function draw()
graphics.drawBox(200, 200, 150, 40, 0x0000ff, 1)
end end
if Values["MC_health"].Int > 50 then
graphics.addDrawFunc("draw()", 0)
function draw()
graphics.drawBox(200, 200, 300, 40, 0x0000ff, 1)
end
elseif Values["MC_health"].Int > 0 and Values["MC_health"].Int <= 50 then
graphics.addDrawFunc("draw()", 0)
function draw()
graphics.drawBox(200, 200, 150, 40, 0x0000ff, 1)
end
endPerfect it works.captcha code? I don't have one on here. I think there may be one for members with less than x posts as a anti-spam preventative, but sure, I also wish the captcha would bugger off too - 2 step verification as well & anti-cheat in games.No, something more like this...if Values["MC_health"].Int > 50 then graphics.addDrawFunc("draw()", 0) function draw() graphics.drawBox(200, 200, 300, 40, 0x0000ff, 1) end elseif Values["MC_health"].Int > 0 and Values["MC_health"].Int <= 50 then graphics.addDrawFunc("draw()", 0) function draw() graphics.drawBox(200, 200, 150, 40, 0x0000ff, 1) end endbut that's not a very efficient solution. It would be better to use some math to calculate the health bar width based on the value.
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![]()
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")Este tema está cerrado porque nadie ha respondido en más de un año. Puedes hacer tu pregunta en un tema nuevo.
Nuevo temaDeponia, The Whispered World y más de 160 juegos más se crearon con Visionaire Studio. La versión gratuita llega hasta 25 escenas. Para más escenas tienes Visionaire Studio PRO desde 75 €, y para vender tu juego el Indie Bundle por 99 €.
Hasta el 1 de diciembre: el Indie Bundle con un 30 % de descuento con el código BLACKFRIDAY, 69,30 € en lugar de 99 €.