Forums

OverviewV-Play 1 SupportEntityBaseDraggable with embedded ParallaxItem › Reply To: EntityBaseDraggable with embedded ParallaxItem

OverviewV-Play 1 SupportEntityBaseDraggable with embedded ParallaxItem › Reply To: EntityBaseDraggable with embedded ParallaxItem
#5099

Martin

Ok, there are still some issues with this. First of all, the ratio of such an EntityBaseDraggable with ParallaxItem has to be 1 initially and adjusted after it was created which is also the case for the position. Otherwise it will jump away from the mouse/finger when released. I figured out how to do this but interestingly, only the x component has to be modified, y is fine which is weird. In the respective BuildEntityButton, I have some code like this

    onEntityWasBuilt: {
        var obstacles = entityManager.getEntityArrayByType("obstacle");
        var o = obstacles[obstacles.length-1];

        var ratio = 1.5;
        var lx = levelContainer.x;      // position in the level
        var ly = levelContainer.y;
        var x1 = o.x + lx;              // split x
        var x2 = o.x - x1;

        o.x = x1/ratio + x2;            // x has to be adjusted according to parallax ratio
        o.y = o.y;                      // y not...?
        o.ratio = ratio;                // set parallax ratio
    }

Next thing is that I am not able to drag or remove such an entity once it is created. I guess you should be able to reproduce these problems with an EntityBaseDraggable as in post #5074.

Cheers, Martin

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