License from €75 Log in
DE EN FR ES IT CZ

Rotating interface?

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    Hi, I've recently started with Visionaire and still find Lua a little tricky.
    The thing is, I need to put a clock on my adventure game (similar to the Don't Starve clock in the top right corner).
    I was trying a simple script I saw in one of the posts in this forums; and with a scene object it worked really great, making it rotate at the speed I needed. But since I need the clock to be in all scenes, I tried to do the same with an interface, but I can't seem to find a way to do it. I would really appreciate some help here!
    Thanks!

    PS: This is what I had with the object:

    
    local obj = Scenes["Test1"].Objects["Object1"]
    
    obj.RotationCenter = {x = -1, y = -1} -- define rotation center as center of sprite
    
    obj:to(60000, {Rotation = math.rad(-360)}, easeLinearInOut, true, false)
    
    
  2. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 12 years ago
    because the objects on an interface are "buttons" you could try this:
    local obj = Interfaces["intrfacename"].Buttons["buttonname"]
    
  4. · 12 years ago
    Rotation are not yet working for interfaces as is scaling.
  5. · 12 years ago
    Thank you both for the quick response :-)

    @Sebastian.204 Yes, I already tried it before posting but sadly it didn't work

    @SimonS Oops that doesn't sound like good news...

    Any idea on how to make it work? On how to make a turning clock permanently on screen?

    Thank you all!
  6. · 12 years ago
    Anyone has any idea on how to rotate an interface?
  7. · 12 years ago
    you could try making an animation with the full rotating clock and defining with lua which frames are first/last to be shown
  8. · 12 years ago
    Wouldn't that take a lot of space? I want to put several minutes in the clock...
  9. · 12 years ago
    I dont know the clock in don't starve put you need to make a frame for each state.

    When your clock would look like a normal clock i would suggest to split it up to 3 animations. Each needs 60 frames for each pointer.
    pointer 1 for seconds
    pointer 2 for minutes
    pointer 3 ....
  10. · 12 years ago
    If the image frames are small & you convert the png files to webp then I don't see any issue with using animations & controlling the displayed frame using Lua script or by using a value & adding if queries directly into the frames themselves.

    The only alternative would be to duplicate the clock objects / animations for each scene & give them the same name throughout each scene & then use Lua to affect the objects of said names in current scene only...

    game.CurrentScene.SceneObjects["c_seconds"]:to(60000, {Rotation = math.rad(-360)})
    .. etc...
    


    The only problem I see with using rotation is it's a little hard to gage the amount of time you need it to rotate around. The minute & hour hand for example you would need to minus a certain degree value every 60 seconds.

    seconds: -6 (every 1000 ms)
    minutes: -6 (every 60000ms)
    hours: -0.1 (every 60000ms)

    On top of that you would still need to use values & if queries to determine if timer has run out.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?