Forums

OverviewV-Play 1 SupportRotation of Image, which is moved by Path Movement › Reply To: Rotation of Image, which is moved by Path Movement

OverviewV-Play 1 SupportRotation of Image, which is moved by Path Movement › Reply To: Rotation of Image, which is moved by Path Movement
#6587

PanflamCutie

Hi,

It seems that something isn’t fitting with my colliders (they are not where the image is positioned).
This is code of the tree-entity:

    x: column*gridSize +gridSize*0.5
    y: row*gridSize +gridSize*0.5

//    Rectangle {
//        id: sprite
//        color: "blue"
//        width: gridSize+1
//        height: gridSize+1
//        anchors.left: parent.left
//    }

         Image {
             id: sprite
             source: "../img/tree.png"

             // make it 1 pixel wider, otherwise there is a transparent pixel around the borders!
             width: gridSize
             height: gridSize
             anchors.left: parent.left

         }


        BoxCollider {
        id: collider
        width: gridSize
        height: gridSize
        anchors.left: parent.left
        bodyType: Body.Static
    }

And this is code of the dog-entity:

    x: column*gridSize +gridSize/2
    y: row*gridSize +gridSize/2

//    Rectangle {
//        id: dogImg
//        color: "blue"

//        width: gridSize+1
//        height: gridSize+1
//        anchors.left: parent.left
//        //transformOrigin: Item.Center
//    }

    Image {
        id: dogImg
        width: gridSize
        height: gridSize
        rotation: 90
        transformOrigin: Item.Center
        source: "../img/dog.png"

        x: -gridSize/2
        y: -gridSize/2
    }

    BoxCollider {
        id: collider
        width: gridSize
        height: gridSize
        bodyType: Body.Static

        x: -gridSize/2
        y: -gridSize/2
    }

The entities itself are in the grid, but it seems that the colliders are somewhere else and i don’t know how i should position them, so that they fit.

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