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
#5107

Alex
V-Play Team

I still can’t quite understand what you trying to achieve, could you explain a little deeper what the outcome should be?

Anyway, with this code i have no problems moving around the entity, if you run it with enabled QML renderer then you can see that everything is in the right place.

import QtQuick 1.1
import VPlay 1.0
import Box2D 1.0

EntityBaseDraggable {
  id: obstacle
  entityType: "obstacle"

  width: size
  height: size

  property int size: 64
  property alias color: rectangle.color

  colliderComponent: collider
  selectionMouseArea.anchors.fill: item
  gridSize: size

  ParallaxItem {
    id: item
    //ratio: Qt.point(0.8,1.0)
    x: -width/2
    y: -height/2
    width: parent.width
    height: parent.height

    Rectangle {
      id: rectangle
      color: "grey"
      anchors.fill: parent
    }
  }

  BoxCollider {
    id: collider
    x: -width/2
    y: -height/2
    width: obstacle.width
    height: obstacle.height
    bodyType: Body.Static
  }
}

The BoxCollider must be a direct child of the EntitiyBase to work properly.

To help you any further i will need a little more information about the exact functionality that you want to achieve. 😉

 

Cheers, Alex

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