Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

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 6 years, 6 months 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.