Forums

OverviewV-Play 2 Support (Qt 5) › How anmation Works ?

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14226

    Victor

    Hi wodering, does the animation needs to be set within the Entity ?

     

    Meaning I have simple rectange EntityBase which I show in the defalut scene, and want to animate its moving to a diff position (in x or y), can I do that from the main.qml flie or should I do something similar to the 2028 sample by forc e (meaning setting the animation wihin the Rectangle.qml file)

    I havesomething like this in my main.qml file

     

    Block{
      anchors.centerIn: parent
            }
    
    NumberAnimation{
      id:animateBlock
      target:Block
      property:"x"
      from:0
      to:50
    }

     

    And this my rectangle.qml file

    import VPlay 2.0
    import QtQuick 2.0
    
    EntityBase {
    
        entityId: "rectangle1"
        entityType: "customEntity"
    
        Rectangle {
            id: block
            width: 30
            height: 50
            color: "red"        
        }   
    }

    So far I’m getting this error: qrc:///qml/VPlay/core/EntityBase.qml:567: ReferenceError: entityManager is not defined

     

    Sorry Im just starting with vPlay and not very proficient with JS

    Hope you understand my doubt, thx in advance.

    #14227

    Günther
    V-Play Team

    Hi Victor!

    The animation system is quite flexible. You can define the animation either in the item itself, or in another file where you actually use this item. Everything should work as long as the animation has access to the target item and the animated property.

    For EntityBase: Entities in V-Play can be dynamically created and added during runtime of your game are managed by the EntitiyManager. It keeps track of all the dynamically created entities and allows to retrieve entities based on their id. As soon as you use an entity with EntityBase, you should also add the EntityManager to your project:

     import VPlay 2.0
     import QtQuick 2.0
    
     GameWindow {
    
       EntityManager {
         id: entityManager
         entityContainer: scene
       }
    
       Scene {
         id: scene
    
         // .. all game code goes in here ..
       }
     }

     

    If you are new to V-Play, I strongly recommend to work through some of our getting started or game tutorials. You can also have a look at the free and open source demos and examples provided in the V-Play Sample Launcher.

    Best,
    Günther

     

     

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support