Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 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 8 years, 1 month ago by  Stan.
    #7667

    Christian
    Felgo 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
    Felgo 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.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded