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


Thanks for the support. Our setup is as follows: A level is several times larger than the screen so that it is scrolled according to the movement of the player or directly with the joystick controller in the level editor. It consists of three layers. (1) background, i.e. the bottom z=0 with ratio 0.8, (2) obstacles, i.e. the center z=1 with ratio 1.0, (3) non-colliding objects which are “on top” z=2 with ratio 1.4. In the level editor, objects have to be places on layers (2) and (3).

I tried to construct a simple example of our setup since some code is worth a thousand words. Unfortunately, I seem to have introduced an error by this which I have not been able to track down yet. Here comes the main.qml which unfortunately crashes…

import VPlay 1.0
import QtQuick 1.1

GameWindow {
    activeScene: scene
    width: 960; height: 640
    focus: true
    Keys.forwardTo: controller

        id: entityManager
        entityContainer: levelContainer
        dynamicCreationEntityList: [Qt.resolvedUrl("Block.qml")]

    TwoAxisController {
        id: controller
        inputActionsToKeyCode: {
            "up": Qt.Key_W,
                    "down": Qt.Key_S,
                    "left": Qt.Key_D,
                    "right": Qt.Key_A,
                    "fire": Qt.Key_Space

        target: levelContainer
        property: "pos"
        running: true
        property real scale: 200
        velocity: Qt.point(controller.xAxis*scale,controller.yAxis*scale)

    Scene {
        id: scene
        width: 480
        height: 320

        LevelEditor {
            id: levelEditor
            toRemoveEntityTypes: ["obstacle"]
            toStoreEntityTypes: ["obstacle"]

        // === LEVEL ===
            id: levelContainer

            // === BACKGROUND ===
                id: background
                ratio: Qt.point(0.6,0.6)

                // some generated background...
                    rows: 10; columns: 10; spacing: 50
                        model: 100
                            width: 100; height: 100
                            color: "grey"

            // === FOREGROUND ===
                id: levelgrid
                ratio: Qt.point(1,1)

                // some generated foreground...
                    rows: 10; columns: 10; spacing: 100
                        model: 100
                            x: 100; y: 100
                            width: 50; height: 50
                            color: "red"


//        BEButton{ }   // (*) we'll get to this later...

Moreover, save the code of your last post to Box.qml.

The error message then is

EntityBase: entityDestroyed received, setting visible to false
destroy item in AbstractCCNodeManager: QObject(0x9b4b4c0) , nodeMgr: CCRectangleManager(0x9690118) 
the node to remove does not have a parent! that should never happen, because it means the root object wanted to be deleted! 
The program has unexpectedly finished.

What’s the matter here?

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
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support