Forums

OverviewV-Play 1 SupportPositioning entities at center versus topleft (and dragging onto moved levels) › Reply To: Positioning entities at center versus topleft (and dragging onto moved levels)

OverviewV-Play 1 SupportPositioning entities at center versus topleft (and dragging onto moved levels) › Reply To: Positioning entities at center versus topleft (and dragging onto moved levels)
#7400

Arend

Hi Alex,

Thanks for your swift and thorough reply!

 

I’ve taken your advice on the “not allowed rectangle” and 0-coordinates, but implemented them in a bit of a non-conventional way :) I’ve taken the full source of BaseEntityDraggable and merged it into my own base class, stripped it down to the essentials relevant to my use-cases and modified it to my requirements. So rather than inheriting from BaseEntityDraggable, I used it as a template for my own base class now. It took a bit of effort to take everything apart, but I learned quite a bit from it and it now behaves exactly the way I want it to :)

 

Regarding the offsets, I moved the PhysicsWorld from the Scene into the Level, but that did not result in any visible difference for me. But indeed the problem was the entityContainer was still defaulting to the scene rather than the level for the BuildEntityButtons. I’ve reverted the “level || scene” statement back to “level”, but now indeed the BuildEntityButtons again didn’t work anymore, they kept failing with the message:

file::/qml/VPlay/level/BuildEntityButton.qml:372: TypeError: Result of expression 'createdEntity' [undefined] is not an object.

However, I did manage to work around it now by putting the Item hosting the BuildEntityButtons into a Component and loading it with a Loader item *after* the level had finished loading. Now it worked again, and indeed the offsets were correct from the start now.

 

Thanks & cheers!

Arend.

  • This reply was modified 4 years, 2 months ago by  arendjr.

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