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 › BuildEntityButton – Properties

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #5211

    Saims

    Hi,

    I got one more question concerning the BuildEntityButton and the properties.

    So setting properties like a rotation works fine when dragging an entity into the game. But when I now have e.g. my wall with a rotation of 45, that I already dragged into the game, and I want to change it’s position by picking it up again, and moving it around, it loses it’s set property. Meaning in my case I dragged a wall with rotation 45 into the game, and after picking it up again, the rotation got reset to 0.

    Is this a known bug, or can I do anything against it?

    #5225

    Alex
    Felgo Team

    Hi, we can reproduce the problem and are currently investigating the issue. I’ll let you know as soon as we got a solution for you.

    Best Regards,

    Alex

    #5260

    Alex
    Felgo Team

    Hi again,

    a possible workaround would be not to set the rotation of the EntityBaseDraggable, but instead the rotation of all its children.

    import QtQuick 1.1
    import VPlay 1.0
    import Box2D 1.0
    
    EntityBaseDraggable {
      id: obstacle
      entityType: "obstacle"
    
      property int size: 64
      property alias rectRotation: rectangle.rotation
      property alias collRotation: collider.rotation
    
      width: size
      height: size
    
      colliderSize: size
    
      colliderComponent: collider
      selectionMouseArea.anchors.fill: collider
    
      Rectangle {
        id: rectangle
        color: "grey"
        x: -width/2
        y: -height/2
        width: parent.width
        height: parent.height
      }
      BoxCollider {
        id: collider
        x: -width/2
        y: -height/2
        bodyType: Body.Static
      }
    }

    And then call this in your BuildEntityButton:

    creationProperties: { "rectRotation" : 45, "collRotation" : 45 }

    Is this sufficient for your demand?

    Best Regards,
    Alex

     

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.