Forums

OverviewV-Play 1 SupportAnchor wall to bottom of screen not working. › Reply To: Anchor wall to bottom of screen not working.

OverviewV-Play 1 SupportAnchor wall to bottom of screen not working. › Reply To: Anchor wall to bottom of screen not working.
#6947

lolly-pop

hello alex, thanks a lot for your explanation, i understand now what the problem was, and it seems as your hint is working fine, except one little new problem that i have…

 

i have a levelMovementAnimation inside the level object, and it does not move my level at all anymore, only if i use “target: window” which is absurt because

ofcourse i do not want to move the window item wiht the hud elements and so on, how can i move the level and all generated elemets (script for entityManager to randomly create obstacles onYChanged) inside it?

here is an code example to give you an overview:

 

import VPlay 1.0
import QtQuick 1.1

GameWindow {
    id: window
    activeScene: scene

    width: 640/2
    height: 1136/2

    EntityManager {
        id: entityManager
        entityContainer: scene.entityContainer
    }

    Scene {

        id: scene
        width: 320
        height: 480


        PhysicsWorld {
            id: physicsWorld
            z: 10
            updatesPerSecondForPhysics: 60
            gravity.y: -10
            velocityIterations: 5
            positionIterations: 5
            anchors.fill: entityContainer
        }

        property alias entityContainer: entityContainer
        Item {
            id: entityContainer
            anchors.fill: scene.gameWindowAnchorItem

            Rectangle {

                id: loader
                anchors.fill: parent

                Component.onCompleted: level.enterScene()

                Rectangle{

                    id: level
                    color: "lightblue"
                    anchors.fill: parent

                    EntityBase{

                        id: ground
                        height: 20

                        anchors{
                            left: parent.left
                            right: parent.right
                            bottom: parent.bottom
                        }

                        Rectangle {
                            anchors.fill: parent
                            color: "orange"
                        }

                        BoxCollider {
                            bodyType: Body.Static
                        }

                    }

                    MovementAnimation {
                        id: levelMovementAnimation
                        property: "y"
                        velocity: -20
                        target: level
                        running: true
                    }


                }

            }

            EntityBase{

                x: scene.gameWindowAnchorItem.width/2
                y: scene.gameWindowAnchorItem.height/2

                Rectangle {
                    width: 40
                    height: 40
                    x: -width/2
                    y: -height/2
                    color: "red"
                }

                CircleCollider{
                    id: collider
                    radius: 20
                    bodyType: Body.Dynamic
                    restitution: 1
                }
            }
        }
    }
}

 

  • This reply was modified 4 years, 3 months ago by  nixo33322342.

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