Forums

OverviewV-Play 1 Support › Layout of game is incorrect in window when I run a test app

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7665

    Stan

    Here there I am seeing this:

    https://snag.gy/pcBvT.jpg

    When I run the following code:

    import VPlay 1.0
    import QtQuick 1.1
    import Box2D 1.0
    
    GameWindow {
    
        id:window
    
        EntityManager {
            id:entityManager
            entityContainer: scene
        }
    
        Rectangle {
             anchors.fill: parent
             color: "black"
        }
    
        Scene {
            id:scene
    
            PhysicsWorld{
                gravity.y: -9.81
                z: 10
    
                updatesPerSecondForPhysics: 60
                velocityIterations: 5
                positionIterations: 5
    
            }
    
            EntityBase {
                entityId: "box1"
                entityType: "box"
    
                Image {
                    id: boxImage
                    source: "img/box.PNG"
                    width: 32
                    height: 32
                }
    
                BoxCollider{
                    anchors.fill: boxImage
                }
    
            }
        }
    
        EntityBase {
                 entityId: "ground1"
                 entityType: "ground"
                 height: 20
                 anchors {
                     bottom: scene.bottom
                     left: scene.left
                     right: scene.right
                 }
    
                 Rectangle {
                     anchors.fill: parent
                     color: "blue"
                 }
    
                 BoxCollider {
                     anchors.fill: parent
                     bodyType: Body.Static // the body shouldn't move
                 }
    
             }
    
    }

     

    I am pretty sure that the blue rectangle should be at the bottom but cannot figure out what I am doing wrong.

    • This topic was modified 4 years, 5 months ago.
    #7667

    Christian
    V-Play Team

    Hi Stan,

    that was a tricky one – took me a while to figure it out. 😉

    You have placed your ground entity not within the Scene. Just move it as child of Scene and it should work fine.

    Cheers, Chris

    #7674

    Stan

    Aha! Thanks for the feedback Chris. Got it working.

    #7676

    Christian
    V-Play Team

    That’s great to hear Stan!

    Cheers, Chris

Viewing 4 posts - 1 through 4 (of 4 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